From 75ebd835730f85aebd4b2a6238638e6cae4f435d Mon Sep 17 00:00:00 2001
From: andreykproductengine <akleshchev@productengine.com>
Date: Thu, 2 Jun 2016 19:59:35 +0300
Subject: [PATCH] MAINT-6448 PERMISSION_DEBIT notification should default to
 Deny

---
 indra/newview/lltoastscriptquestion.cpp | 19 +++++++++++++++++++
 indra/newview/lltoastscriptquestion.h   |  2 ++
 2 files changed, 21 insertions(+)

diff --git a/indra/newview/lltoastscriptquestion.cpp b/indra/newview/lltoastscriptquestion.cpp
index 91ba8c02477..7a3a1d8fd79 100644
--- a/indra/newview/lltoastscriptquestion.cpp
+++ b/indra/newview/lltoastscriptquestion.cpp
@@ -54,6 +54,19 @@ BOOL LLToastScriptQuestion::postBuild()
 
 	return TRUE;
 }
+
+// virtual
+void LLToastScriptQuestion::setFocus(BOOL b)
+{
+    LLToastPanel::setFocus(b);
+    // toast can fade out and disappear with focus ON, so reset to default anyway
+    LLButton* dfbutton = getDefaultButton();
+    if (dfbutton && dfbutton->getVisible() && dfbutton->getEnabled())
+    {
+        dfbutton->setFocus(b);
+    }
+}
+
 void LLToastScriptQuestion::snapToMessageHeight()
 {
 	LLTextBox* mMessage = getChild<LLTextBox>("top_info_message");
@@ -118,6 +131,12 @@ void LLToastScriptQuestion::createButtons()
 			button->setRect(rect);
 
 			buttons_width += rect.getWidth() + LEFT_PAD;
+
+			if (form_element.has("default") && form_element["default"].asBoolean())
+			{
+				button->setFocus(TRUE);
+				setDefaultBtn(button);
+			}
 		}
 	}
 }
diff --git a/indra/newview/lltoastscriptquestion.h b/indra/newview/lltoastscriptquestion.h
index 3a557f60f66..a756f88415e 100644
--- a/indra/newview/lltoastscriptquestion.h
+++ b/indra/newview/lltoastscriptquestion.h
@@ -39,6 +39,8 @@ class LLToastScriptQuestion : public LLToastPanel
 	virtual BOOL postBuild();
 	virtual ~LLToastScriptQuestion(){};
 
+	/*virtual*/ void setFocus(BOOL b);
+
 private:
 	void snapToMessageHeight();
 
-- 
GitLab