summaryrefslogtreecommitdiff
path: root/indra/newview/llnotificationtiphandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnotificationtiphandler.cpp')
-rw-r--r--indra/newview/llnotificationtiphandler.cpp62
1 files changed, 61 insertions, 1 deletions
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index 83a2215ac6..4e2c5085ed 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -40,9 +40,41 @@
#include "lltoastnotifypanel.h"
#include "llviewercontrol.h"
#include "llviewerwindow.h"
+#include "llnotificationmanager.h"
using namespace LLNotificationsUI;
+class LLOnlineStatusToast : public LLToastPanel
+{
+public:
+
+ struct Params
+ {
+ LLNotificationPtr notification;
+ LLUUID avatar_id;
+ std::string message;
+
+ Params() {}
+ };
+
+ LLOnlineStatusToast(Params& p) : LLToastPanel(p.notification)
+ {
+ LLUICtrlFactory::getInstance()->buildPanel(this, "panel_online_status_toast.xml");
+
+ childSetValue("avatar_icon", p.avatar_id);
+ childSetValue("message", p.message);
+
+ if (p.notification->getPayload().has("respond_on_mousedown")
+ && p.notification->getPayload()["respond_on_mousedown"] )
+ {
+ setMouseDownCallback(boost::bind(&LLNotification::respond, p.notification,
+ p.notification->getResponseTemplate()));
+ }
+
+ // set line max count to 2 in case of a very long name
+ snapToMessageHeight(getChild<LLTextBox>("message"), 2);
+ }
+};
//--------------------------------------------------------------------------
LLTipHandler::LLTipHandler(e_notification_type type, const LLSD& id)
@@ -51,6 +83,10 @@ LLTipHandler::LLTipHandler(e_notification_type type, const LLSD& id)
// Getting a Channel for our notifications
mChannel = LLChannelManager::getInstance()->createNotificationChannel();
+
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+ if(channel)
+ channel->setOnRejectToastCallback(boost::bind(&LLTipHandler::onRejectToast, this, _1));
}
//--------------------------------------------------------------------------
@@ -114,7 +150,19 @@ bool LLTipHandler::processNotification(const LLSD& notify)
LLHandlerUtil::spawnIMSession(name, from_id);
}
- LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification);
+ LLToastPanel* notify_box = NULL;
+ if("FriendOffline" == notification->getName() || "FriendOnline" == notification->getName())
+ {
+ LLOnlineStatusToast::Params p;
+ p.notification = notification;
+ p.message = notification->getMessage();
+ p.avatar_id = notification->getPayload()["FROM_ID"];
+ notify_box = new LLOnlineStatusToast(p);
+ }
+ else
+ {
+ notify_box = new LLToastNotifyPanel(notification);
+ }
LLToast::Params p;
p.notif_id = notification->getID();
@@ -124,6 +172,8 @@ bool LLTipHandler::processNotification(const LLSD& notify)
p.is_tip = true;
p.can_be_stored = false;
+ removeExclusiveNotifications(notification);
+
LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
if(channel)
channel->addToast(p);
@@ -142,4 +192,14 @@ void LLTipHandler::onDeleteToast(LLToast* toast)
//--------------------------------------------------------------------------
+void LLTipHandler::onRejectToast(const LLUUID& id)
+{
+ LLNotificationPtr notification = LLNotifications::instance().find(id);
+ if (notification
+ && LLNotificationManager::getInstance()->getHandlerForNotification(
+ notification->getType()) == this)
+ {
+ LLNotifications::instance().cancel(notification);
+ }
+}