diff options
Diffstat (limited to 'indra/newview/llsyswellwindow.cpp')
-rw-r--r-- | indra/newview/llsyswellwindow.cpp | 112 |
1 files changed, 100 insertions, 12 deletions
diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 3769ddb1cc..8c6ea59407 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -48,6 +48,8 @@ #include "llchiclet.h" #include "lltoastpanel.h" #include "llnotificationmanager.h" +#include "llnotificationsutil.h" +#include "llspeakers.h" //--------------------------------------------------------------------------------- LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLDockableFloater(NULL, key), @@ -350,6 +352,9 @@ LLIMWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID& } // Initialize chiclet. + mChiclet->setRect(LLRect(5, 28, 30, 3)); // *HACK: workaround for (EXT-3599) + mChiclet->setChicletSizeChangedCallback(boost::bind(&LLIMWellWindow::RowPanel::onChicletSizeChanged, this, mChiclet, _2)); + mChiclet->enableCounterControl(true); mChiclet->setCounter(chicletCounter); mChiclet->setSessionId(sessionId); mChiclet->setIMSessionName(name); @@ -364,6 +369,16 @@ LLIMWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID& } //--------------------------------------------------------------------------------- +void LLIMWellWindow::RowPanel::onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param) +{ + LLTextBox* text = getChild<LLTextBox>("contact_name"); + S32 new_text_left = mChiclet->getRect().mRight + CHICLET_HPAD; + LLRect text_rect = text->getRect(); + text_rect.mLeft = new_text_left; + text->setRect(text_rect); +} + +//--------------------------------------------------------------------------------- LLIMWellWindow::RowPanel::~RowPanel() { } @@ -610,6 +625,23 @@ void LLNotificationWellWindow::addItem(LLSysWellItem::Params p) } } +void LLNotificationWellWindow::closeAll() +{ + // Need to clear notification channel, to add storable toasts into the list. + clearScreenChannels(); + std::vector<LLPanel*> items; + mMessageList->getItems(items); + for (std::vector<LLPanel*>::iterator + iter = items.begin(), + iter_end = items.end(); + iter != iter_end; ++iter) + { + LLSysWellItem* sys_well_item = dynamic_cast<LLSysWellItem*>(*iter); + if (sys_well_item) + onItemClose(sys_well_item); + } +} + ////////////////////////////////////////////////////////////////////////// // PRIVATE METHODS void LLNotificationWellWindow::initChannel() @@ -713,9 +745,6 @@ void LLIMWellWindow::sessionAdded(const LLUUID& session_id, { if (mMessageList->getItemByValue(session_id)) return; - // For im sessions started as voice call chiclet gets created on the first incoming message - if (gIMMgr->isVoiceCall(session_id)) return; - if (!gIMMgr->hasSession(session_id)) return; addIMRow(session_id, 0, name, other_participant_id); @@ -874,21 +903,80 @@ bool LLIMWellWindow::hasIMRow(const LLUUID& session_id) return mMessageList->getItemByValue(session_id); } -void LLIMWellWindow::onNewIM(const LLSD& data) +void LLIMWellWindow::closeAll() { - LLUUID from_id = data["from_id"]; - if (from_id.isNull() || gAgentID == from_id) return; + // Generate an ignorable alert dialog if there is an active voice IM sesion + bool need_confirmation = false; + const LLIMModel& im_model = LLIMModel::instance(); + std::vector<LLSD> values; + mMessageList->getValues(values); + for (std::vector<LLSD>::iterator + iter = values.begin(), + iter_end = values.end(); + iter != iter_end; ++iter) + { + LLIMSpeakerMgr* speaker_mgr = im_model.getSpeakerManager(*iter); + if (speaker_mgr && speaker_mgr->isVoiceActive()) + { + need_confirmation = true; + break; + } + } + if ( need_confirmation ) + { + //Bring up a confirmation dialog + LLNotificationsUtil::add + ("ConfirmCloseAll", LLSD(), LLSD(), + boost::bind(&LLIMWellWindow::confirmCloseAll, this, _1, _2)); + } + else + { + closeAllImpl(); + } +} - LLUUID session_id = data["session_id"]; - if (session_id.isNull()) return; +void LLIMWellWindow::closeAllImpl() +{ + std::vector<LLSD> values; + mMessageList->getValues(values); - if (!gIMMgr->isVoiceCall(session_id)) return; + for (std::vector<LLSD>::iterator + iter = values.begin(), + iter_end = values.end(); + iter != iter_end; ++iter) + { + LLPanel* panel = mMessageList->getItemByValue(*iter); - if (hasIMRow(session_id)) return; + RowPanel* im_panel = dynamic_cast <RowPanel*> (panel); + if (im_panel) + { + gIMMgr->leaveSession(*iter); + continue; + } - //first real message, time to create chiclet - addIMRow(session_id); + ObjectRowPanel* obj_panel = dynamic_cast <ObjectRowPanel*> (panel); + if (obj_panel) + { + LLScriptFloaterManager::instance() + .removeNotificationByObjectId(*iter); + } + } } +bool LLIMWellWindow::confirmCloseAll(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + switch(option) + { + case 0: + { + closeAllImpl(); + return true; + } + default: + break; + } + return false; +} // EOF |