summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-06-18 18:12:38 -0700
committerMerov Linden <merov@lindenlab.com>2012-06-18 18:12:38 -0700
commit06f142e974854854c91988b6a8bc5c6005a40731 (patch)
treeb8afc27910b24457a6597c7f48b6a13028011f92
parent48bc7166fbb4c52769ecc583c4f198d757050408 (diff)
CHUI-145 : Select on list focus on relevant panel, torn off or not; torn off im stay in list; closed im suppressed from lits in all situations
-rw-r--r--indra/newview/llimfloater.cpp10
-rw-r--r--indra/newview/llimfloatercontainer.cpp117
-rw-r--r--indra/newview/llimfloatercontainer.h6
3 files changed, 81 insertions, 52 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 30a9c29ec6..14fcd602fc 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -139,6 +139,16 @@ void LLIMFloater::onClose(bool app_quitting)
// Last change:
// EXT-3516 X Button should end IM session, _ button should hide
gIMMgr->leaveSession(mSessionID);
+
+ // Suppress the IM from the conversations list
+ if (LLIMConversation::isChatMultiTab())
+ {
+ LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance();
+ if (im_box)
+ {
+ im_box->removeConversationListItem(mSessionID);
+ }
+ }
}
/* static */
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index e8eae331a1..bedf3315e8 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -129,24 +129,8 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
LLUUID session_id = floaterp->getKey();
- // CHUI-137 : Temporary implementation of conversations list
- // Create a conversation item
- LLConversationItem* item = new LLConversationItem(floaterp->getTitle(),session_id, floaterp, this);
- mConversationsItems[session_id] = item;
- // Create a widget from it
- LLFolderViewItem* widget = createConversationItemWidget(item);
- mConversationsWidgets[session_id] = widget;
- // Add it to the UI
- widget->setVisible(TRUE);
- 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)));
- // CHUI-137 : end
+ // Add a conversation list item in the left pane
+ addConversationListItem(floaterp->getTitle(), session_id, floaterp, this);
LLView* floater_contents = floaterp->getChild<LLView>("contents_view");
@@ -184,35 +168,6 @@ void LLIMFloaterContainer::removeFloater(LLFloater* floaterp)
{
LLMultiFloater::removeFloater(floaterp);
- // CHUI-137 : Temporary implementation of conversations list
- // Clean up the conversations list
- LLUUID session_id = floaterp->getKey();
- // Delete the widget and the associated conversation item
- // Note : since the mConversationsItems is also the listener to the widget, deleting
- // the widget will also delete its listener
- conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(session_id);
- if (widget_it != mConversationsWidgets.end())
- {
- LLFolderViewItem* widget = widget_it->second;
- delete widget;
- }
- // Suppress the conversation items and widgets from their respective maps
- mConversationsItems.erase(session_id);
- mConversationsWidgets.erase(session_id);
- // 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)));
- }
- // CHUI-137 : end
-
LLRect contents_rect = floaterp->getRect();
// reduce the floater contents height by header height
@@ -399,6 +354,60 @@ void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids)
}
// CHUI-137 : Temporary implementation of conversations list
+void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp)
+{
+ // Create a conversation item
+ LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, containerp);
+ mConversationsItems[uuid] = item;
+
+ // Create a widget from it
+ LLFolderViewItem* widget = createConversationItemWidget(item);
+ mConversationsWidgets[uuid] = widget;
+
+ // Add it to the UI
+ widget->setVisible(TRUE);
+ 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;
+}
+
+void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id)
+{
+ // Delete the widget and the associated conversation item
+ // Note : since the mConversationsItems is also the listener to the widget, deleting
+ // the widget will also delete its listener
+ conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(session_id);
+ if (widget_it != mConversationsWidgets.end())
+ {
+ LLFolderViewItem* widget = widget_it->second;
+ delete widget;
+ }
+
+ // Suppress the conversation items and widgets from their respective maps
+ mConversationsItems.erase(session_id);
+ mConversationsWidgets.erase(session_id);
+
+ // 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)));
+ }
+ return;
+}
+
LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item)
{
LLFolderViewItem::Params params;
@@ -431,10 +440,16 @@ LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLF
// Virtual action callbacks
void LLConversationItem::selectItem(void)
{
- // Always expand the message pane in that case
- mContainer->collapseMessagesPane(false);
- // Switch to the conversation floater that is being selected
- mContainer->selectFloater(mFloater);
+ LLMultiFloater* host_floater = mFloater->getHost();
+ if (host_floater == mContainer)
+ {
+ // Always expand the message pane if the panel is hosted by the container
+ mContainer->collapseMessagesPane(false);
+ // Switch to the conversation floater that is being selected
+ mContainer->selectFloater(mFloater);
+ }
+ // Set the focus on the selected floater
+ mFloater->setFocus(TRUE);
}
void LLConversationItem::performAction(LLInventoryModel* model, std::string action)
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index b5b60615b3..10268a5d79 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -142,7 +142,6 @@ public:
void collapseMessagesPane(bool collapse);
- LLFolderViewItem* createConversationItemWidget(LLConversationItem* item);
private:
typedef std::map<LLUUID,LLFloater*> avatarID_panel_map_t;
@@ -168,6 +167,11 @@ private:
LLLayoutStack* mConversationsStack;
// CHUI-137 : Temporary implementation of conversations list
+public:
+ void removeConversationListItem(const LLUUID& session_id);
+private:
+ void addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp);
+ LLFolderViewItem* createConversationItemWidget(LLConversationItem* item);
// Conversation list data
LLPanel* mConversationsListPanel; // This is the widget we add items to (i.e. clickable title for each conversation)
conversations_items_map mConversationsItems;