summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterimcontainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterimcontainer.cpp')
-rw-r--r--indra/newview/llfloaterimcontainer.cpp80
1 files changed, 45 insertions, 35 deletions
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 75b311eecf..3a5f2ae854 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -891,41 +891,46 @@ void LLFloaterIMContainer::getSelectedUUIDs(uuid_vec_t& selected_uuids)
const LLConversationItem * LLFloaterIMContainer::getCurSelectedViewModelItem()
{
- LLConversationItem * conversationItem = NULL;
+ LLConversationItem * conversation_item = NULL;
if(mConversationsRoot &&
mConversationsRoot->getCurSelectedItem() &&
mConversationsRoot->getCurSelectedItem()->getViewModelItem())
{
- LLFloaterIMSessionTab *selectedSession = LLFloaterIMSessionTab::getConversation(mSelectedSession);
- if (selectedSession && selectedSession->isTornOff())
+ LLFloaterIMSessionTab *selected_session_floater = LLFloaterIMSessionTab::getConversation(mSelectedSession);
+ if (selected_session_floater && !selected_session_floater->getHost())
{
- conversationItem = selectedSession->getCurSelectedViewModelItem();
+ conversation_item = selected_session_floater->getCurSelectedViewModelItem();
}
else
{
- conversationItem = static_cast<LLConversationItem *>(mConversationsRoot->getCurSelectedItem()->getViewModelItem());
+ conversation_item = static_cast<LLConversationItem *>(mConversationsRoot->getCurSelectedItem()->getViewModelItem());
}
}
- return conversationItem;
+ return conversation_item;
}
void LLFloaterIMContainer::getParticipantUUIDs(uuid_vec_t& selected_uuids)
{
//Find the conversation floater associated with the selected id
- const LLConversationItem * conversationItem = getCurSelectedViewModelItem();
+ const LLConversationItem * conversation_item = getCurSelectedViewModelItem();
+
+ if (NULL == conversation_item)
+ {
+ return;
+ }
- if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT)
+ if (conversation_item->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)
+ else if(conversation_item->getType() == LLConversationItem::CONV_SESSION_1_ON_1)
{
- LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(conversationItem->getUUID());
- LLUUID participantID = conversationFloater->getOtherParticipantUUID();
- selected_uuids.push_back(participantID);
+ LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(conversation_item->getUUID());
+ LLUUID participant_id = conversation_floaterp->getOtherParticipantUUID();
+ selected_uuids.push_back(participant_id);
}
}
@@ -1234,13 +1239,13 @@ void LLFloaterIMContainer::showConversation(const LLUUID& session_id)
void LLFloaterIMContainer::selectConversation(const LLUUID& session_id)
{
selectConversationPair(session_id, true);
- }
+}
// Synchronous select the conversation item and the conversation floater
BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool select_widget)
{
BOOL handled = TRUE;
- LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id);
+ LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(session_id);
/* widget processing */
if (select_widget)
@@ -1254,26 +1259,29 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool
/* floater processing */
- if (session_id != getSelectedSession())
- {
- // Store the active session
- setSelectedSession(session_id);
+ if (NULL != session_floater)
+ {
+ if (session_id != getSelectedSession())
+ {
+ // Store the active session
+ setSelectedSession(session_id);
- if (session_floater->getHost())
- {
- // Always expand the message pane if the panel is hosted by the container
- collapseMessagesPane(false);
- // Switch to the conversation floater that is being selected
- selectFloater(session_floater);
+ if (session_floater->getHost())
+ {
+ // Always expand the message pane if the panel is hosted by the container
+ collapseMessagesPane(false);
+ // Switch to the conversation floater that is being selected
+ selectFloater(session_floater);
+ }
}
- }
- // 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;
@@ -1383,12 +1391,14 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID&
// set the widget to minimized mode if conversations pane is collapsed
widget->toggleCollapsedMode(mConversationsPane->isCollapsed());
- if (isWidgetSelected)
- {
- selectConversation(uuid);
- // scroll to newly added item
- mConversationsRoot->scrollToShowSelection();
- }
+ if (isWidgetSelected || 0 == mConversationsRoot->getSelectedCount())
+ {
+ selectConversationPair(uuid, true);
+ widget->requestArrange();
+
+ // scroll to newly added item
+ mConversationsRoot->scrollToShowSelection();
+ }
return item;
}