From 920d54297fc13a7a975ff4372f0c1559cf9cf199 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Thu, 25 Mar 2010 17:09:20 +0200 Subject: =?UTF-8?q?fixed=20major=20EXT-6500=20=E2=80=9CMessage=20Well=20co?= =?UTF-8?q?unter=20changes=20to=20'-1'=20after=20plain=20text=20chat=20was?= =?UTF-8?q?=20enabled=20while=20unresolved=20offer=20was=20in=20hided=20IM?= =?UTF-8?q?=20window=E2=80=9D,=20Added=20check=20to=20LLToastNotifyPanel?= =?UTF-8?q?=20destructor=20whether=20we=20should=20close=20notification=20?= =?UTF-8?q?since=20notification=20will=20be=20reused=20by=20IM=20floater?= =?UTF-8?q?=20when=20reload=20messages,=20the=20rule=20is:=20if=20LLToastN?= =?UTF-8?q?otifyPanel=20destroying=20but=20IM=20floater=20is=20exists=20?= =?UTF-8?q?=E2=80=93=20we=20shouldn't=20close=20notification.=20The=20prob?= =?UTF-8?q?lem=20is=20that=20notification=20was=20incorrectly=20deleted=20?= =?UTF-8?q?when=20IM=20floater=20reloads=20messages=20on=20chat=20log=20fr?= =?UTF-8?q?omat=20change=20event.=20reviewed=20by=20Vadim=20Savchuk=20at?= =?UTF-8?q?=20https://codereview.productengine.com/secondlife/r/80/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/llchathistory.cpp | 2 +- indra/newview/lltoastnotifypanel.cpp | 19 +++++++++++++++++-- indra/newview/lltoastnotifypanel.h | 7 ++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index efdfbb8d20..858ea334d1 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -751,7 +751,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if (notification != NULL) { LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel( - notification); + notification, chat.mSessionID); //we can't set follows in xml since it broke toasts behavior notify_box->setFollowsLeft(); notify_box->setFollowsRight(); diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 907740a88e..c9d2d404c0 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -45,6 +45,7 @@ #include "lltrans.h" #include "llnotificationsutil.h" #include "llviewermessage.h" +#include "llimfloater.h" const S32 BOTTOM_PAD = VPAD * 3; const S32 IGNORE_BTN_TOP_DELTA = 3*VPAD;//additional ignore_btn padding @@ -531,12 +532,26 @@ void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification ////////////////////////////////////////////////////////////////////////// -LLIMToastNotifyPanel::LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect /* = LLRect::null */) - : LLToastNotifyPanel(pNotification, rect) +LLIMToastNotifyPanel::LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLUUID& session_id, const LLRect& rect /* = LLRect::null */) + : mSessionID(session_id), LLToastNotifyPanel(pNotification, rect) { mTextBox->setFollowsAll(); } +LLIMToastNotifyPanel::~LLIMToastNotifyPanel() +{ + // We shouldn't delete notification when IM floater exists + // since that notification will be reused by IM floater. + // This may happened when IM floater reloads messages, exactly when user + // changes layout of IM chat log(disable/enable plaintext mode). + // See EXT-6500 + LLIMFloater* im_floater = LLIMFloater::findInstance(mSessionID); + if (im_floater != NULL && !im_floater->isDead()) + { + mCloseNotificationOnDestroy = false; + } +} + void LLIMToastNotifyPanel::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) { S32 text_height = mTextBox->getTextBoundingRect().getHeight(); diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index a8d2d03236..1c68e4c6b3 100644 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -138,9 +138,14 @@ class LLIMToastNotifyPanel : public LLToastNotifyPanel { public: - LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null); + LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLUUID& session_id, const LLRect& rect = LLRect::null); + + ~LLIMToastNotifyPanel(); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + +protected: + LLUUID mSessionID; }; #endif /* LLTOASTNOTIFYPANEL_H_ */ -- cgit v1.2.3