summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/lldonotdisturbnotificationstorage.cpp32
-rw-r--r--indra/newview/lltoastnotifypanel.cpp34
-rw-r--r--indra/newview/lltoastnotifypanel.h3
-rw-r--r--indra/newview/lltoastpanel.cpp33
-rw-r--r--indra/newview/lltoastpanel.h1
-rwxr-xr-xindra/newview/llviewermessage.cpp5
6 files changed, 76 insertions, 32 deletions
diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp
index f7af447a57..22f35752bd 100644
--- a/indra/newview/lldonotdisturbnotificationstorage.cpp
+++ b/indra/newview/lldonotdisturbnotificationstorage.cpp
@@ -164,22 +164,32 @@ void LLDoNotDisturbNotificationStorage::loadNotifications()
{
offerExists = true;
}
-
- //New notification needs to be added
- notification = (LLNotificationPtr) new LLNotification(notification_params.with("is_dnd", true));
- LLNotificationResponderInterface* responder = createResponder(notification_params["responder_sd"]["responder_type"], notification_params["responder_sd"]);
- if (responder == NULL)
+
+ //Notification already exists due to persistent storage adding it first into the notification system
+ if(notification)
{
- LL_WARNS("LLDoNotDisturbNotificationStorage") << "cannot create responder for notification of type '"
- << notification->getType() << "'" << LL_ENDL;
+ notification->setDND(true);
+ instance.update(instance.find(notificationID));
}
+ //New notification needs to be added
else
{
- LLNotificationResponderPtr responderPtr(responder);
- notification->setResponseFunctor(responderPtr);
+ notification = (LLNotificationPtr) new LLNotification(notification_params.with("is_dnd", true));
+ LLNotificationResponderInterface* responder = createResponder(notification_params["responder_sd"]["responder_type"], notification_params["responder_sd"]);
+ if (responder == NULL)
+ {
+ LL_WARNS("LLDoNotDisturbNotificationStorage") << "cannot create responder for notification of type '"
+ << notification->getType() << "'" << LL_ENDL;
+ }
+ else
+ {
+ LLNotificationResponderPtr responderPtr(responder);
+ notification->setResponseFunctor(responderPtr);
+ }
+
+ instance.add(notification);
}
-
- instance.add(notification);
+
}
if(imToastExists)
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index 3fd056ea31..4ef5ad845c 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -259,12 +259,6 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
setXMLFilename("");
buildFromFile("panel_notification.xml");
- // reshape the panel to its previous size
- if (current_rect.notEmpty())
- {
- reshape(current_rect.getWidth(), current_rect.getHeight());
- }
-
if(rect != LLRect::null)
{
this->setShape(rect);
@@ -407,6 +401,12 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
//can shift upward making room for the buttons inside mControlPanel. After the buttons are added, the info panel can then be set to follow 'all'.
mInfoPanel->setFollowsAll();
snapToMessageHeight(mTextBox, MAX_LENGTH);
+
+ // reshape the panel to its previous size
+ if (current_rect.notEmpty())
+ {
+ reshape(current_rect.getWidth(), current_rect.getHeight());
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -426,7 +426,27 @@ LLIMToastNotifyPanel::~LLIMToastNotifyPanel()
void LLIMToastNotifyPanel::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */)
{
LLToastPanel::reshape(width, height, called_from_parent);
- snapToMessageHeight(mTextBox, MAX_LENGTH);
+ snapToMessageHeight();
+}
+
+void LLIMToastNotifyPanel::snapToMessageHeight()
+{
+ if(!mTextBox)
+ {
+ return;
+ }
+
+ //Add message height if it is visible
+ if (mTextBox->getVisible())
+ {
+ S32 new_panel_height = computeSnappedToMessageHeight(mTextBox, MAX_LENGTH);
+
+ //reshape the panel with new height
+ if (new_panel_height != getRect().getHeight())
+ {
+ LLToastNotifyPanel::reshape( getRect().getWidth(), new_panel_height);
+ }
+ }
}
void LLIMToastNotifyPanel::compactButtons()
diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h
index f93c7745af..d02171b512 100644
--- a/indra/newview/lltoastnotifypanel.h
+++ b/indra/newview/lltoastnotifypanel.h
@@ -157,6 +157,9 @@ public:
protected:
LLTextBase* mParentText;
LLUUID mSessionID;
+
+private:
+ void snapToMessageHeight();
};
#endif /* LLTOASTNOTIFYPANEL_H_ */
diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp
index 187aee207c..a30f841980 100644
--- a/indra/newview/lltoastpanel.cpp
+++ b/indra/newview/lltoastpanel.cpp
@@ -58,6 +58,25 @@ const LLUUID& LLToastPanel::getID()
return mNotification->id();
}
+S32 LLToastPanel::computeSnappedToMessageHeight(LLTextBase* message, S32 maxLineCount)
+{
+ S32 heightDelta = 0;
+ S32 maxTextHeight = message->getFont()->getLineHeight() * maxLineCount;
+
+ LLRect messageRect = message->getRect();
+ S32 oldTextHeight = messageRect.getHeight();
+
+ //Knowing the height is set to max allowed, getTextPixelHeight returns needed text height
+ //Perhaps we need to pass maxLineCount as parameter to getTextPixelHeight to avoid previous reshape.
+ S32 requiredTextHeight = message->getTextBoundingRect().getHeight();
+ S32 newTextHeight = llmin(requiredTextHeight, maxTextHeight);
+
+ heightDelta = newTextHeight - oldTextHeight;
+ S32 new_panel_height = llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT);
+
+ return new_panel_height;
+}
+
//snap to the message height if it is visible
void LLToastPanel::snapToMessageHeight(LLTextBase* message, S32 maxLineCount)
{
@@ -69,19 +88,7 @@ void LLToastPanel::snapToMessageHeight(LLTextBase* message, S32 maxLineCount)
//Add message height if it is visible
if (message->getVisible())
{
- S32 heightDelta = 0;
- S32 maxTextHeight = message->getFont()->getLineHeight() * maxLineCount;
-
- LLRect messageRect = message->getRect();
- S32 oldTextHeight = messageRect.getHeight();
-
- //Knowing the height is set to max allowed, getTextPixelHeight returns needed text height
- //Perhaps we need to pass maxLineCount as parameter to getTextPixelHeight to avoid previous reshape.
- S32 requiredTextHeight = message->getTextBoundingRect().getHeight();
- S32 newTextHeight = llmin(requiredTextHeight, maxTextHeight);
-
- heightDelta = newTextHeight - oldTextHeight;
- S32 new_panel_height = llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT);
+ S32 new_panel_height = computeSnappedToMessageHeight(message, maxLineCount);
//reshape the panel with new height
if (new_panel_height != getRect().getHeight())
diff --git a/indra/newview/lltoastpanel.h b/indra/newview/lltoastpanel.h
index c22557206b..e4ab95007e 100644
--- a/indra/newview/lltoastpanel.h
+++ b/indra/newview/lltoastpanel.h
@@ -59,6 +59,7 @@ public:
protected:
LLNotificationPtr mNotification;
void snapToMessageHeight(LLTextBase* message, S32 maxLineCount);
+ S32 computeSnappedToMessageHeight(LLTextBase* message, S32 maxLineCount);
};
#endif /* LL_TOASTPANEL_H */
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 6bbfd30794..2340436a01 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2615,7 +2615,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
payload["sender_name"] = name;
payload["group_id"] = group_id;
payload["inventory_name"] = item_name;
- payload["inventory_offer"] = info ? info->asLLSD() : LLSD();
+ if(info && info->asLLSD())
+ {
+ payload["inventory_offer"] = info->asLLSD();
+ }
LLSD args;
args["SUBJECT"] = subj;