diff options
author | Merov Linden <merov@lindenlab.com> | 2012-11-19 18:41:52 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2012-11-19 18:41:52 -0800 |
commit | 834ded33ae4926b59074f00c13fa3dbf228a3ba0 (patch) | |
tree | b8bc3bc57b6bf39a4abb1ceba5a3a4c9a96a945a /indra/newview/llfloaterimsessiontab.cpp | |
parent | 61f3c1b41ddedc16f2026c62600475105621b305 (diff) |
CHUI-470 : Fixed : Enable contextual menu in torn off conversations
Diffstat (limited to 'indra/newview/llfloaterimsessiontab.cpp')
-rw-r--r-- | indra/newview/llfloaterimsessiontab.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 69b42cdd6d..ef36a485a8 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -69,6 +69,12 @@ LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id) boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemCheck, this, _2)); mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.Enable", boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemEnable, this, _2)); + + // Right click menu handling + LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance(); + mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLFloaterIMContainer::checkContextMenuItem, floater_container, _2)); + mEnableCallbackRegistrar.add("Avatar.EnableItem", boost::bind(&LLFloaterIMContainer::enableContextMenuItem, floater_container, _2)); + mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLFloaterIMSessionTab::doToSelected, this, _2)); } LLFloaterIMSessionTab::~LLFloaterIMSessionTab() @@ -395,6 +401,7 @@ void LLFloaterIMSessionTab::buildConversationViewParticipant() p.view_model = &mConversationViewModel; p.root = NULL; p.use_ellipses = true; + p.options_menu = "menu_conversation.xml"; mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p); mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); // Attach that root to the scroller @@ -763,3 +770,35 @@ bool LLFloaterIMSessionTab::checkIfTornOff() return isTorn; } + +void LLFloaterIMSessionTab::doToSelected(const LLSD& userdata) +{ + // Get the list of selected items in the tab + // Note: By construction, those can only be participants so we do not check if they are sessions or something else + std::string command = userdata.asString(); + uuid_vec_t selected_uuids; + getSelectedUUIDs(selected_uuids); + + llinfos << "Merov debug : doToSelected, command = " << command << ", uuid size = " << selected_uuids.size() << llendl; + + // Perform the command (IM, profile, etc...) on the list using the general conversation container method + // *TODO : Move this method to LLAvatarActions + LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance(); + floater_container->doToParticipants(command, selected_uuids); +} + +void LLFloaterIMSessionTab::getSelectedUUIDs(uuid_vec_t& selected_uuids) +{ + const std::set<LLFolderViewItem*> selected_items = mConversationsRoot->getSelectionList(); + + std::set<LLFolderViewItem*>::const_iterator it = selected_items.begin(); + const std::set<LLFolderViewItem*>::const_iterator it_end = selected_items.end(); + + for (; it != it_end; ++it) + { + LLConversationItem* conversation_item = static_cast<LLConversationItem *>((*it)->getViewModelItem()); + selected_uuids.push_back(conversation_item->getUUID()); + } +} + + |