summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llimfloater.cpp8
-rw-r--r--indra/newview/llimfloatercontainer.cpp48
-rw-r--r--indra/newview/llimfloatercontainer.h1
-rw-r--r--indra/newview/llnearbychat.cpp8
4 files changed, 34 insertions, 31 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 23c97c5345..22ce3cd42b 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -346,6 +346,10 @@ BOOL LLIMFloater::postBuild()
initIMFloater();
+ // Add a conversation list item in the left pane
+ LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
+ im_box->addConversationListItem(getTitle(), getKey(), this);
+
return TRUE;
}
@@ -641,10 +645,6 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
}
}
- // Add a conversation list item in the left pane: nothing will be done if already in there
- // but relevant clean up will be done to ensure consistency of the conversation list
- floater_container->addConversationListItem(floater->getTitle(), session_id, floater);
-
floater->openFloater(floater->getKey());
}
else
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 4f626cb5d2..005794444b 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -150,9 +150,6 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point);
LLUUID session_id = floaterp->getKey();
-
- // Add a conversation list item in the left pane
- addConversationListItem(floaterp->getTitle(), session_id, floaterp);
LLIconCtrl* icon = 0;
@@ -280,6 +277,8 @@ void LLIMFloaterContainer::draw()
collapseMessagesPane(true);
}
LLFloater::draw();
+
+ repositioningWidgets();
}
void LLIMFloaterContainer::tabClose()
@@ -306,7 +305,7 @@ void LLIMFloaterContainer::setVisible(BOOL visible)
LLFloaterReg::toggleInstanceOrBringToFront(name);
}
}
-
+
// We need to show/hide all the associated conversations that have been torn off
// (and therefore, are not longer managed by the multifloater),
// so that they show/hide with the conversations manager.
@@ -409,6 +408,23 @@ void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids)
}
}
+void LLIMFloaterContainer::repositioningWidgets()
+{
+ LLRect panel_rect = mConversationsListPanel->getRect();
+ S32 item_height = 16;
+ int index = 0;
+ for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
+ widget_it != mConversationsWidgets.end();
+ widget_it++, ++index)
+ {
+ LLFolderViewItem* widget = widget_it->second;
+ widget->setRect(LLRect(0,
+ panel_rect.getHeight() - item_height*index,
+ panel_rect.getWidth(),
+ panel_rect.getHeight() - item_height*(index+1)));
+ }
+}
+
// CHUI-137 : Temporary implementation of conversations list
void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp)
{
@@ -443,14 +459,11 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI
// Add it to the UI
widget->setVisible(TRUE);
+
+ repositioningWidgets();
+
mConversationsListPanel->addChild(widget);
- LLRect panel_rect = mConversationsListPanel->getRect();
- S32 item_height = 16;
- S32 index = mConversationsWidgets.size() - 1;
- widget->setRect(LLRect(0,
- panel_rect.getHeight() - item_height*index,
- panel_rect.getWidth(),
- panel_rect.getHeight() - item_height*(index+1)));
+
return;
}
@@ -470,18 +483,7 @@ void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool
mConversationsItems.erase(floaterp);
mConversationsWidgets.erase(floaterp);
- // Reposition the leftover conversation items
- LLRect panel_rect = mConversationsListPanel->getRect();
- S32 item_height = 16;
- int index = 0;
- for (widget_it = mConversationsWidgets.begin(); widget_it != mConversationsWidgets.end(); ++widget_it, ++index)
- {
- LLFolderViewItem* widget = widget_it->second;
- widget->setRect(LLRect(0,
- panel_rect.getHeight() - item_height*index,
- panel_rect.getWidth(),
- panel_rect.getHeight() - item_height*(index+1)));
- }
+ repositioningWidgets();
// Don't let the focus fall IW, select and refocus on the first conversation in the list
if (change_focus)
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index b624b7558a..a25ea0ab46 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -254,6 +254,7 @@ private:
void collapseConversationsPane(bool collapse);
void updateState(bool collapse, S32 delta_width);
+ void repositioningWidgets();
void onAddButtonClicked();
void onAvatarPicked(const uuid_vec_t& ids);
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 1c81cdc4bc..a21690bed8 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -158,7 +158,7 @@ BOOL LLNearbyChat::postBuild()
enableResizeCtrls(true, true, false);
- // title must be defined BEFORE call addToHost() because
+ // title must be defined BEFORE call addConversationListItem() because
// it is used for show the item's name in the conversations list
setTitle(getString("NearbyChatTitle"));
@@ -186,6 +186,9 @@ BOOL LLNearbyChat::postBuild()
loadHistory();
}
+ // added row in the conversations list when nearby chat is tear-off
+ LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
+ im_box->addConversationListItem(getTitle(), LLSD(), this);
return LLIMConversation::postBuild();
}
@@ -363,9 +366,6 @@ void LLNearbyChat::addToHost()
LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
if (im_box)
{
- // Make sure the Nearby Chat is present in the conversations list
- im_box->addConversationListItem(getTitle(), getKey(), this);
-
if (gSavedSettings.getBOOL("NearbyChatIsNotTornOff"))
{
im_box->addFloater(this, TRUE, LLTabContainer::END);