summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2012-10-01 17:04:13 -0700
committerGilbert Gonzales <gilbert@lindenlab.com>2012-10-01 17:04:13 -0700
commit598f5345866c58abdd971935d80f9b53756042c9 (patch)
tree945df8428602b23c4b58a548922c0f8d2f672906
parent47abe344abb668a7b883674365ea74f30443c6bb (diff)
CHUI-102: Right clicking on a group conversation brings up the correct menu. The user can now view the group profile, activate the group and leave the group.
-rw-r--r--indra/newview/llconversationmodel.cpp8
-rw-r--r--indra/newview/llimfloatercontainer.cpp48
-rw-r--r--indra/newview/llimfloatercontainer.h4
-rw-r--r--indra/newview/skins/default/xui/en/menu_conversation.xml18
4 files changed, 69 insertions, 9 deletions
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index 265f77365f..3d1523c874 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -221,6 +221,14 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags)
items.push_back(std::string("separator_disconnect_from_voice"));
buildParticipantMenuOptions(items);
}
+ else if(this->getType() == CONV_SESSION_GROUP)
+ {
+ items.push_back(std::string("close_conversation"));
+ items.push_back(std::string("separator_disconnect_from_voice"));
+ items.push_back(std::string("group_profile"));
+ items.push_back(std::string("activate_group"));
+ items.push_back(std::string("leave_group"));
+ }
hide_context_entries(menu, items, disabled_items);
}
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index d25a195f33..b7f83e3c23 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -39,6 +39,7 @@
#include "llavatariconctrl.h"
#include "llavatarnamecache.h"
#include "llcallbacklist.h"
+#include "llgroupactions.h"
#include "llgroupiconctrl.h"
#include "llfloateravatarpicker.h"
#include "llfloaterpreference.h"
@@ -63,7 +64,9 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed)
mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLIMFloaterContainer::checkContextMenuItem, this, _2));
mEnableCallbackRegistrar.add("Avatar.EnableItem", boost::bind(&LLIMFloaterContainer::enableContextMenuItem, this, _2));
- mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelected, this, _2));
+ mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelectedAvatar, this, _2));
+
+ mCommitCallbackRegistrar.add("Group.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelectedGroup, this, _2));
// Firstly add our self to IMSession observers, so we catch session events
LLIMMgr::getInstance()->addSessionObserver(this);
@@ -731,7 +734,20 @@ void LLIMFloaterContainer::getSelectedUUIDs(uuid_vec_t& selected_uuids)
selected_uuids.push_back(conversationItem->getUUID());
}
}
-void LLIMFloaterContainer::doToSelected(const LLSD& userdata)
+
+const LLConversationItem * LLIMFloaterContainer::getCurSelectedViewModelItem()
+{
+ if(mConversationsRoot &&
+ mConversationsRoot->getCurSelectedItem() &&
+ mConversationsRoot->getCurSelectedItem()->getViewModelItem())
+ {
+ return static_cast<LLConversationItem *>(mConversationsRoot->getCurSelectedItem()->getViewModelItem());
+ }
+
+ return NULL;
+}
+
+void LLIMFloaterContainer::doToSelectedAvatar(const LLSD& userdata)
{
std::string command = userdata.asString();
uuid_vec_t selected_uuids;
@@ -741,14 +757,11 @@ void LLIMFloaterContainer::doToSelected(const LLSD& userdata)
getSelectedUUIDs(selected_uuids);
//Find the conversation floater associated with the selected id
conversation = LLIMFloater::findInstance(selected_uuids.front());
+ const LLConversationItem * conversationItem = getCurSelectedViewModelItem();
//When a one-on-one conversation exists, retrieve the participant id from the conversation floater b/c
//selected_uuids.front() does not pertain to the UUID of the person you are having the conversation with.
- if(conversation &&
- mConversationsRoot &&
- mConversationsRoot->getCurSelectedItem() &&
- mConversationsRoot->getCurSelectedItem()->getViewModelItem() &&
- static_cast<LLConversationItem *>(mConversationsRoot->getCurSelectedItem()->getViewModelItem())->getType() == LLConversationItem::CONV_SESSION_1_ON_1)
+ if(conversation && conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1)
{
currentSelectedUUID = conversation->getOtherParticipantUUID();
}
@@ -809,6 +822,25 @@ void LLIMFloaterContainer::doToSelected(const LLSD& userdata)
}
}
+void LLIMFloaterContainer::doToSelectedGroup(const LLSD& userdata)
+{
+ std::string action = userdata.asString();
+ LLUUID selected_group = getCurSelectedViewModelItem()->getUUID();
+
+ if (action == "group_profile")
+ {
+ LLGroupActions::show(selected_group);
+ }
+ else if (action == "activate_group")
+ {
+ LLGroupActions::activate(selected_group);
+ }
+ else if (action == "leave_group")
+ {
+ LLGroupActions::leave(selected_group);
+ }
+}
+
bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata)
{
std::string item = userdata.asString();
@@ -896,7 +928,7 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata)
bool LLIMFloaterContainer::checkContextMenuItem(const LLSD& userdata)
{
std::string item = userdata.asString();
- const LLUUID& id = static_cast<LLConversationItem *>(mConversationsRoot->getCurSelectedItem()->getViewModelItem())->getUUID();
+ const LLUUID& id = getCurSelectedViewModelItem()->getUUID();
if (item == std::string("is_blocked"))
{
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index 49a41e5cdd..9754f04fbe 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -112,7 +112,9 @@ private:
void setSortOrder(const LLConversationSort& order);
void getSelectedUUIDs(uuid_vec_t& selected_uuids);
- void doToSelected(const LLSD& userdata);
+ const LLConversationItem * getCurSelectedViewModelItem();
+ void doToSelectedAvatar(const LLSD& userdata);
+ void doToSelectedGroup(const LLSD& userdata);
bool checkContextMenuItem(const LLSD& userdata);
bool enableContextMenuItem(const LLSD& userdata);
diff --git a/indra/newview/skins/default/xui/en/menu_conversation.xml b/indra/newview/skins/default/xui/en/menu_conversation.xml
index 94399be61c..bf834ee9ff 100644
--- a/indra/newview/skins/default/xui/en/menu_conversation.xml
+++ b/indra/newview/skins/default/xui/en/menu_conversation.xml
@@ -26,6 +26,24 @@
</menu_item_call>
<menu_item_separator layout="topleft" name="separator_disconnect_from_voice"/>
<menu_item_call
+ label="Group Profile"
+ layout="topleft"
+ name="group_profile">
+ <on_click function="Group.DoToSelected" parameter="group_profile"/>
+ </menu_item_call>
+ <menu_item_call
+ label="Activate Group"
+ layout="topleft"
+ name="activate_group">
+ <on_click function="Group.DoToSelected" parameter="activate_group"/>
+ </menu_item_call>
+ <menu_item_call
+ label="Leave Group"
+ layout="topleft"
+ name="leave_group">
+ <on_click function="Group.DoToSelected" parameter="leave_group"/>
+ </menu_item_call>
+ <menu_item_call
label="View Profile"
layout="topleft"
name="view_profile">