CHUI-654 : Fixed! Select the Nearby Chat directly when one conversation only left, don't finesse with a root UUID that might not be NULL

meow-7.2.2
Merov Linden 2013-01-03 14:37:24 -08:00
parent 799c1f241f
commit 0e6ff3e702
1 changed files with 12 additions and 7 deletions

View File

@ -1430,11 +1430,10 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c
{
is_widget_selected = widget->isSelected();
new_selection = mConversationsRoot->getNextFromChild(widget);
if(new_selection == NULL)
if (!new_selection)
{
new_selection = mConversationsRoot->getPreviousFromChild(widget);
}
widget->destroyView();
}
@ -1446,14 +1445,20 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c
if (change_focus)
{
setFocus(TRUE);
if(new_selection != NULL)
if (new_selection)
{
if (mConversationsWidgets.size() == 1)
new_selection = new_selection->getParentFolder();
LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(new_selection->getViewModelItem());
if(vmi != NULL)
{
selectConversationPair(vmi->getUUID(), true);
// If only one widget is left, it has to be the Nearby Chat. Select it directly.
selectConversationPair(LLUUID(NULL), true);
}
else
{
LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(new_selection->getViewModelItem());
if (vmi)
{
selectConversationPair(vmi->getUUID(), true);
}
}
}
}