summaryrefslogtreecommitdiff
path: root/indra/newview/llimfloater.cpp
diff options
context:
space:
mode:
authorAlexanderP ProductEngine <apaschenko@productengine.com>2012-08-15 20:10:00 +0300
committerAlexanderP ProductEngine <apaschenko@productengine.com>2012-08-15 20:10:00 +0300
commit3a21eb59f1cf0b7672e2beb671e1dbc717e28b3f (patch)
treecba0242f33dad84ff8775c538b90e2eac9a357b7 /indra/newview/llimfloater.cpp
parentc234ef4b3a1ab22132512958c324e5f796912144 (diff)
CHUI-286 (Conversations floater opened by default when a new IM session is started (no IM toast shown): now floater silently adds itself to the container
Diffstat (limited to 'indra/newview/llimfloater.cpp')
-rw-r--r--indra/newview/llimfloater.cpp91
1 files changed, 45 insertions, 46 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 6a1437f318..cdd5ba6889 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -128,7 +128,7 @@ void LLIMFloater::onClickCloseBtn()
if (session == NULL)
{
- llwarns << "Empty session." << llendl;
+ llwarns << "Empty session with id: " << (mSessionID.asString()) << llendl;
return;
}
@@ -250,7 +250,7 @@ void LLIMFloater::initIMSession(const LLUUID& session_id)
mSession = LLIMModel::getInstance()->findIMSession(mSessionID);
if (mSession)
-{
+ {
mIsP2PChat = mSession->isP2PSessionType();
mSessionInitialized = mSession->mSessionInitialized;
@@ -593,38 +593,19 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl)
}
//static
-LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
+LLIMFloater* LLIMFloater::addToIMContainer(const LLUUID& session_id)
{
- closeHiddenIMToasts();
-
if (!gIMMgr->hasSession(session_id))
return NULL;
- if(!isChatMultiTab())
- {
- //hide all
- LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel");
- for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin();
- iter != inst_list.end(); ++iter)
- {
- LLIMFloater* floater = dynamic_cast<LLIMFloater*>(*iter);
- if (floater && floater->isDocked())
- {
- floater->setVisible(false);
- }
- }
- }
-
// Test the existence of the floater before we try to create it
bool exist = findInstance(session_id);
// Get the floater: this will create the instance if it didn't exist
LLIMFloater* floater = getInstance(session_id);
- if (!floater)
- return NULL;
-
- if(isChatMultiTab())
+ if (floater)
{
+
LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
// Do not add again existing floaters
@@ -639,33 +620,51 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
}
}
- floater->openFloater(floater->getKey());
+ if (floater_container && floater_container->getVisible())
+ {
+ floater->openFloater(floater->getKey());
+ floater->setVisible(TRUE);
+ }
+ else
+ {
+ floater->setVisible(FALSE);
+ }
}
- else
- {
- // Docking may move chat window, hide it before moving, or user will see how window "jumps"
- floater->setVisible(false);
+ return floater;
+}
- if (floater->getDockControl() == NULL)
- {
- LLChiclet* chiclet =
- LLChicletBar::getInstance()->getChicletPanel()->findChiclet<LLChiclet>(
- session_id);
- if (chiclet == NULL)
- {
- llerror("Dock chiclet for LLIMFloater doesn't exists", 0);
- }
- else
- {
- LLChicletBar::getInstance()->getChicletPanel()->scrollToChiclet(chiclet);
- }
+//static
+LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
+{
+ closeHiddenIMToasts();
- floater->setDockControl(new LLDockControl(chiclet, floater, floater->getDockTongue(),
- LLDockControl::BOTTOM));
- }
+ if (!gIMMgr->hasSession(session_id))
+ return NULL;
- // window is positioned, now we can show it.
+ // Test the existence of the floater before we try to create it
+ bool exist = findInstance(session_id);
+
+ // Get the floater: this will create the instance if it didn't exist
+ LLIMFloater* floater = getInstance(session_id);
+ if (!floater)
+ return NULL;
+
+ LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
+
+ // Do not add again existing floaters
+ if (!exist)
+ {
+ // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END;
+ // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists
+ LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END;
+ if (floater_container)
+ {
+ floater_container->addFloater(floater, TRUE, i_pt);
+ }
}
+
+ floater->openFloater(floater->getKey());
+
floater->setVisible(TRUE);
return floater;