diff options
Diffstat (limited to 'linden/indra/newview/llfloaterhtmlhelp.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterhtmlhelp.cpp | 91 |
1 files changed, 27 insertions, 64 deletions
diff --git a/linden/indra/newview/llfloaterhtmlhelp.cpp b/linden/indra/newview/llfloaterhtmlhelp.cpp index 0968734..d6d249e 100644 --- a/linden/indra/newview/llfloaterhtmlhelp.cpp +++ b/linden/indra/newview/llfloaterhtmlhelp.cpp | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "llviewerprecompiledheaders.h" | 32 | #include "llviewerprecompiledheaders.h" |
33 | 33 | ||
34 | #include "llfloaterhtmlhelp.h" | 34 | #include "llfloaterhtmlhelp.h" |
35 | #include "llfloaterhtml.h" | ||
35 | 36 | ||
36 | #include "llparcel.h" | 37 | #include "llparcel.h" |
37 | #include "lluictrlfactory.h" | 38 | #include "lluictrlfactory.h" |
@@ -122,7 +123,7 @@ void LLFloaterMediaBrowser::onLocationChange( const EventType& eventIn ) | |||
122 | // hitting the refresh button will navigate to same URL, so don't add to address history | 123 | // hitting the refresh button will navigate to same URL, so don't add to address history |
123 | mCurrentURL = eventIn.getStringValue(); | 124 | mCurrentURL = eventIn.getStringValue(); |
124 | std::string::size_type string_start = mCurrentURL.find("://"); | 125 | std::string::size_type string_start = mCurrentURL.find("://"); |
125 | LLString truncated_url; | 126 | std::string truncated_url; |
126 | if ((string_start == std::string::npos) || (1)) // NOTE: this conditional is forced true to disable truncation DEV-9834 | 127 | if ((string_start == std::string::npos) || (1)) // NOTE: this conditional is forced true to disable truncation DEV-9834 |
127 | { | 128 | { |
128 | truncated_url = mCurrentURL; | 129 | truncated_url = mCurrentURL; |
@@ -224,10 +225,10 @@ void LLFloaterMediaBrowser::onClickAssign(void* user_data) | |||
224 | return; | 225 | return; |
225 | } | 226 | } |
226 | std::string media_url = self->mAddressCombo->getValue().asString(); | 227 | std::string media_url = self->mAddressCombo->getValue().asString(); |
227 | LLString::trim(media_url); | 228 | LLStringUtil::trim(media_url); |
228 | 229 | ||
229 | parcel->setMediaURL(media_url.c_str()); | 230 | parcel->setMediaURL(media_url); |
230 | parcel->setMediaType("text/html"); | 231 | parcel->setMediaType(std::string("text/html")); |
231 | 232 | ||
232 | // Send current parcel data upstream to server | 233 | // Send current parcel data upstream to server |
233 | LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel, true ); | 234 | LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel, true ); |
@@ -278,8 +279,9 @@ protected: | |||
278 | LLButton* mForwardButton; | 279 | LLButton* mForwardButton; |
279 | LLButton* mCloseButton; | 280 | LLButton* mCloseButton; |
280 | LLTextBox* mStatusText; | 281 | LLTextBox* mStatusText; |
281 | LLString mStatusTextContents; | 282 | std::string mStatusTextContents; |
282 | LLString mCurrentUrl; | 283 | std::string mCurrentUrl; |
284 | std::string mSupportUrl; | ||
283 | }; | 285 | }; |
284 | 286 | ||
285 | LLFloaterHtmlHelp* LLFloaterHtmlHelp::sInstance = 0; | 287 | LLFloaterHtmlHelp* LLFloaterHtmlHelp::sInstance = 0; |
@@ -289,10 +291,10 @@ BOOL LLFloaterHtmlHelp::sFloaterOpened = FALSE; | |||
289 | //////////////////////////////////////////////////////////////////////////////// | 291 | //////////////////////////////////////////////////////////////////////////////// |
290 | // | 292 | // |
291 | LLFloaterHtmlHelp::LLFloaterHtmlHelp(std::string start_url, std::string title) | 293 | LLFloaterHtmlHelp::LLFloaterHtmlHelp(std::string start_url, std::string title) |
292 | : LLFloater( "HTML Help" ), | 294 | : LLFloater( std::string("HTML Help") ), |
293 | mWebBrowser( 0 ), | 295 | mWebBrowser( 0 ), |
294 | mStatusTextContents( "" ), | 296 | mStatusTextContents( LLStringUtil::null ), |
295 | mCurrentUrl( "" ) | 297 | mCurrentUrl( LLStringUtil::null ) |
296 | { | 298 | { |
297 | sInstance = this; | 299 | sInstance = this; |
298 | 300 | ||
@@ -302,7 +304,7 @@ LLFloaterHtmlHelp::LLFloaterHtmlHelp(std::string start_url, std::string title) | |||
302 | childSetAction("back_btn", onClickBack, this); | 304 | childSetAction("back_btn", onClickBack, this); |
303 | childSetAction("home_btn", onClickHome, this); | 305 | childSetAction("home_btn", onClickHome, this); |
304 | childSetAction("forward_btn", onClickForward, this); | 306 | childSetAction("forward_btn", onClickForward, this); |
305 | 307 | ||
306 | if (!title.empty()) | 308 | if (!title.empty()) |
307 | { | 309 | { |
308 | setTitle(title); | 310 | setTitle(title); |
@@ -323,7 +325,7 @@ LLFloaterHtmlHelp::LLFloaterHtmlHelp(std::string start_url, std::string title) | |||
323 | // if the last page we were at before the client was closed is valid, go there and | 325 | // if the last page we were at before the client was closed is valid, go there and |
324 | // override what is in the XML file | 326 | // override what is in the XML file |
325 | // (not when the window was closed - it's only ever hidden - not closed) | 327 | // (not when the window was closed - it's only ever hidden - not closed) |
326 | LLString lastPageUrl = gSavedSettings.getString( "HtmlHelpLastPage" ); | 328 | std::string lastPageUrl = gSavedSettings.getString( "HtmlHelpLastPage" ); |
327 | if ( lastPageUrl != "" ) | 329 | if ( lastPageUrl != "" ) |
328 | { | 330 | { |
329 | mWebBrowser->navigateTo( lastPageUrl ); | 331 | mWebBrowser->navigateTo( lastPageUrl ); |
@@ -372,67 +374,28 @@ void LLFloaterHtmlHelp::draw() | |||
372 | // | 374 | // |
373 | void LLFloaterHtmlHelp::show(std::string url, std::string title) | 375 | void LLFloaterHtmlHelp::show(std::string url, std::string title) |
374 | { | 376 | { |
375 | gViewerWindow->alertXml("ClickOpenF1Help", onClickF1HelpLoadURL, (void*) NULL); | 377 | LLFloaterHtml* floater_html = LLFloaterHtml::getInstance(); |
378 | floater_html->setVisible(FALSE); | ||
376 | 379 | ||
377 | // switching this out for the moment - will come back later | 380 | if(url.empty()) |
378 | // want it still to be compiled so not using comments of #if 0 | ||
379 | if ( false ) | ||
380 | { | 381 | { |
381 | sFloaterOpened = true; | 382 | url = floater_html->getSupportUrl(); |
382 | 383 | } | |
383 | if ( sInstance ) | 384 | std::string* url_copy = new std::string(url); |
384 | { | ||
385 | if (sInstance->mWebBrowser) | ||
386 | { | ||
387 | sInstance->mWebBrowser->navigateTo(url); | ||
388 | } | ||
389 | sInstance->setVisibleAndFrontmost(); | ||
390 | return; | ||
391 | } | ||
392 | 385 | ||
393 | LLFloaterHtmlHelp* self = new LLFloaterHtmlHelp(url, title); | 386 | gViewerWindow->alertXml("ClickOpenF1Help", onClickF1HelpLoadURL, url_copy); |
394 | 387 | ||
395 | // reposition floater from saved settings | ||
396 | LLRect rect = gSavedSettings.getRect( "HtmlHelpRect" ); | ||
397 | self->reshape( rect.getWidth(), rect.getHeight(), FALSE ); | ||
398 | self->setRect( rect ); | ||
399 | }; | ||
400 | } | 388 | } |
401 | 389 | ||
402 | // static | 390 | // static |
403 | void LLFloaterHtmlHelp::onClickF1HelpLoadURL(S32 option, void* userdata) | 391 | void LLFloaterHtmlHelp::onClickF1HelpLoadURL(S32 option, void* userdata) |
404 | { | 392 | { |
405 | if (option == 0) | 393 | std::string* urlp = (std::string*)userdata; |
394 | if (0 == option) | ||
406 | { | 395 | { |
407 | // choose HELP url based on selected language - default to english language support page | 396 | LLWeb::loadURL(urlp->c_str()); |
408 | LLString lang = LLUI::sConfigGroup->getString("Language"); | 397 | } |
409 | 398 | delete urlp; | |
410 | // this sucks but there isn't a way to grab an arbitrary string from an XML file | ||
411 | // (using llcontroldef strings causes problems if string don't exist) | ||
412 | LLString help_url( "http://secondlife.com/support" ); | ||
413 | if ( lang == "ja" ) | ||
414 | help_url = "http://help.secondlife.com/jp"; | ||
415 | else | ||
416 | if ( lang == "ko" ) | ||
417 | help_url = "http://help.secondlife.com/kr"; | ||
418 | else | ||
419 | if ( lang == "pt" ) | ||
420 | help_url = "http://help.secondlife.com/pt"; | ||
421 | else | ||
422 | if ( lang == "de" ) | ||
423 | help_url = "http://de.secondlife.com/support"; | ||
424 | else | ||
425 | if ( lang == "es" ) | ||
426 | help_url = "http://secondlife.com/app/support/index_es.html"; | ||
427 | else | ||
428 | if ( lang == "fr" ) | ||
429 | help_url = "http://secondlife.com/app/support/index_fr.html"; | ||
430 | else | ||
431 | if ( lang == "zh" ) | ||
432 | help_url = "http://secondlife.com/app/support/index_zh.html"; | ||
433 | |||
434 | LLWeb::loadURL( help_url ); | ||
435 | }; | ||
436 | } | 399 | } |
437 | 400 | ||
438 | //////////////////////////////////////////////////////////////////////////////// | 401 | //////////////////////////////////////////////////////////////////////////////// |
@@ -499,7 +462,7 @@ void LLFloaterHtmlHelp::onClickForward( void* data ) | |||
499 | // | 462 | // |
500 | void LLFloaterHtmlHelp::onStatusTextChange( const EventType& eventIn ) | 463 | void LLFloaterHtmlHelp::onStatusTextChange( const EventType& eventIn ) |
501 | { | 464 | { |
502 | mStatusTextContents = LLString( eventIn.getStringValue() ); | 465 | mStatusTextContents = std::string( eventIn.getStringValue() ); |
503 | 466 | ||
504 | childSetText("status_text", mStatusTextContents); | 467 | childSetText("status_text", mStatusTextContents); |
505 | } | 468 | } |
@@ -509,7 +472,7 @@ void LLFloaterHtmlHelp::onStatusTextChange( const EventType& eventIn ) | |||
509 | void LLFloaterHtmlHelp::onLocationChange( const EventType& eventIn ) | 472 | void LLFloaterHtmlHelp::onLocationChange( const EventType& eventIn ) |
510 | { | 473 | { |
511 | llinfos << "MOZ> Location changed to " << eventIn.getStringValue() << llendl; | 474 | llinfos << "MOZ> Location changed to " << eventIn.getStringValue() << llendl; |
512 | mCurrentUrl = LLString( eventIn.getStringValue() ); | 475 | mCurrentUrl = std::string( eventIn.getStringValue() ); |
513 | } | 476 | } |
514 | 477 | ||
515 | //////////////////////////////////////////////////////////////////////////////// | 478 | //////////////////////////////////////////////////////////////////////////////// |