aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterhtml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfloaterhtml.cpp')
-rw-r--r--linden/indra/newview/llfloaterhtml.cpp81
1 files changed, 10 insertions, 71 deletions
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 @@
43#include "llwebbrowserctrl.h" 43#include "llwebbrowserctrl.h"
44 44
45LLFloaterHtml* LLFloaterHtml::sInstance = 0; 45LLFloaterHtml* LLFloaterHtml::sInstance = 0;
46LLViewerHtmlHelp gViewerHtmlHelp;
47 46
48//////////////////////////////////////////////////////////////////////////////// 47////////////////////////////////////////////////////////////////////////////////
49// 48//
@@ -60,10 +59,8 @@ LLFloaterHtml* LLFloaterHtml::getInstance()
60LLFloaterHtml::LLFloaterHtml() 59LLFloaterHtml::LLFloaterHtml()
61: LLFloater( "HTML Floater" ) 60: LLFloater( "HTML Floater" )
62 61
63#if LL_LIBXUL_ENABLED
64 , 62 ,
65 mWebBrowser( 0 ) 63 mWebBrowser( 0 )
66#endif // LL_LIBXUL_ENABLED
67{ 64{
68 // create floater from its XML definition 65 // create floater from its XML definition
69 gUICtrlFactory->buildFloater( this, "floater_html.xml" ); 66 gUICtrlFactory->buildFloater( this, "floater_html.xml" );
@@ -80,14 +77,12 @@ LLFloaterHtml::LLFloaterHtml()
80 reshape( rect.getWidth(), rect.getHeight(), FALSE ); 77 reshape( rect.getWidth(), rect.getHeight(), FALSE );
81 setRect( rect ); 78 setRect( rect );
82 79
83#if LL_LIBXUL_ENABLED
84 mWebBrowser = LLViewerUICtrlFactory::getWebBrowserByName(this, "html_floater_browser" ); 80 mWebBrowser = LLViewerUICtrlFactory::getWebBrowserByName(this, "html_floater_browser" );
85 if ( mWebBrowser ) 81 if ( mWebBrowser )
86 { 82 {
87 // open links in internal browser 83 // open links in internal browser
88 mWebBrowser->setOpenInExternalBrowser( false ); 84 mWebBrowser->setOpenInExternalBrowser( false );
89 } 85 }
90#endif // LL_LIBXUL_ENABLED
91} 86}
92 87
93//////////////////////////////////////////////////////////////////////////////// 88////////////////////////////////////////////////////////////////////////////////
@@ -95,7 +90,7 @@ LLFloaterHtml::LLFloaterHtml()
95LLFloaterHtml::~LLFloaterHtml() 90LLFloaterHtml::~LLFloaterHtml()
96{ 91{
97 // save position of floater 92 // save position of floater
98 gSavedSettings.setRect( "HtmlFloaterRect", mRect ); 93 gSavedSettings.setRect( "HtmlFloaterRect", getRect() );
99 94
100 sInstance = 0; 95 sInstance = 0;
101} 96}
@@ -104,7 +99,6 @@ LLFloaterHtml::~LLFloaterHtml()
104// virtual 99// virtual
105void LLFloaterHtml::draw() 100void LLFloaterHtml::draw()
106{ 101{
107#if LL_LIBXUL_ENABLED
108 // enable/disable buttons depending on state 102 // enable/disable buttons depending on state
109 if ( mWebBrowser ) 103 if ( mWebBrowser )
110 { 104 {
@@ -114,39 +108,37 @@ void LLFloaterHtml::draw()
114 bool enable_forward = mWebBrowser->canNavigateForward(); 108 bool enable_forward = mWebBrowser->canNavigateForward();
115 childSetEnabled( "forward_btn", enable_forward ); 109 childSetEnabled( "forward_btn", enable_forward );
116 }; 110 };
117#endif // LL_LIBXUL_ENABLED
118 111
119 LLFloater::draw(); 112 LLFloater::draw();
120} 113}
121 114
122//////////////////////////////////////////////////////////////////////////////// 115////////////////////////////////////////////////////////////////////////////////
123// 116//
124void LLFloaterHtml::show( LLString content_id, bool open_app_slurls ) 117void LLFloaterHtml::show( LLString content_id, bool open_app_slurls, bool open_link_external )
125{ 118{
126 // calculate the XML labels we'll need (if only XML folders worked) 119 // calculate the XML labels we'll need (if only XML folders worked)
127 LLString title_str = content_id + "_title"; 120 LLString title_str = content_id + "_title";
128 LLString url_str = content_id + "_url"; 121 LLString url_str = content_id + "_url";
129 122
130 std::string title = childGetValue( title_str ).asString(); 123 std::string title = getString( title_str );
131 std::string url = childGetValue( url_str ).asString(); 124 std::string url = getString( url_str );
132 show( url, title, open_app_slurls ); 125 show( url, title, open_app_slurls, open_link_external );
133} 126}
134 127
135//////////////////////////////////////////////////////////////////////////////// 128////////////////////////////////////////////////////////////////////////////////
136// 129//
137void LLFloaterHtml::show( std::string start_url, std::string title, bool open_app_slurls ) 130void LLFloaterHtml::show( std::string start_url, std::string title, bool open_app_slurls, bool open_link_external )
138{ 131{
139 // set the title 132 // set the title
140 setTitle( title ); 133 setTitle( title );
141 134
142#if LL_LIBXUL_ENABLED
143 // navigate to the URL 135 // navigate to the URL
144 if ( mWebBrowser ) 136 if ( mWebBrowser )
145 { 137 {
146 mWebBrowser->setOpenAppSLURLs( open_app_slurls ); 138 mWebBrowser->setOpenAppSLURLs( open_app_slurls );
139 mWebBrowser->setOpenInExternalBrowser( open_link_external );
147 mWebBrowser->navigateTo( start_url ); 140 mWebBrowser->navigateTo( start_url );
148 } 141 }
149#endif // LL_LIBXUL_ENABLED
150 142
151 // make floater appear 143 // make floater appear
152 setVisibleAndFrontmost(); 144 setVisibleAndFrontmost();
@@ -172,7 +164,6 @@ void LLFloaterHtml::onClickClose( void* data )
172// static 164// static
173void LLFloaterHtml::onClickBack( void* data ) 165void LLFloaterHtml::onClickBack( void* data )
174{ 166{
175#if LL_LIBXUL_ENABLED
176 LLFloaterHtml* self = ( LLFloaterHtml* )data; 167 LLFloaterHtml* self = ( LLFloaterHtml* )data;
177 if ( self ) 168 if ( self )
178 { 169 {
@@ -181,7 +172,6 @@ void LLFloaterHtml::onClickBack( void* data )
181 self->mWebBrowser->navigateBack(); 172 self->mWebBrowser->navigateBack();
182 }; 173 };
183 }; 174 };
184#endif // LL_LIBXUL_ENABLED
185} 175}
186 176
187//////////////////////////////////////////////////////////////////////////////// 177////////////////////////////////////////////////////////////////////////////////
@@ -191,10 +181,9 @@ void LLFloaterHtml::onClickHome( void* data )
191 LLFloaterHtml* self = ( LLFloaterHtml* )data; 181 LLFloaterHtml* self = ( LLFloaterHtml* )data;
192 if ( self ) 182 if ( self )
193 { 183 {
194#if LL_LIBXUL_ENABLED
195 if ( self->mWebBrowser ) 184 if ( self->mWebBrowser )
196 { 185 {
197 std::string home_url = self->childGetText("home_page_url"); 186 std::string home_url = self->getString("home_page_url");
198 if ( home_url.length() > 4 ) 187 if ( home_url.length() > 4 )
199 { 188 {
200 self->mWebBrowser->navigateTo( home_url ); 189 self->mWebBrowser->navigateTo( home_url );
@@ -205,7 +194,6 @@ void LLFloaterHtml::onClickHome( void* data )
205 self->mWebBrowser->navigateTo( "http://secondlife.com" ); 194 self->mWebBrowser->navigateTo( "http://secondlife.com" );
206 } 195 }
207 }; 196 };
208#endif // LL_LIBXUL_ENABLED
209 }; 197 };
210} 198}
211 199
@@ -216,12 +204,10 @@ void LLFloaterHtml::onClickForward( void* data )
216 LLFloaterHtml* self = ( LLFloaterHtml* )data; 204 LLFloaterHtml* self = ( LLFloaterHtml* )data;
217 if ( self ) 205 if ( self )
218 { 206 {
219#if LL_LIBXUL_ENABLED
220 if ( self->mWebBrowser ) 207 if ( self->mWebBrowser )
221 { 208 {
222 self->mWebBrowser->navigateForward(); 209 self->mWebBrowser->navigateForward();
223 }; 210 };
224#endif // LL_LIBXUL_ENABLED
225 }; 211 };
226} 212}
227 213
@@ -229,7 +215,6 @@ void LLFloaterHtml::onClickForward( void* data )
229// static 215// static
230void LLFloaterHtml::onCommitUrlEdit(LLUICtrl* ctrl, void* user_data) 216void LLFloaterHtml::onCommitUrlEdit(LLUICtrl* ctrl, void* user_data)
231{ 217{
232#if LL_LIBXUL_ENABLED
233 LLFloaterHtml* self = (LLFloaterHtml*)user_data; 218 LLFloaterHtml* self = (LLFloaterHtml*)user_data;
234 219
235 LLLineEditor* editor = (LLLineEditor*)ctrl; 220 LLLineEditor* editor = (LLLineEditor*)ctrl;
@@ -239,7 +224,6 @@ void LLFloaterHtml::onCommitUrlEdit(LLUICtrl* ctrl, void* user_data)
239 { 224 {
240 self->mWebBrowser->navigateTo( url ); 225 self->mWebBrowser->navigateTo( url );
241 }; 226 };
242#endif // LL_LIBXUL_ENABLED
243} 227}
244 228
245//////////////////////////////////////////////////////////////////////////////// 229////////////////////////////////////////////////////////////////////////////////
@@ -252,56 +236,11 @@ void LLFloaterHtml::onClickGo( void* data )
252 std::string url = self->childGetValue( "url_edit" ).asString(); 236 std::string url = self->childGetValue( "url_edit" ).asString();
253 if ( url.length() ) 237 if ( url.length() )
254 { 238 {
255#if LL_LIBXUL_ENABLED
256 if ( self->mWebBrowser ) 239 if ( self->mWebBrowser )
257 { 240 {
258 self->mWebBrowser->navigateTo( url ); 241 self->mWebBrowser->navigateTo( url );
259 }; 242 }
260#endif // LL_LIBXUL_ENABLED 243 }
261 };
262 };
263}
264
265////////////////////////////////////////////////////////////////////////////////
266//
267static void onClickF1HelpLoadURL(S32 option, void* userdata)
268{
269 if (option == 0)
270 {
271 // choose HELP url based on selected language - default to english language support page
272 LLString lang = LLUI::sConfigGroup->getString("Language");
273
274 // *TODO:Translate
275 // this sucks but there isn't a way to grab an arbitrary string from an XML file
276 // (using llcontroldef strings causes problems if string don't exist)
277 LLString help_url( "http://secondlife.com/support" );
278 if ( lang == "ja" )
279 help_url = "http://help.secondlife.com/jp";
280 else
281 if ( lang == "ko" )
282 help_url = "http://help.secondlife.com/kr";
283 else
284 if ( lang == "pt" )
285 help_url = "http://help.secondlife.com/pt";
286 else
287 if ( lang == "de" )
288 help_url = "http://de.secondlife.com/support";
289
290 LLWeb::loadURL( help_url );
291 } 244 }
292} 245}
293 246
294LLViewerHtmlHelp::LLViewerHtmlHelp()
295{
296 LLUI::setHtmlHelp(this);
297}
298
299LLViewerHtmlHelp::~LLViewerHtmlHelp()
300{
301 LLUI::setHtmlHelp(NULL);
302}
303
304void LLViewerHtmlHelp::show(std::string url, std::string title)
305{
306 gViewerWindow->alertXml("ClickOpenF1Help", onClickF1HelpLoadURL, (void*) NULL);
307}