aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanellogin.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llpanellogin.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/llpanellogin.cpp')
-rw-r--r--linden/indra/newview/llpanellogin.cpp56
1 files changed, 19 insertions, 37 deletions
diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp
index 24d235e..26075a1 100644
--- a/linden/indra/newview/llpanellogin.cpp
+++ b/linden/indra/newview/llpanellogin.cpp
@@ -71,7 +71,8 @@
71#include "llwebbrowserctrl.h" 71#include "llwebbrowserctrl.h"
72 72
73#include "llfloaterhtml.h" 73#include "llfloaterhtml.h"
74//#include "llfloaterhtmlhelp.h" 74
75#include "llfloaterhtmlhelp.h"
75#include "llfloatertos.h" 76#include "llfloatertos.h"
76 77
77#include "llglheaders.h" 78#include "llglheaders.h"
@@ -95,12 +96,10 @@ public:
95 LLLoginRefreshHandler() : LLCommandHandler("login_refresh", false) { } 96 LLLoginRefreshHandler() : LLCommandHandler("login_refresh", false) { }
96 bool handle(const LLSD& tokens, const LLSD& queryMap) 97 bool handle(const LLSD& tokens, const LLSD& queryMap)
97 { 98 {
98#if LL_LIBXUL_ENABLED
99 if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) 99 if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
100 { 100 {
101 LLPanelLogin::loadLoginPage(); 101 LLPanelLogin::loadLoginPage();
102 } 102 }
103#endif
104 return true; 103 return true;
105 } 104 }
106}; 105};
@@ -329,7 +328,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
329 mCallbackData(cb_data), 328 mCallbackData(cb_data),
330 mHtmlAvailable( TRUE ) 329 mHtmlAvailable( TRUE )
331{ 330{
332 mIsFocusRoot = TRUE; 331 setFocusRoot(TRUE);
333 332
334 setBackgroundVisible(FALSE); 333 setBackgroundVisible(FALSE);
335 setBackgroundOpaque(TRUE); 334 setBackgroundOpaque(TRUE);
@@ -443,8 +442,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
443#endif 442#endif
444 443
445 // get the web browser control 444 // get the web browser control
446 #if LL_LIBXUL_ENABLED 445 LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html");
447 LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "login_html");
448 if ( web_browser ) 446 if ( web_browser )
449 { 447 {
450 // Need to handle login secondlife:///app/ URLs 448 // Need to handle login secondlife:///app/ URLs
@@ -461,28 +459,25 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
461 web_browser->setOpenInExternalBrowser( true ); 459 web_browser->setOpenInExternalBrowser( true );
462 460
463 // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) 461 // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through)
464 LLRect htmlRect = mRect; 462 LLRect htmlRect = getRect();
465#if USE_VIEWER_AUTH 463#if USE_VIEWER_AUTH
466 htmlRect.setCenterAndSize( mRect.getCenterX() - 2, mRect.getCenterY(), mRect.getWidth() + 6, mRect.getHeight()); 464 htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight());
467#else 465#else
468 htmlRect.setCenterAndSize( mRect.getCenterX() - 2, mRect.getCenterY() + 40, mRect.getWidth() + 6, mRect.getHeight() - 78 ); 466 htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 );
469#endif 467#endif
470 web_browser->setRect( htmlRect ); 468 web_browser->setRect( htmlRect );
471 web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); 469 web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE );
472 reshape( mRect.getWidth(), mRect.getHeight(), 1 ); 470 reshape( getRect().getWidth(), getRect().getHeight(), 1 );
473 471
474 // kick off a request to grab the url manually 472 // kick off a request to grab the url manually
475 gResponsePtr = LLIamHereLogin::build( this ); 473 gResponsePtr = LLIamHereLogin::build( this );
476 std::string login_page = LLAppViewer::instance()->getLoginPage(); 474 std::string login_page = LLAppViewer::instance()->getLoginPage();
477 if (login_page.empty()) 475 if (login_page.empty())
478 { 476 {
479 login_page = childGetValue( "real_url" ).asString(); 477 login_page = getString( "real_url" );
480 } 478 }
481 LLHTTPClient::head( login_page, gResponsePtr ); 479 LLHTTPClient::head( login_page, gResponsePtr );
482 }; 480 };
483 #else
484 mHtmlAvailable = FALSE;
485 #endif
486 481
487#if !USE_VIEWER_AUTH 482#if !USE_VIEWER_AUTH
488 // Initialize visibility (and don't force visibility - use prefs) 483 // Initialize visibility (and don't force visibility - use prefs)
@@ -493,8 +488,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
493 488
494void LLPanelLogin::setSiteIsAlive( bool alive ) 489void LLPanelLogin::setSiteIsAlive( bool alive )
495{ 490{
496#if LL_LIBXUL_ENABLED 491 LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html");
497 LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(this, "login_html");
498 // if the contents of the site was retrieved 492 // if the contents of the site was retrieved
499 if ( alive ) 493 if ( alive )
500 { 494 {
@@ -529,10 +523,6 @@ void LLPanelLogin::setSiteIsAlive( bool alive )
529 } 523 }
530#endif 524#endif
531 } 525 }
532
533#else
534 mHtmlAvailable = FALSE;
535#endif
536} 526}
537 527
538void LLPanelLogin::mungePassword(LLUICtrl* caller, void* user_data) 528void LLPanelLogin::mungePassword(LLUICtrl* caller, void* user_data)
@@ -571,16 +561,16 @@ void LLPanelLogin::draw()
571 glPushMatrix(); 561 glPushMatrix();
572 { 562 {
573 F32 image_aspect = 1.333333f; 563 F32 image_aspect = 1.333333f;
574 F32 view_aspect = (F32)mRect.getWidth() / (F32)mRect.getHeight(); 564 F32 view_aspect = (F32)getRect().getWidth() / (F32)getRect().getHeight();
575 // stretch image to maintain aspect ratio 565 // stretch image to maintain aspect ratio
576 if (image_aspect > view_aspect) 566 if (image_aspect > view_aspect)
577 { 567 {
578 glTranslatef(-0.5f * (image_aspect / view_aspect - 1.f) * mRect.getWidth(), 0.f, 0.f); 568 glTranslatef(-0.5f * (image_aspect / view_aspect - 1.f) * getRect().getWidth(), 0.f, 0.f);
579 glScalef(image_aspect / view_aspect, 1.f, 1.f); 569 glScalef(image_aspect / view_aspect, 1.f, 1.f);
580 } 570 }
581 571
582 S32 width = mRect.getWidth(); 572 S32 width = getRect().getWidth();
583 S32 height = mRect.getHeight(); 573 S32 height = getRect().getHeight();
584 574
585 if ( mHtmlAvailable ) 575 if ( mHtmlAvailable )
586 { 576 {
@@ -626,7 +616,6 @@ BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
626 return TRUE; 616 return TRUE;
627 } 617 }
628 618
629#if LL_LIBXUL_ENABLED
630 if ( KEY_F1 == key ) 619 if ( KEY_F1 == key )
631 { 620 {
632 llinfos << "Spawning HTML help window" << llendl; 621 llinfos << "Spawning HTML help window" << llendl;
@@ -642,7 +631,6 @@ BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
642 tos_dialog->startModal(); 631 tos_dialog->startModal();
643 return TRUE; 632 return TRUE;
644 } 633 }
645# endif
646#endif 634#endif
647 635
648 if (!called_from_parent) 636 if (!called_from_parent)
@@ -923,14 +911,12 @@ void LLPanelLogin::setAlwaysRefresh(bool refresh)
923{ 911{
924 if (LLStartUp::getStartupState() >= STATE_LOGIN_CLEANUP) return; 912 if (LLStartUp::getStartupState() >= STATE_LOGIN_CLEANUP) return;
925 913
926#if LL_LIBXUL_ENABLED 914 LLWebBrowserCtrl* web_browser = sInstance->getChild<LLWebBrowserCtrl>("login_html");
927 LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html");
928 915
929 if (web_browser) 916 if (web_browser)
930 { 917 {
931 web_browser->setAlwaysRefresh(refresh); 918 web_browser->setAlwaysRefresh(refresh);
932 } 919 }
933#endif
934} 920}
935 921
936 922
@@ -944,7 +930,7 @@ void LLPanelLogin::loadLoginPage()
944 std::string login_page = LLAppViewer::instance()->getLoginPage(); 930 std::string login_page = LLAppViewer::instance()->getLoginPage();
945 if (login_page.empty()) 931 if (login_page.empty())
946 { 932 {
947 login_page = sInstance->childGetValue( "real_url" ).asString(); 933 login_page = sInstance->getString( "real_url" );
948 } 934 }
949 oStr << login_page; 935 oStr << login_page;
950 936
@@ -1056,18 +1042,15 @@ void LLPanelLogin::loadLoginPage()
1056#endif 1042#endif
1057#endif 1043#endif
1058 1044
1059#if LL_LIBXUL_ENABLED 1045 LLWebBrowserCtrl* web_browser = sInstance->getChild<LLWebBrowserCtrl>("login_html");
1060 LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html");
1061 1046
1062 // navigate to the "real" page 1047 // navigate to the "real" page
1063 web_browser->navigateTo( oStr.str() ); 1048 web_browser->navigateTo( oStr.str() );
1064#endif
1065} 1049}
1066 1050
1067#if LL_LIBXUL_ENABLED
1068void LLPanelLogin::onNavigateComplete( const EventType& eventIn ) 1051void LLPanelLogin::onNavigateComplete( const EventType& eventIn )
1069{ 1052{
1070 LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html"); 1053 LLWebBrowserCtrl* web_browser = sInstance->getChild<LLWebBrowserCtrl>("login_html");
1071 if (web_browser) 1054 if (web_browser)
1072 { 1055 {
1073 // *HACK HACK HACK HACK! 1056 // *HACK HACK HACK HACK!
@@ -1080,7 +1063,6 @@ void LLPanelLogin::onNavigateComplete( const EventType& eventIn )
1080 //web_browser->handleKey(KEY_TAB, MASK_NONE, false); 1063 //web_browser->handleKey(KEY_TAB, MASK_NONE, false);
1081 } 1064 }
1082} 1065}
1083#endif
1084 1066
1085//--------------------------------------------------------------------------- 1067//---------------------------------------------------------------------------
1086// Protected methods 1068// Protected methods
@@ -1181,7 +1163,7 @@ void LLPanelLogin::onClickForgotPassword(void*)
1181{ 1163{
1182 if (sInstance ) 1164 if (sInstance )
1183 { 1165 {
1184 LLWeb::loadURL(sInstance->childGetValue( "forgot_password_url" ).asString()); 1166 LLWeb::loadURL(sInstance->getString( "forgot_password_url" ));
1185 } 1167 }
1186} 1168}
1187 1169