From 9da625d439a9a911733564177e32facc3669dc58 Mon Sep 17 00:00:00 2001
From: William Todd Stinson <stinson@lindenlab.com>
Date: Thu, 6 Dec 2012 20:28:25 -0800
Subject: [PATCH] CHUI-494: WIP First pass at getting the suppression of events
 in DND working.

---
 indra/newview/llbrowsernotification.cpp       |   5 +
 indra/newview/llfloateroutbox.cpp             |  17 +-
 indra/newview/llimhandler.cpp                 |   2 +-
 indra/newview/llnotificationalerthandler.cpp  |  28 +++-
 indra/newview/llnotificationgrouphandler.cpp  |   2 +-
 indra/newview/llnotificationhandler.h         | 145 +++++++++++-------
 indra/newview/llnotificationhandlerutil.cpp   |  12 +-
 indra/newview/llnotificationhinthandler.cpp   |  27 +++-
 indra/newview/llnotificationofferhandler.cpp  |   2 +-
 indra/newview/llnotificationscripthandler.cpp |   2 +-
 indra/newview/llnotificationtiphandler.cpp    |   2 +-
 indra/newview/llviewerwindow.cpp              |  31 +---
 indra/newview/llviewerwindow.h                |   9 +-
 13 files changed, 184 insertions(+), 100 deletions(-)

diff --git a/indra/newview/llbrowsernotification.cpp b/indra/newview/llbrowsernotification.cpp
index 9e608d2c8b5..19747757dbc 100644
--- a/indra/newview/llbrowsernotification.cpp
+++ b/indra/newview/llbrowsernotification.cpp
@@ -35,6 +35,11 @@
 
 using namespace LLNotificationsUI;
 
+LLBrowserNotification::LLBrowserNotification()
+	: LLSystemNotificationHandler("Browser", "browser")
+{
+}
+
 bool LLBrowserNotification::processNotification(const LLNotificationPtr& notification)
 {
 	LLUUID media_id = notification->getPayload()["media_id"].asUUID();
diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp
index 18ed36d0f36..29a3e6ac3a0 100644
--- a/indra/newview/llfloateroutbox.cpp
+++ b/indra/newview/llfloateroutbox.cpp
@@ -49,6 +49,11 @@
 /// LLOutboxNotification class
 ///----------------------------------------------------------------------------
 
+LLNotificationsUI::LLOutboxNotification::LLOutboxNotification()
+	: LLSystemNotificationHandler("Outbox", "outbox")
+{
+}
+
 bool LLNotificationsUI::LLOutboxNotification::processNotification(const LLNotificationPtr& notify)
 {
 	LLFloaterOutbox* outbox_floater = LLFloaterReg::getTypedInstance<LLFloaterOutbox>("outbox");
@@ -60,10 +65,10 @@ bool LLNotificationsUI::LLOutboxNotification::processNotification(const LLNotifi
 
 void LLNotificationsUI::LLOutboxNotification::onDelete(LLNotificationPtr p)
 {
-	LLNotificationsUI::LLSysHandler * sys_handler = dynamic_cast<LLNotificationsUI::LLSysHandler*>(LLNotifications::instance().getChannel("AlertModal").get());
-	if (sys_handler)
+	LLNotificationsUI::LLNotificationHandler * notification_handler = dynamic_cast<LLNotificationsUI::LLNotificationHandler*>(LLNotifications::instance().getChannel("AlertModal").get());
+	if (notification_handler)
 	{
-		sys_handler->onDelete(p);
+		notification_handler->onDelete(p);
 	}
 }
 
@@ -524,9 +529,9 @@ void LLFloaterOutbox::initializationReportError(U32 status, const LLSD& content)
 
 void LLFloaterOutbox::showNotification(const LLNotificationPtr& notification)
 {
-	LLNotificationsUI::LLSysHandler * sys_handler = dynamic_cast<LLNotificationsUI::LLSysHandler*>(LLNotifications::instance().getChannel("AlertModal").get());
-	llassert(sys_handler);
+	LLNotificationsUI::LLNotificationHandler * notification_handler = dynamic_cast<LLNotificationsUI::LLNotificationHandler*>(LLNotifications::instance().getChannel("AlertModal").get());
+	llassert(notification_handler);
 	
-	sys_handler->processNotification(notification);
+	notification_handler->processNotification(notification);
 }
 
diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp
index 047472a282a..72967eb6c7d 100644
--- a/indra/newview/llimhandler.cpp
+++ b/indra/newview/llimhandler.cpp
@@ -38,7 +38,7 @@ using namespace LLNotificationsUI;
 
 //--------------------------------------------------------------------------
 LLIMHandler::LLIMHandler()
-:	LLSysHandler("IM Notifications", "notifytoast")
+:	LLCommunicationNotificationHandler("IM Notifications", "notifytoast")
 {
 	// Getting a Channel for our notifications
 	mChannel = LLChannelManager::getInstance()->createNotificationChannel()->getHandle();
diff --git a/indra/newview/llnotificationalerthandler.cpp b/indra/newview/llnotificationalerthandler.cpp
index 2bc9cdd3c1b..58a9b01a459 100644
--- a/indra/newview/llnotificationalerthandler.cpp
+++ b/indra/newview/llnotificationalerthandler.cpp
@@ -29,6 +29,7 @@
 
 #include "llnotificationhandler.h"
 
+#include "llagentcamera.h"
 #include "llnotifications.h"
 #include "llprogressview.h"
 #include "lltoastnotifypanel.h"
@@ -41,7 +42,7 @@ using namespace LLNotificationsUI;
 
 //--------------------------------------------------------------------------
 LLAlertHandler::LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal) 
-:	LLSysHandler(name, notification_type),
+:	LLSystemNotificationHandler(name, notification_type),
 	mIsModal(is_modal)
 {
 	LLScreenChannelBase::Params p;
@@ -123,3 +124,28 @@ void LLAlertHandler::onChange( LLNotificationPtr notification )
 	if(channel)
 		channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog);
 }
+
+//--------------------------------------------------------------------------
+LLViewerAlertHandler::LLViewerAlertHandler(const std::string& name, const std::string& notification_type)
+	: LLSystemNotificationHandler(name, notification_type)
+{
+}
+
+bool LLViewerAlertHandler::processNotification(const LLNotificationPtr& p)
+{
+	if (gHeadlessClient)
+	{
+		LL_INFOS("LLViewerAlertHandler") << "Alert: " << p->getName() << LL_ENDL;
+	}
+
+	// If we're in mouselook, the mouse is hidden and so the user can't click 
+	// the dialog buttons.  In that case, change to First Person instead.
+	if( gAgentCamera.cameraMouselook() )
+	{
+		gAgentCamera.changeCameraToDefault();
+	}
+
+	return false;
+}
+
+
diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp
index 18cd94e6855..8fef102cf88 100644
--- a/indra/newview/llnotificationgrouphandler.cpp
+++ b/indra/newview/llnotificationgrouphandler.cpp
@@ -38,7 +38,7 @@ using namespace LLNotificationsUI;
 
 //--------------------------------------------------------------------------
 LLGroupHandler::LLGroupHandler()
-:	LLSysHandler("Group Notifications", "groupnotify")
+:	LLCommunicationNotificationHandler("Group Notifications", "groupnotify")
 {
 	// Getting a Channel for our notifications
 	LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h
index 4bded6ab30e..98b0eecd0d8 100644
--- a/indra/newview/llnotificationhandler.h
+++ b/indra/newview/llnotificationhandler.h
@@ -27,6 +27,7 @@
 #ifndef LL_LLNOTIFICATIONHANDLER_H
 #define LL_LLNOTIFICATIONHANDLER_H
 
+#include <boost/intrusive_ptr.hpp>
 
 #include "llwindow.h"
 
@@ -86,23 +87,39 @@ class LLEventHandler
 /**
  * Handler for system notifications.
  */
-class LLSysHandler : public LLEventHandler, public LLNotificationChannel
+class LLNotificationHandler : public LLEventHandler, public LLNotificationChannel
 {
 public:
-	LLSysHandler(const std::string& name, const std::string& notification_type);
-	virtual ~LLSysHandler() {};
+	LLNotificationHandler(const std::string& name, const std::string& notification_type, const std::string& parentName);
+	virtual ~LLNotificationHandler() {};
 
 	// base interface functions
-	/*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); }
-	/*virtual*/ void onLoad(LLNotificationPtr p) { processNotification(p); }
-	/*virtual*/ void onDelete(LLNotificationPtr p) { if (mChannel.get()) mChannel.get()->removeToastByNotificationID(p->getID());}
+	virtual void onAdd(LLNotificationPtr p) { processNotification(p); }
+	virtual void onChange(LLNotificationPtr p) { processNotification(p); }
+	virtual void onLoad(LLNotificationPtr p) { processNotification(p); }
+	virtual void onDelete(LLNotificationPtr p) { if (mChannel.get()) mChannel.get()->removeToastByNotificationID(p->getID());}
 
-	virtual bool processNotification(const LLNotificationPtr& notify)=0;
+	virtual bool processNotification(const LLNotificationPtr& notify) = 0;
+};
+
+class LLSystemNotificationHandler : public LLNotificationHandler
+{
+public:
+	LLSystemNotificationHandler(const std::string& name, const std::string& notification_type);
+	virtual ~LLSystemNotificationHandler() {};
+};
+
+class LLCommunicationNotificationHandler : public LLNotificationHandler
+{
+public:
+	LLCommunicationNotificationHandler(const std::string& name, const std::string& notification_type);
+	virtual ~LLCommunicationNotificationHandler() {};
 };
 
 /**
- * Handler for chat message notifications.
+ * Handler for chat message notifications. 
  */
+// XXX stinson 12/06/2012 : can I just remove the LLChatHandler class?
 class LLChatHandler : public LLEventHandler
 {
 public:
@@ -115,67 +132,62 @@ class LLChatHandler : public LLEventHandler
  * Handler for IM notifications.
  * It manages life time of IMs, group messages.
  */
-class LLIMHandler : public LLSysHandler
+class LLIMHandler : public LLCommunicationNotificationHandler
 {
 public:
 	LLIMHandler();
 	virtual ~LLIMHandler();
+	bool processNotification(const LLNotificationPtr& p);
 
 protected:
-	bool processNotification(const LLNotificationPtr& p);
-	/*virtual*/ void initChannel();
+	virtual void initChannel();
 };
 
 /**
  * Handler for system informational notices.
  * It manages life time of tip notices.
  */
-class LLTipHandler : public LLSysHandler
+class LLTipHandler : public LLSystemNotificationHandler
 {
 public:
 	LLTipHandler();
 	virtual ~LLTipHandler();
 
-	// base interface functions
-	/*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); }
-	/*virtual*/ bool processNotification(const LLNotificationPtr& p);
+	virtual bool processNotification(const LLNotificationPtr& p);
 
 protected:
-	/*virtual*/ void initChannel();
+	virtual void initChannel();
 };
 
 /**
  * Handler for system informational notices.
  * It manages life time of script notices.
  */
-class LLScriptHandler : public LLSysHandler
+class LLScriptHandler : public LLSystemNotificationHandler
 {
 public:
 	LLScriptHandler();
 	virtual ~LLScriptHandler();
 
-	/*virtual*/ void onDelete(LLNotificationPtr p);
-	// base interface functions
-	/*virtual*/ bool processNotification(const LLNotificationPtr& p);
+	virtual void onDelete(LLNotificationPtr p);
+	virtual bool processNotification(const LLNotificationPtr& p);
 
 protected:
-	/*virtual*/ void onDeleteToast(LLToast* toast);
-	/*virtual*/ void initChannel();
+	virtual void onDeleteToast(LLToast* toast);
+	virtual void initChannel();
 };
 
 
 /**
  * Handler for group system notices.
  */
-class LLGroupHandler : public LLSysHandler
+class LLGroupHandler : public LLCommunicationNotificationHandler
 {
 public:
 	LLGroupHandler();
 	virtual ~LLGroupHandler();
 	
-	// base interface functions
-	/*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); }
-	/*virtual*/ bool processNotification(const LLNotificationPtr& p);
+	virtual bool processNotification(const LLNotificationPtr& p);
 
 protected:
 	virtual void initChannel();
@@ -184,15 +196,14 @@ class LLGroupHandler : public LLSysHandler
 /**
  * Handler for alert system notices.
  */
-class LLAlertHandler : public LLSysHandler
+class LLAlertHandler : public LLSystemNotificationHandler
 {
 public:
 	LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal);
 	virtual ~LLAlertHandler();
 
-	/*virtual*/ void onChange(LLNotificationPtr p);
-	/*virtual*/ void onLoad(LLNotificationPtr p) { processNotification(p); }
-	/*virtual*/ bool processNotification(const LLNotificationPtr& p);
+	virtual void onChange(LLNotificationPtr p);
+	virtual bool processNotification(const LLNotificationPtr& p);
 
 protected:
 	virtual void initChannel();
@@ -200,67 +211,87 @@ class LLAlertHandler : public LLSysHandler
 	bool	mIsModal;
 };
 
+class LLViewerAlertHandler  : public LLSystemNotificationHandler
+{
+	LOG_CLASS(LLViewerAlertHandler);
+public:
+	LLViewerAlertHandler(const std::string& name, const std::string& notification_type);
+	virtual ~LLViewerAlertHandler() {};
+
+	virtual void onDelete(LLNotificationPtr p) {};
+	virtual bool processNotification(const LLNotificationPtr& p);
+
+protected:
+	virtual void initChannel() {};
+};
+
+typedef boost::intrusive_ptr<LLViewerAlertHandler> LLViewerAlertHandlerPtr;
+
 /**
  * Handler for offers notices.
  * It manages life time of offer notices.
  */
-class LLOfferHandler : public LLSysHandler
+class LLOfferHandler : public LLCommunicationNotificationHandler
 {
 public:
 	LLOfferHandler();
 	virtual ~LLOfferHandler();
 
-	// base interface functions
-	/*virtual*/ void onChange(LLNotificationPtr p);
-	/*virtual*/ void onDelete(LLNotificationPtr notification);
-	/*virtual*/ bool processNotification(const LLNotificationPtr& p);
+	virtual void onChange(LLNotificationPtr p);
+	virtual void onDelete(LLNotificationPtr notification);
+	virtual bool processNotification(const LLNotificationPtr& p);
 
 protected:
-	/*virtual*/ void initChannel();
+	virtual void initChannel();
 };
 
 /**
  * Handler for UI hints.
  */
-class LLHintHandler : public LLNotificationChannel
+class LLHintHandler : public LLSystemNotificationHandler
 {
 public:
-	LLHintHandler() : LLNotificationChannel("Hints", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "hint"))
-	{}
+	LLHintHandler();
 	virtual ~LLHintHandler() {}
 
-	/*virtual*/ void onAdd(LLNotificationPtr p);
-	/*virtual*/ void onLoad(LLNotificationPtr p);
-	/*virtual*/ void onDelete(LLNotificationPtr p);
+	virtual void onAdd(LLNotificationPtr p);
+	virtual void onLoad(LLNotificationPtr p);
+	virtual void onDelete(LLNotificationPtr p);
+	virtual bool processNotification(const LLNotificationPtr& p);
+
+protected:
+	virtual void initChannel() {};
 };
 
 /**
  * Handler for browser notifications
  */
-class LLBrowserNotification : public LLNotificationChannel
+class LLBrowserNotification : public LLSystemNotificationHandler
 {
 public:
-	LLBrowserNotification()
-	: LLNotificationChannel("Browser", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "browser"))
-	{}
-	/*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); }
-	/*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); }
-	bool processNotification(const LLNotificationPtr& p);
+	LLBrowserNotification();
+	virtual ~LLBrowserNotification() {}
+
+	virtual bool processNotification(const LLNotificationPtr& p);
+
+protected:
+	virtual void initChannel() {};
 };
 	
 /**
  * Handler for outbox notifications
  */
-class LLOutboxNotification : public LLNotificationChannel
+class LLOutboxNotification : public LLSystemNotificationHandler
 {
 public:
-	LLOutboxNotification()
-	:	LLNotificationChannel("Outbox", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "outbox"))
-	{}
-	/*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); }
-	/*virtual*/ void onChange(LLNotificationPtr p) { }
-	/*virtual*/ void onDelete(LLNotificationPtr p);
-	bool processNotification(const LLNotificationPtr& p);
+	LLOutboxNotification();
+	virtual ~LLOutboxNotification() {};
+	virtual void onChange(LLNotificationPtr p) { }
+	virtual void onDelete(LLNotificationPtr p);
+	virtual bool processNotification(const LLNotificationPtr& p);
+
+protected:
+	virtual void initChannel() {};
 };
 	
 class LLHandlerUtil
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index 7f1216ff407..f0175d677c6 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -41,8 +41,16 @@
 
 using namespace LLNotificationsUI;
 
-LLSysHandler::LLSysHandler(const std::string& name, const std::string& notification_type)
-:	LLNotificationChannel(name, "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, notification_type))
+LLNotificationHandler::LLNotificationHandler(const std::string& name, const std::string& notification_type, const std::string& parentName)
+:	LLNotificationChannel(name, parentName, LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, notification_type))
+{}
+
+LLSystemNotificationHandler::LLSystemNotificationHandler(const std::string& name, const std::string& notification_type)
+	: LLNotificationHandler(name, notification_type, "System")
+{}
+
+LLCommunicationNotificationHandler::LLCommunicationNotificationHandler(const std::string& name, const std::string& notification_type)
+	: LLNotificationHandler(name, notification_type, "Communication")
 {}
 
 // static
diff --git a/indra/newview/llnotificationhinthandler.cpp b/indra/newview/llnotificationhinthandler.cpp
index 271f4185076..f40369a2e06 100644
--- a/indra/newview/llnotificationhinthandler.cpp
+++ b/indra/newview/llnotificationhinthandler.cpp
@@ -33,6 +33,27 @@
 
 using namespace LLNotificationsUI;
 
-void LLHintHandler::onAdd(LLNotificationPtr p) { LLHints::show(p); }
-void LLHintHandler::onLoad(LLNotificationPtr p) { LLHints::show(p); }
-void LLHintHandler::onDelete(LLNotificationPtr p) { LLHints::hide(p); }
+LLHintHandler::LLHintHandler()
+	: LLSystemNotificationHandler("Hints", "hint")
+{
+}
+
+void LLHintHandler::onAdd(LLNotificationPtr p)
+{
+	LLHints::show(p);
+}
+
+void LLHintHandler::onLoad(LLNotificationPtr p)
+{
+	LLHints::show(p);
+}
+
+void LLHintHandler::onDelete(LLNotificationPtr p)
+{
+	LLHints::hide(p);
+}
+
+bool LLHintHandler::processNotification(const LLNotificationPtr& p)
+{
+	return false;
+}
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index ff5b5e21f70..da38c9063be 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -41,7 +41,7 @@ using namespace LLNotificationsUI;
 
 //--------------------------------------------------------------------------
 LLOfferHandler::LLOfferHandler()
-:	LLSysHandler("Offer", "offer")
+:	LLCommunicationNotificationHandler("Offer", "offer")
 {
 	// Getting a Channel for our notifications
 	LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp
index 290a81f91cd..e2d4e9f8ce5 100644
--- a/indra/newview/llnotificationscripthandler.cpp
+++ b/indra/newview/llnotificationscripthandler.cpp
@@ -39,7 +39,7 @@ using namespace LLNotificationsUI;
 
 //--------------------------------------------------------------------------
 LLScriptHandler::LLScriptHandler()
-:	LLSysHandler("Notifications", "notify")
+:	LLSystemNotificationHandler("Notifications", "notify")
 {
 	// Getting a Channel for our notifications
 	LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index faa67b5ea43..a85335f1ba9 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -42,7 +42,7 @@ using namespace LLNotificationsUI;
 
 //--------------------------------------------------------------------------
 LLTipHandler::LLTipHandler()
-:	LLSysHandler("NotificationTips", "notifytip")
+:	LLSystemNotificationHandler("NotificationTips", "notifytip")
 {
 	// Getting a Channel for our notifications
 	LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 1b45e6f85da..7b1cf6e1801 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -39,6 +39,7 @@
 #include "llagentcamera.h"
 #include "llfloaterreg.h"
 #include "llmeshrepository.h"
+#include "llnotificationhandler.h"
 #include "llpanellogin.h"
 #include "llviewerkeyboard.h"
 #include "llviewermenu.h"
@@ -127,6 +128,7 @@
 #include "llmorphview.h"
 #include "llmoveview.h"
 #include "llnavigationbar.h"
+#include "llnotificationhandler.h"
 #include "llpanelpathfindingrebakenavmesh.h"
 #include "llpaneltopinfobar.h"
 #include "llpopupview.h"
@@ -1554,11 +1556,13 @@ LLViewerWindow::LLViewerWindow(const Params& p)
 	mWindowListener.reset(new LLWindowListener(this, boost::lambda::var(gKeyboard)));
 	mViewerWindowListener.reset(new LLViewerWindowListener(this));
 
-	mAlertsChannel.reset(new LLNotificationChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert")));
-	mModalAlertsChannel.reset(new LLNotificationChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alertmodal")));
+	mSystemChannel.reset(new LLNotificationChannel("System", "Visible", LLNotificationFilters::includeEverything));
+	mCommunicationChannel.reset(new LLNotificationChannel("Communication", "Visible", boost::bind(&LLAgent::isDoNotDisturb, &gAgent)));
+	mAlertsChannel.reset(new LLNotificationsUI::LLViewerAlertHandler("VW_alerts", "alert"));
+	mModalAlertsChannel.reset(new LLNotificationsUI::LLViewerAlertHandler("VW_alertmodal", "alertmodal"));
 
-	mAlertsChannel->connectChanged(&LLViewerWindow::onAlert);
-	mModalAlertsChannel->connectChanged(&LLViewerWindow::onAlert);
+	//mAlertsChannel->connectChanged(&LLViewerWindow::onAlert);
+	//mModalAlertsChannel->connectChanged(&LLViewerWindow::onAlert);
 	bool ignore = gSavedSettings.getBOOL("IgnoreAllNotifications");
 	LLNotifications::instance().setIgnoreAllNotifications(ignore);
 	if (ignore)
@@ -5001,25 +5005,6 @@ LLRect LLViewerWindow::getChatConsoleRect()
 //----------------------------------------------------------------------------
 
 
-//static 
-bool LLViewerWindow::onAlert(const LLSD& notify)
-{
-	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
-
-	if (gHeadlessClient)
-	{
-		llinfos << "Alert: " << notification->getName() << llendl;
-	}
-
-	// If we're in mouselook, the mouse is hidden and so the user can't click 
-	// the dialog buttons.  In that case, change to First Person instead.
-	if( gAgentCamera.cameraMouselook() )
-	{
-		gAgentCamera.changeCameraToDefault();
-	}
-	return false;
-}
-
 void LLViewerWindow::setUIVisibility(bool visible)
 {
 	mUIVisible = visible;
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index ee6a7793f8e..b828a05384d 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -43,6 +43,8 @@
 #include "lltimer.h"
 #include "llstat.h"
 #include "llmousehandler.h"
+#include "llnotifications.h"
+#include "llnotificationhandler.h"
 #include "llhandle.h"
 #include "llinitparam.h"
 
@@ -401,7 +403,6 @@ class LLViewerWindow : public LLWindowCallbacks
 
 private:
 	bool                    shouldShowToolTipFor(LLMouseHandler *mh);
-	static bool onAlert(const LLSD& notify);
 
 	void			switchToolByMask(MASK mask);
 	void			destroyWindow();
@@ -418,8 +419,10 @@ class LLViewerWindow : public LLWindowCallbacks
 	bool			mActive;
 	bool			mUIVisible;
 
-	boost::shared_ptr<class LLNotificationChannel>	mAlertsChannel,
-													mModalAlertsChannel;
+	LLNotificationChannelPtr                    mSystemChannel;
+	LLNotificationChannelPtr                    mCommunicationChannel;
+	LLNotificationsUI::LLViewerAlertHandlerPtr  mAlertsChannel;
+	LLNotificationsUI::LLViewerAlertHandlerPtr  mModalAlertsChannel;
 
 	LLRect			mWindowRectRaw;				// whole window, including UI
 	LLRect			mWindowRectScaled;			// whole window, scaled by UI size
-- 
GitLab