summaryrefslogtreecommitdiff
path: root/indra/newview/llsyswellwindow.cpp
diff options
context:
space:
mode:
authorEugene Mutavchi <emutavchi@productengine.com>2009-12-18 18:41:14 +0200
committerEugene Mutavchi <emutavchi@productengine.com>2009-12-18 18:41:14 +0200
commit216726dd23ef925f5bd6cccbdeb09cfca5400a7a (patch)
tree030b774f82193719f5358b254d7496795974f35e /indra/newview/llsyswellwindow.cpp
parent8083feada1b4dc047e4da995c1a6c695d99d3fc0 (diff)
Implemented major sub-task EXT-3524 (Context menu for IM well)
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llsyswellwindow.cpp')
-rw-r--r--indra/newview/llsyswellwindow.cpp78
1 files changed, 78 insertions, 0 deletions
diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp
index 1aeafaea5a..26f9824f9c 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),
@@ -920,4 +922,80 @@ void LLIMWellWindow::onNewIM(const LLSD& data)
}
+void LLIMWellWindow::closeAll()
+{
+ // 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();
+ }
+}
+
+void LLIMWellWindow::closeAllImpl()
+{
+ std::vector<LLSD> values;
+ mMessageList->getValues(values);
+
+ for (std::vector<LLSD>::iterator
+ iter = values.begin(),
+ iter_end = values.end();
+ iter != iter_end; ++iter)
+ {
+ LLPanel* panel = mMessageList->getItemByValue(*iter);
+
+ RowPanel* im_panel = dynamic_cast <RowPanel*> (panel);
+ if (im_panel)
+ {
+ gIMMgr->leaveSession(*iter);
+ continue;
+ }
+
+ 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