From a748466377982f376d4901e3450e6b927cf96a4d Mon Sep 17 00:00:00 2001
From: Richard Nelson <none@none>
Date: Mon, 20 Sep 2010 19:16:17 -0700
Subject: EXP-82 FIX MOTD open in external browser notification not given until
 fully logged in reviewed by Monroe

---
 indra/llui/llnotifications.cpp                |  6 ++++++
 indra/llui/llnotifications.h                  |  1 +
 indra/newview/llimhandler.cpp                 |  2 +-
 indra/newview/llnotificationalerthandler.cpp  |  2 +-
 indra/newview/llnotificationgrouphandler.cpp  |  2 +-
 indra/newview/llnotificationofferhandler.cpp  |  2 +-
 indra/newview/llnotificationscripthandler.cpp |  2 +-
 indra/newview/llnotificationtiphandler.cpp    |  6 +++---
 indra/newview/llprogressview.cpp              | 18 ++++++++++++++++++
 indra/newview/llprogressview.h                |  1 +
 10 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 2a7ca4c321..9d14c4149c 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -628,6 +628,12 @@ void LLNotification::respond(const LLSD& response)
 	update();
 }
 
+void LLNotification::respondWithDefault()
+{
+	respond(getResponseTemplate(WITH_DEFAULT_BUTTON));
+}
+
+
 const std::string& LLNotification::getName() const
 {
 	return mTemplatep->mName;
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index dcb7b48f92..4fe1687f0e 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -441,6 +441,7 @@ public:
 	LLSD asLLSD();
 
 	void respond(const LLSD& sd);
+	void respondWithDefault();
 
 	void* getResponder() { return mResponderObj; }
 
diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp
index bc76092a20..cd71da7393 100644
--- a/indra/newview/llimhandler.cpp
+++ b/indra/newview/llimhandler.cpp
@@ -115,7 +115,7 @@ bool LLIMHandler::processNotification(const LLSD& notify)
 	{
 		mChannel->killToastByNotificationID(notification->getID());
 	}
-	return true;
+	return false;
 }
 
 //--------------------------------------------------------------------------
diff --git a/indra/newview/llnotificationalerthandler.cpp b/indra/newview/llnotificationalerthandler.cpp
index dcbf6b64ce..9d824dcd59 100644
--- a/indra/newview/llnotificationalerthandler.cpp
+++ b/indra/newview/llnotificationalerthandler.cpp
@@ -133,7 +133,7 @@ bool LLAlertHandler::processNotification(const LLSD& notify)
 		if(channel)
 			channel->killToastByNotificationID(notification->getID());
 	}
-	return true;
+	return false;
 }
 
 //--------------------------------------------------------------------------
diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp
index 9933a8a49c..9b7fdaef82 100644
--- a/indra/newview/llnotificationgrouphandler.cpp
+++ b/indra/newview/llnotificationgrouphandler.cpp
@@ -104,7 +104,7 @@ bool LLGroupHandler::processNotification(const LLSD& notify)
 	{
 		mChannel->killToastByNotificationID(notification->getID());
 	}
-	return true;
+	return false;
 }
 
 //--------------------------------------------------------------------------
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index 85f95bd0c7..68fd65be0f 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -179,7 +179,7 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
 		}
 	}
 
-	return true;
+	return false;
 }
 
 //--------------------------------------------------------------------------
diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp
index b4d28bb346..45590c3cdb 100644
--- a/indra/newview/llnotificationscripthandler.cpp
+++ b/indra/newview/llnotificationscripthandler.cpp
@@ -130,7 +130,7 @@ bool LLScriptHandler::processNotification(const LLSD& notify)
 			mChannel->killToastByNotificationID(notification->getID());
 		}
 	}
-	return true;
+	return false;
 }
 
 //--------------------------------------------------------------------------
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index 94612975a2..02b217fc94 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -96,7 +96,7 @@ bool LLTipHandler::processNotification(const LLSD& notify)
 					LLNearbyChat>("nearby_chat", LLSD());
 			if (nearby_chat->getVisible())
 			{
-				return true;
+				return false;
 			}
 		}
 
@@ -121,7 +121,7 @@ bool LLTipHandler::processNotification(const LLSD& notify)
 		// don't spawn toast for inventory accepted/declined offers if respective IM window is open (EXT-5909)
 		if (!LLHandlerUtil::canSpawnToast(notification))
 		{
-			return true;
+			return false;
 		}
 
 		LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification);
@@ -144,7 +144,7 @@ bool LLTipHandler::processNotification(const LLSD& notify)
 	{
 		mChannel->killToastByNotificationID(notification->getID());
 	}
-	return true;
+	return false;
 }
 
 //--------------------------------------------------------------------------
diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp
index aeb0a35ae4..c6bd600403 100644
--- a/indra/newview/llprogressview.cpp
+++ b/indra/newview/llprogressview.cpp
@@ -41,6 +41,7 @@
 #include "llagent.h"
 #include "llbutton.h"
 #include "llfocusmgr.h"
+#include "llnotifications.h"
 #include "llprogressbar.h"
 #include "llstartup.h"
 #include "llviewercontrol.h"
@@ -90,6 +91,8 @@ BOOL LLProgressView::postBuild()
 	// hidden initially, until we need it
 	LLPanel::setVisible(FALSE);
 
+	LLNotifications::instance().getChannel("AlertModal")->connectChanged(boost::bind(&LLProgressView::onAlertModal, this, _1));
+
 	sInstance = this;
 	return TRUE;
 }
@@ -289,3 +292,18 @@ bool LLProgressView::handleUpdate(const LLSD& event_data)
 	}
 	return false;
 }
+
+bool LLProgressView::onAlertModal(const LLSD& notify)
+{
+	// if the progress view is visible, it will obscure the notification window
+	// in this case, we want to auto-accept WebLaunchExternalTarget notifications
+	if (isInVisibleChain())
+	{
+		LLNotificationPtr notifyp = LLNotifications::instance().find(notify["id"].asUUID());
+		if (notifyp && notifyp->getName() == "WebLaunchExternalTarget")
+		{
+			notifyp->respondWithDefault();
+		}
+	}
+	return false;
+}
diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h
index 01d5e16534..be1744f08a 100644
--- a/indra/newview/llprogressview.h
+++ b/indra/newview/llprogressview.h
@@ -59,6 +59,7 @@ public:
 
 	static void onCancelButtonClicked( void* );
 	static void onClickMessage(void*);
+	bool onAlertModal(const LLSD& sd);
 
 protected:
 	LLProgressBar* mProgressBar;
-- 
cgit v1.2.3