From cd17687f01420952712a500107e0f93e7ab8d5f8 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:34 -0500 Subject: Second Life viewer sources 1.19.1.0 --- linden/indra/newview/llfloaterhtml.cpp | 81 +++++----------------------------- 1 file changed, 10 insertions(+), 71 deletions(-) (limited to 'linden/indra/newview/llfloaterhtml.cpp') diff --git a/linden/indra/newview/llfloaterhtml.cpp b/linden/indra/newview/llfloaterhtml.cpp index 2f7bc14..596202a 100644 --- a/linden/indra/newview/llfloaterhtml.cpp +++ b/linden/indra/newview/llfloaterhtml.cpp @@ -43,7 +43,6 @@ #include "llwebbrowserctrl.h" LLFloaterHtml* LLFloaterHtml::sInstance = 0; -LLViewerHtmlHelp gViewerHtmlHelp; //////////////////////////////////////////////////////////////////////////////// // @@ -60,10 +59,8 @@ LLFloaterHtml* LLFloaterHtml::getInstance() LLFloaterHtml::LLFloaterHtml() : LLFloater( "HTML Floater" ) -#if LL_LIBXUL_ENABLED , mWebBrowser( 0 ) -#endif // LL_LIBXUL_ENABLED { // create floater from its XML definition gUICtrlFactory->buildFloater( this, "floater_html.xml" ); @@ -80,14 +77,12 @@ LLFloaterHtml::LLFloaterHtml() reshape( rect.getWidth(), rect.getHeight(), FALSE ); setRect( rect ); -#if LL_LIBXUL_ENABLED mWebBrowser = LLViewerUICtrlFactory::getWebBrowserByName(this, "html_floater_browser" ); if ( mWebBrowser ) { // open links in internal browser mWebBrowser->setOpenInExternalBrowser( false ); } -#endif // LL_LIBXUL_ENABLED } //////////////////////////////////////////////////////////////////////////////// @@ -95,7 +90,7 @@ LLFloaterHtml::LLFloaterHtml() LLFloaterHtml::~LLFloaterHtml() { // save position of floater - gSavedSettings.setRect( "HtmlFloaterRect", mRect ); + gSavedSettings.setRect( "HtmlFloaterRect", getRect() ); sInstance = 0; } @@ -104,7 +99,6 @@ LLFloaterHtml::~LLFloaterHtml() // virtual void LLFloaterHtml::draw() { -#if LL_LIBXUL_ENABLED // enable/disable buttons depending on state if ( mWebBrowser ) { @@ -114,39 +108,37 @@ void LLFloaterHtml::draw() bool enable_forward = mWebBrowser->canNavigateForward(); childSetEnabled( "forward_btn", enable_forward ); }; -#endif // LL_LIBXUL_ENABLED LLFloater::draw(); } //////////////////////////////////////////////////////////////////////////////// // -void LLFloaterHtml::show( LLString content_id, bool open_app_slurls ) +void LLFloaterHtml::show( LLString content_id, bool open_app_slurls, bool open_link_external ) { // calculate the XML labels we'll need (if only XML folders worked) LLString title_str = content_id + "_title"; LLString url_str = content_id + "_url"; - std::string title = childGetValue( title_str ).asString(); - std::string url = childGetValue( url_str ).asString(); - show( url, title, open_app_slurls ); + std::string title = getString( title_str ); + std::string url = getString( url_str ); + show( url, title, open_app_slurls, open_link_external ); } //////////////////////////////////////////////////////////////////////////////// // -void LLFloaterHtml::show( std::string start_url, std::string title, bool open_app_slurls ) +void LLFloaterHtml::show( std::string start_url, std::string title, bool open_app_slurls, bool open_link_external ) { // set the title setTitle( title ); -#if LL_LIBXUL_ENABLED // navigate to the URL if ( mWebBrowser ) { mWebBrowser->setOpenAppSLURLs( open_app_slurls ); + mWebBrowser->setOpenInExternalBrowser( open_link_external ); mWebBrowser->navigateTo( start_url ); } -#endif // LL_LIBXUL_ENABLED // make floater appear setVisibleAndFrontmost(); @@ -172,7 +164,6 @@ void LLFloaterHtml::onClickClose( void* data ) // static void LLFloaterHtml::onClickBack( void* data ) { -#if LL_LIBXUL_ENABLED LLFloaterHtml* self = ( LLFloaterHtml* )data; if ( self ) { @@ -181,7 +172,6 @@ void LLFloaterHtml::onClickBack( void* data ) self->mWebBrowser->navigateBack(); }; }; -#endif // LL_LIBXUL_ENABLED } //////////////////////////////////////////////////////////////////////////////// @@ -191,10 +181,9 @@ void LLFloaterHtml::onClickHome( void* data ) LLFloaterHtml* self = ( LLFloaterHtml* )data; if ( self ) { -#if LL_LIBXUL_ENABLED if ( self->mWebBrowser ) { - std::string home_url = self->childGetText("home_page_url"); + std::string home_url = self->getString("home_page_url"); if ( home_url.length() > 4 ) { self->mWebBrowser->navigateTo( home_url ); @@ -205,7 +194,6 @@ void LLFloaterHtml::onClickHome( void* data ) self->mWebBrowser->navigateTo( "http://secondlife.com" ); } }; -#endif // LL_LIBXUL_ENABLED }; } @@ -216,12 +204,10 @@ void LLFloaterHtml::onClickForward( void* data ) LLFloaterHtml* self = ( LLFloaterHtml* )data; if ( self ) { -#if LL_LIBXUL_ENABLED if ( self->mWebBrowser ) { self->mWebBrowser->navigateForward(); }; -#endif // LL_LIBXUL_ENABLED }; } @@ -229,7 +215,6 @@ void LLFloaterHtml::onClickForward( void* data ) // static void LLFloaterHtml::onCommitUrlEdit(LLUICtrl* ctrl, void* user_data) { -#if LL_LIBXUL_ENABLED LLFloaterHtml* self = (LLFloaterHtml*)user_data; LLLineEditor* editor = (LLLineEditor*)ctrl; @@ -239,7 +224,6 @@ void LLFloaterHtml::onCommitUrlEdit(LLUICtrl* ctrl, void* user_data) { self->mWebBrowser->navigateTo( url ); }; -#endif // LL_LIBXUL_ENABLED } //////////////////////////////////////////////////////////////////////////////// @@ -252,56 +236,11 @@ void LLFloaterHtml::onClickGo( void* data ) std::string url = self->childGetValue( "url_edit" ).asString(); if ( url.length() ) { -#if LL_LIBXUL_ENABLED if ( self->mWebBrowser ) { self->mWebBrowser->navigateTo( url ); - }; -#endif // LL_LIBXUL_ENABLED - }; - }; -} - -//////////////////////////////////////////////////////////////////////////////// -// -static void onClickF1HelpLoadURL(S32 option, void* userdata) -{ - if (option == 0) - { - // choose HELP url based on selected language - default to english language support page - LLString lang = LLUI::sConfigGroup->getString("Language"); - - // *TODO:Translate - // this sucks but there isn't a way to grab an arbitrary string from an XML file - // (using llcontroldef strings causes problems if string don't exist) - LLString help_url( "http://secondlife.com/support" ); - if ( lang == "ja" ) - help_url = "http://help.secondlife.com/jp"; - else - if ( lang == "ko" ) - help_url = "http://help.secondlife.com/kr"; - else - if ( lang == "pt" ) - help_url = "http://help.secondlife.com/pt"; - else - if ( lang == "de" ) - help_url = "http://de.secondlife.com/support"; - - LLWeb::loadURL( help_url ); + } + } } } -LLViewerHtmlHelp::LLViewerHtmlHelp() -{ - LLUI::setHtmlHelp(this); -} - -LLViewerHtmlHelp::~LLViewerHtmlHelp() -{ - LLUI::setHtmlHelp(NULL); -} - -void LLViewerHtmlHelp::show(std::string url, std::string title) -{ - gViewerWindow->alertXml("ClickOpenF1Help", onClickF1HelpLoadURL, (void*) NULL); -} -- cgit v1.1