summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorJonathan Yap <none@none>2011-08-23 07:55:34 -0400
committerJonathan Yap <none@none>2011-08-23 07:55:34 -0400
commit541e26d947e19cf087e068ab3f1bd46fb1d8fd4f (patch)
tree75a281ada3610b094dd2e14ff4daef6250382f65 /indra
parentaa1424365e3df49edfc189ef433e050f502534e9 (diff)
STORM-1567 Mute button for llDialog popup
Updating patch to current version of viewer-development
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/lltoastnotifypanel.cpp26
-rw-r--r--indra/newview/llviewermessage.cpp25
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml4
3 files changed, 50 insertions, 5 deletions
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index fa91f129b8..ea047a1878 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -305,10 +305,17 @@ void LLToastNotifyPanel::updateButtonsLayout(const std::vector<index_button_pair
S32 left = 0;
//reserve place for ignore button
S32 bottom_offset = mIsScriptDialog ? (BTN_HEIGHT + IGNORE_BTN_TOP_DELTA + BOTTOM_PAD) : BOTTOM_PAD;
+ S32 ignore_btn_hoffset = 0;
S32 max_width = mControlPanel->getRect().getWidth();
LLButton* ignore_btn = NULL;
+ LLButton* mute_btn = NULL;
for (std::vector<index_button_pair_t>::const_iterator it = buttons.begin(); it != buttons.end(); it++)
{
+ if (-2 == it->first)
+ {
+ mute_btn = it->second;
+ continue;
+ }
if (it->first == -1)
{
ignore_btn = it->second;
@@ -328,6 +335,8 @@ void LLToastNotifyPanel::updateButtonsLayout(const std::vector<index_button_pair
left = btn_rect.mLeft + btn_rect.getWidth() + h_pad;
mControlPanel->addChild(btn, -1);
}
+
+ U32 ignore_btn_width = 0;
if (mIsScriptDialog && ignore_btn != NULL)
{
LLRect ignore_btn_rect(ignore_btn->getRect());
@@ -337,11 +346,28 @@ void LLToastNotifyPanel::updateButtonsLayout(const std::vector<index_button_pair
{
ignore_btn_left = max_width - ignore_btn_rect.getWidth() - 2 * HPAD;
}
+ ignore_btn_hoffset = ignore_btn_left;
ignore_btn_rect.setOriginAndSize(ignore_btn_left, BOTTOM_PAD,// always move ignore button at the bottom
ignore_btn_rect.getWidth(), ignore_btn_rect.getHeight());
ignore_btn->setRect(ignore_btn_rect);
+ ignore_btn_width = ignore_btn_rect.getWidth();
mControlPanel->addChild(ignore_btn, -1);
}
+
+ if (mIsScriptDialog && mute_btn != NULL)
+ {
+ LLRect mute_btn_rect(mute_btn->getRect());
+ S32 buttons_per_row = max_width / BUTTON_WIDTH; //assume that h_pad far less than BUTTON_WIDTH
+ S32 mute_btn_left = buttons_per_row * BUTTON_WIDTH + (buttons_per_row - 1) * h_pad - mute_btn_rect.getWidth() - ignore_btn_width - (h_pad / 2);
+ if (mute_btn_left + mute_btn_rect.getWidth() > max_width) // make sure that the mute button is in panel
+ {
+ mute_btn_left = max_width - mute_btn_rect.getWidth() - 2 * HPAD;
+ }
+ mute_btn_rect.setOriginAndSize(mute_btn_left, BOTTOM_PAD,// always move mute button at the bottom
+ mute_btn_rect.getWidth(), mute_btn_rect.getHeight());
+ mute_btn->setRect(mute_btn_rect);
+ mControlPanel->addChild(mute_btn);
+ }
}
void LLToastNotifyPanel::adjustPanelForScriptNotice(S32 button_panel_width, S32 button_panel_height)
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 321d02aaf1..8471de3004 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -6544,8 +6544,22 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response)
rtn_text = LLNotification::getSelectedOptionName(response);
}
- // Didn't click "Ignore"
- if (button_idx != -1)
+ // Button -2 = Mute
+ // Button -1 = Ignore - no processing needed for this button
+ // Buttons 0 and above = dialog choices
+
+ if (-2 == button_idx)
+ {
+ std::string object_name = notification["payload"]["object_name"].asString();
+ LLUUID object_id = notification["payload"]["object_id"].asUUID();
+ LLMute mute(object_id, object_name, LLMute::OBJECT);
+ if (LLMuteList::getInstance()->add(mute))
+ {
+ LLPanelBlockedList::showPanelAndSelect(object_id);
+ }
+ }
+
+ if (0 <= button_idx)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("ScriptDialogReply");
@@ -6588,12 +6602,12 @@ void process_script_dialog(LLMessageSystem* msg, void**)
std::string message;
std::string first_name;
std::string last_name;
- std::string title;
+ std::string object_name;
S32 chat_channel;
msg->getString("Data", "FirstName", first_name);
msg->getString("Data", "LastName", last_name);
- msg->getString("Data", "ObjectName", title);
+ msg->getString("Data", "ObjectName", object_name);
msg->getString("Data", "Message", message);
msg->getS32("Data", "ChatChannel", chat_channel);
@@ -6604,6 +6618,7 @@ void process_script_dialog(LLMessageSystem* msg, void**)
payload["sender"] = msg->getSender().getIPandPort();
payload["object_id"] = object_id;
payload["chat_channel"] = chat_channel;
+ payload["object_name"] = object_name;
// build up custom form
S32 button_count = msg->getNumberOfBlocks("Buttons");
@@ -6622,7 +6637,7 @@ void process_script_dialog(LLMessageSystem* msg, void**)
}
LLSD args;
- args["TITLE"] = title;
+ args["TITLE"] = object_name;
args["MESSAGE"] = message;
LLNotificationPtr notification;
if (!first_name.empty())
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index c9ccd44b83..43e01a1080 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -6276,6 +6276,10 @@ Grant this request?
[MESSAGE]
<form name="form">
<button
+ index="-2"
+ name="Mute"
+ text="Block"/>
+ <button
index="-1"
name="Ignore"
text="Ignore"/>