diff options
author | Merov Linden <merov@lindenlab.com> | 2012-10-03 17:17:45 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2012-10-03 17:17:45 -0700 |
commit | 7b158a074afc1f8aa87ce7e415400b6f04f0ee97 (patch) | |
tree | 288eab79ef5a884a5ce7552f2d99976901195a66 | |
parent | ba5760a4d9d110890aab26a394479b36e60915d7 (diff) | |
parent | 046e90a8f74f3c13107a7edc72e912799a5e62e9 (diff) |
Pull merge from richard/viewer-chui
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 75 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.h | 6 |
2 files changed, 46 insertions, 35 deletions
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index da4d1afb2b..36c39f5717 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -804,10 +804,29 @@ const LLConversationItem * LLIMFloaterContainer::getCurSelectedViewModelItem() return conversationItem; } -void LLIMFloaterContainer::doToUsers(const std::string& command, uuid_vec_t selectedIDS) +void LLIMFloaterContainer::getParticipantUUIDs(uuid_vec_t& selected_uuids) { - LLUUID userID; - userID = selectedIDS.front(); + //Find the conversation floater associated with the selected id + const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); + + if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT) + { + getSelectedUUIDs(selected_uuids); + } + //When a one-on-one conversation exists, retrieve the participant id from the conversation floater + else if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1) + { + LLIMFloater *conversationFloater = LLIMFloater::findInstance(conversationItem->getUUID()); + LLUUID participantID = conversationFloater->getOtherParticipantUUID(); + selected_uuids.push_back(participantID); + } +} + +void LLIMFloaterContainer::doToParticipants(const std::string& command, uuid_vec_t& selectedIDS) +{ + if(selectedIDS.size() > 0) +{ + const LLUUID userID = selectedIDS.front(); if ("view_profile" == command) { @@ -858,32 +877,16 @@ void LLIMFloaterContainer::doToUsers(const std::string& command, uuid_vec_t sele LLAvatarActions::toggleBlock(userID); } } - -void LLIMFloaterContainer::doToSelectedParticipant(const std::string& command) -{ - uuid_vec_t selected_uuids; - getSelectedUUIDs(selected_uuids); - - doToUsers(command, selected_uuids); } -void LLIMFloaterContainer::doToSelectedConversation(const std::string& command) +void LLIMFloaterContainer::doToSelectedConversation(const std::string& command, uuid_vec_t& selectedIDS) { - LLUUID participantID; - //Find the conversation floater associated with the selected id const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); LLIMFloater *conversationFloater = LLIMFloater::findInstance(conversationItem->getUUID()); if(conversationFloater) { - //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(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1) - { - participantID = conversationFloater->getOtherParticipantUUID(); - } - //Close the selected conversation if("close_conversation" == command) { @@ -903,9 +906,7 @@ void LLIMFloaterContainer::doToSelectedConversation(const std::string& command) } else { - uuid_vec_t selected_uuids; - selected_uuids.push_back(participantID); - doToUsers(command, selected_uuids); + doToParticipants(command, selectedIDS); } } } @@ -914,16 +915,17 @@ void LLIMFloaterContainer::doToSelected(const LLSD& userdata) { std::string command = userdata.asString(); const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); + uuid_vec_t selected_uuids; + + getParticipantUUIDs(selected_uuids); - if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1 || - conversationItem->getType() == LLConversationItem::CONV_SESSION_GROUP || - conversationItem->getType() == LLConversationItem::CONV_SESSION_AD_HOC) + if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT) { - doToSelectedConversation(command); + doToParticipants(command, selected_uuids); } else { - doToSelectedParticipant(command); + doToSelectedConversation(command, selected_uuids); } } @@ -950,7 +952,12 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) { std::string item = userdata.asString(); uuid_vec_t mUUIDs; - getSelectedUUIDs(mUUIDs); + getParticipantUUIDs(mUUIDs); + + if(mUUIDs.size() <= 0) + { + return false; + } // Note: can_block and can_delete is used only for one person selected menu // so we don't need to go over all uuids. @@ -972,7 +979,7 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) return false; } - bool result = (mUUIDs.size() > 0); + bool result = true; uuid_vec_t::const_iterator id = mUUIDs.begin(), @@ -1033,11 +1040,15 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) bool LLIMFloaterContainer::checkContextMenuItem(const LLSD& userdata) { std::string item = userdata.asString(); - const LLUUID& id = getCurSelectedViewModelItem()->getUUID(); + uuid_vec_t mUUIDs; + getParticipantUUIDs(mUUIDs); + if(mUUIDs.size() > 0 ) + { if (item == std::string("is_blocked")) { - return LLAvatarActions::isBlocked(id); + return LLAvatarActions::isBlocked(mUUIDs.front()); + } } return false; diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 5702b88a48..832e67ae23 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -114,10 +114,10 @@ private: void getSelectedUUIDs(uuid_vec_t& selected_uuids); const LLConversationItem * getCurSelectedViewModelItem(); + void getParticipantUUIDs(uuid_vec_t& selected_uuids); void doToSelected(const LLSD& userdata); - void doToSelectedConversation(const std::string& command); - void doToSelectedParticipant(const std::string& command); - void doToUsers(const std::string& command, uuid_vec_t selectedIDS); + void doToSelectedConversation(const std::string& command, uuid_vec_t& selectedIDS); + void doToParticipants(const std::string& item, uuid_vec_t& selectedIDS); void doToSelectedGroup(const LLSD& userdata); bool checkContextMenuItem(const LLSD& userdata); bool enableContextMenuItem(const LLSD& userdata); |