summaryrefslogtreecommitdiff
path: root/indra/newview/llimhandler.cpp
diff options
context:
space:
mode:
authorMark Palange (Mani) <palange@lindenlab.com>2009-10-02 10:35:42 -0700
committerMark Palange (Mani) <palange@lindenlab.com>2009-10-02 10:35:42 -0700
commit4d53e235c2445b820bb0ae7303b269648dd86037 (patch)
treec1ab3643cf257099822e7a0e1e832d76813555f6 /indra/newview/llimhandler.cpp
parent80f27013b2d2a7ca6509db033c8f0c31562e04c7 (diff)
parentdde2153014cd7d7b8fa704f7067a41344bfbb1c2 (diff)
merge of latest viewer/viewer-20
Diffstat (limited to 'indra/newview/llimhandler.cpp')
-rw-r--r--indra/newview/llimhandler.cpp73
1 files changed, 37 insertions, 36 deletions
diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp
index a47477c446..74971f3fd8 100644
--- a/indra/newview/llimhandler.cpp
+++ b/indra/newview/llimhandler.cpp
@@ -36,29 +36,18 @@
#include "llnotificationhandler.h"
#include "llagentdata.h"
-#include "llbottomtray.h"
-#include "llviewercontrol.h"
#include "lltoastimpanel.h"
+#include "llviewerwindow.h"
using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
-LLIMHandler::LLIMHandler()
+LLIMHandler::LLIMHandler(e_notification_type type, const LLSD& id)
{
-
- // getting a Chiclet and creating params for a channel
- LLBottomTray* tray = LLBottomTray::getInstance();
- mChiclet = tray->getSysWell();
-
- LLChannelManager::Params p;
- // *TODO: createNotificationChannel method
- p.id = LLUUID(gSavedSettings.getString("NotificationChannelUUID"));
- p.channel_right_bound = tray->getRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
- p.channel_width = gSavedSettings.getS32("NotifyBoxWidth");
+ mType = type;
// Getting a Channel for our notifications
- mChannel = LLChannelManager::getInstance()->createChannel(p);
-
+ mChannel = LLChannelManager::getInstance()->createNotificationChannel();
}
//--------------------------------------------------------------------------
@@ -67,12 +56,31 @@ LLIMHandler::~LLIMHandler()
}
//--------------------------------------------------------------------------
-void LLIMHandler::processNotification(const LLSD& notify)
+void LLIMHandler::initChannel()
+{
+ S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
+ S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
+ mChannel->init(channel_right_bound - channel_width, channel_right_bound);
+}
+
+//--------------------------------------------------------------------------
+bool LLIMHandler::processNotification(const LLSD& notify)
{
+ if(!mChannel)
+ {
+ return false;
+ }
+
LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
if(!notification)
- return;
+ return false;
+
+ // arrange a channel on a screen
+ if(!mChannel->getVisible())
+ {
+ initChannel();
+ }
if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
{
@@ -95,40 +103,33 @@ void LLIMHandler::processNotification(const LLSD& notify)
LLToastIMPanel* im_box = new LLToastIMPanel(im_p);
LLToast::Params p;
- p.id = notification->getID();
+ p.notif_id = notification->getID();
+ p.session_id = im_p.session_id;
p.notification = notification;
p.panel = im_box;
p.can_be_stored = false;
- p.on_toast_destroy = boost::bind(&LLIMHandler::onToastDestroy, this, _1);
- mChannel->addToast(p);
-
+ p.on_delete_toast = boost::bind(&LLIMHandler::onDeleteToast, this, _1);
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+ if(channel)
+ channel->addToast(p);
- static_cast<LLNotificationChiclet*>(mChiclet)->updateUreadIMNotifications();
+ // send a signal to the counter manager;
+ mNewNotificationSignal();
}
else if (notify["sigtype"].asString() == "delete")
{
mChannel->killToastByNotificationID(notification->getID());
}
+ return true;
}
//--------------------------------------------------------------------------
-void LLIMHandler::onToastDestroy(LLToast* toast)
-{
- toast->closeFloater();
- static_cast<LLNotificationChiclet*>(mChiclet)->updateUreadIMNotifications();
-}
-
-//--------------------------------------------------------------------------
-void LLIMHandler::onChicletClick(void)
+void LLIMHandler::onDeleteToast(LLToast* toast)
{
+ // send a signal to the counter manager
+ mDelNotificationSignal();
}
//--------------------------------------------------------------------------
-void LLIMHandler::onChicletClose(void)
-{
-}
-
-//--------------------------------------------------------------------------
-