diff options
Diffstat (limited to 'linden/indra/llui/llalertdialog.cpp')
-rw-r--r-- | linden/indra/llui/llalertdialog.cpp | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/linden/indra/llui/llalertdialog.cpp b/linden/indra/llui/llalertdialog.cpp index 258b523..716fffd 100644 --- a/linden/indra/llui/llalertdialog.cpp +++ b/linden/indra/llui/llalertdialog.cpp | |||
@@ -58,6 +58,8 @@ const S32 MSG_PAD = 8; | |||
58 | /*static*/ LLAlertDialog::display_callback_t LLAlertDialog::sDisplayCallback; | 58 | /*static*/ LLAlertDialog::display_callback_t LLAlertDialog::sDisplayCallback; |
59 | /*static*/ LLString LLAlertDialog::sStringSkipNextTime("Skip this dialog next time"); | 59 | /*static*/ LLString LLAlertDialog::sStringSkipNextTime("Skip this dialog next time"); |
60 | /*static*/ LLString LLAlertDialog::sStringAlwaysChoose("Always choose this option"); | 60 | /*static*/ LLString LLAlertDialog::sStringAlwaysChoose("Always choose this option"); |
61 | /*static*/ LLAlertDialog::URLLoader* LLAlertDialog::sURLLoader; | ||
62 | |||
61 | 63 | ||
62 | //static | 64 | //static |
63 | LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, | 65 | LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, |
@@ -147,8 +149,11 @@ LLAlertDialog::LLAlertDialog( const LLAlertDialogTemplate* xml_template, | |||
147 | mIgnoreLabel(xml_template->mIgnoreLabel), | 149 | mIgnoreLabel(xml_template->mIgnoreLabel), |
148 | mButtonData(NULL), | 150 | mButtonData(NULL), |
149 | mLineEditor(NULL), | 151 | mLineEditor(NULL), |
150 | mTextCallback(NULL) | 152 | mTextCallback(NULL), |
153 | mURLOption(0) | ||
151 | { | 154 | { |
155 | mURL = xml_template->mURL; | ||
156 | mURLOption = xml_template->mURLOption; | ||
152 | createDialog(&(xml_template->mOptions), xml_template->mDefaultOption, | 157 | createDialog(&(xml_template->mOptions), xml_template->mDefaultOption, |
153 | xml_template->mMessage, args, | 158 | xml_template->mMessage, args, |
154 | xml_template->mEditLineText); | 159 | xml_template->mEditLineText); |
@@ -237,12 +242,12 @@ bool LLAlertDialog::show() | |||
237 | return true; | 242 | return true; |
238 | } | 243 | } |
239 | 244 | ||
240 | //static | ||
241 | void LLAlertDialog::format(LLString& msg, const LLString::format_map_t& args) | 245 | void LLAlertDialog::format(LLString& msg, const LLString::format_map_t& args) |
242 | { | 246 | { |
243 | // XUI:translate! | 247 | // XUI:translate! |
244 | LLString::format_map_t targs = args; | 248 | LLString::format_map_t targs = args; |
245 | targs["[SECOND_LIFE]"] = "Second Life"; | 249 | targs["[SECOND_LIFE]"] = "Second Life"; |
250 | targs["[_URL]"] = mURL; | ||
246 | LLString::format(msg, targs); | 251 | LLString::format(msg, targs); |
247 | } | 252 | } |
248 | 253 | ||
@@ -288,7 +293,7 @@ void LLAlertDialog::createDialog(const std::vector<LLString>* optionsp, S32 defa | |||
288 | // Message: create text box using raw string, as text has been structure deliberately | 293 | // Message: create text box using raw string, as text has been structure deliberately |
289 | // Use size of created text box to generate dialog box size | 294 | // Use size of created text box to generate dialog box size |
290 | LLString msg = msg_in; | 295 | LLString msg = msg_in; |
291 | LLAlertDialog::format( msg, args ); | 296 | format( msg, args ); |
292 | llwarns << "Alert: " << msg << llendl; | 297 | llwarns << "Alert: " << msg << llendl; |
293 | LLTextBox* msg_box = new LLTextBox( "Alert message", msg, (F32)MAX_ALLOWED_MSG_WIDTH, font ); | 298 | LLTextBox* msg_box = new LLTextBox( "Alert message", msg, (F32)MAX_ALLOWED_MSG_WIDTH, font ); |
294 | 299 | ||
@@ -424,6 +429,15 @@ LLAlertDialog::~LLAlertDialog() | |||
424 | mCallback(mOptionChosen, mUserData); | 429 | mCallback(mOptionChosen, mUserData); |
425 | } | 430 | } |
426 | 431 | ||
432 | // If we declared a URL and chose the URL option, go to the url | ||
433 | if (mOptionChosen == mURLOption) | ||
434 | { | ||
435 | if (!mURL.empty() && sURLLoader != NULL) | ||
436 | { | ||
437 | sURLLoader->load(mURL); | ||
438 | } | ||
439 | } | ||
440 | |||
427 | // Only change warn state if we actually warned. | 441 | // Only change warn state if we actually warned. |
428 | if (mCheck | 442 | if (mCheck |
429 | && sSettings->getWarning(mIgnoreLabel)) | 443 | && sSettings->getWarning(mIgnoreLabel)) |
@@ -547,7 +561,7 @@ void LLAlertDialog::setEditTextArgs(const LLString::format_map_t& edit_args) | |||
547 | if (mLineEditor) | 561 | if (mLineEditor) |
548 | { | 562 | { |
549 | LLString msg = mLineEditor->getText(); | 563 | LLString msg = mLineEditor->getText(); |
550 | LLAlertDialog::format(msg, edit_args); | 564 | format(msg, edit_args); |
551 | mLineEditor->setText(msg); | 565 | mLineEditor->setText(msg); |
552 | } | 566 | } |
553 | else | 567 | else |
@@ -790,6 +804,19 @@ bool LLAlertDialog::parseAlerts(const LLString& xml_filename, LLControlGroup* se | |||
790 | } | 804 | } |
791 | } | 805 | } |
792 | } | 806 | } |
807 | |||
808 | // <url> | ||
809 | if (child->hasName("url")) | ||
810 | { | ||
811 | S32 url_option = 0; | ||
812 | child->getAttributeS32("option", url_option); | ||
813 | if (xml_template) | ||
814 | { | ||
815 | xml_template->mURL = child->getTextContents(); | ||
816 | xml_template->mURLOption = url_option; | ||
817 | } | ||
818 | } | ||
819 | |||
793 | } | 820 | } |
794 | if (xml_template) | 821 | if (xml_template) |
795 | { | 822 | { |