diff options
author | McCabe Maxsted | 2009-10-18 17:58:27 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-10-18 17:58:27 -0700 |
commit | e4b0e7c82d670081c071d8a3da31b5ec407b8e07 (patch) | |
tree | 9410962bbb582eedbec448139e217f2714050777 /linden/indra/newview/llpanellogin.cpp | |
parent | Started 1.3.0 branch (diff) | |
parent | Updated and added some Linux libs. (diff) | |
download | meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.zip meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.gz meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.bz2 meta-impy-e4b0e7c82d670081c071d8a3da31b5ec407b8e07.tar.xz |
Merged working branch of 1.2 into LL 1.23 merge
Diffstat (limited to 'linden/indra/newview/llpanellogin.cpp')
-rw-r--r-- | linden/indra/newview/llpanellogin.cpp | 159 |
1 files changed, 104 insertions, 55 deletions
diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp index 8bb7152..feb85a7 100644 --- a/linden/indra/newview/llpanellogin.cpp +++ b/linden/indra/newview/llpanellogin.cpp | |||
@@ -36,6 +36,9 @@ | |||
36 | 36 | ||
37 | #include "llpanelgeneral.h" | 37 | #include "llpanelgeneral.h" |
38 | 38 | ||
39 | #include "hippoGridManager.h" | ||
40 | #include "floaterlogin.h" | ||
41 | |||
39 | #include "indra_constants.h" // for key and mask constants | 42 | #include "indra_constants.h" // for key and mask constants |
40 | #include "llfontgl.h" | 43 | #include "llfontgl.h" |
41 | #include "llmd5.h" | 44 | #include "llmd5.h" |
@@ -65,17 +68,24 @@ | |||
65 | #include "llviewernetwork.h" | 68 | #include "llviewernetwork.h" |
66 | #include "llviewerwindow.h" // to link into child list | 69 | #include "llviewerwindow.h" // to link into child list |
67 | #include "llnotify.h" | 70 | #include "llnotify.h" |
71 | #include "llappviewer.h" // for gHideLinks | ||
68 | #include "llurlsimstring.h" | 72 | #include "llurlsimstring.h" |
69 | #include "lluictrlfactory.h" | 73 | #include "lluictrlfactory.h" |
70 | #include "llhttpclient.h" | 74 | #include "llhttpclient.h" |
71 | #include "llweb.h" | 75 | #include "llweb.h" |
72 | #include "llwebbrowserctrl.h" | 76 | #include "llwebbrowserctrl.h" |
73 | 77 | ||
78 | #include "llfloaterhtml.h" | ||
79 | |||
74 | #include "llfloaterhtmlhelp.h" | 80 | #include "llfloaterhtmlhelp.h" |
75 | #include "llfloatertos.h" | 81 | #include "llfloatertos.h" |
76 | 82 | ||
77 | #include "llglheaders.h" | 83 | #include "llglheaders.h" |
78 | 84 | ||
85 | // [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-08 (RLVa-1.0.0e) | ||
86 | #include "rlvhandler.h" | ||
87 | // [/RLVa:KB] | ||
88 | |||
79 | #define USE_VIEWER_AUTH 0 | 89 | #define USE_VIEWER_AUTH 0 |
80 | 90 | ||
81 | const S32 BLACK_BORDER_HEIGHT = 160; | 91 | const S32 BLACK_BORDER_HEIGHT = 160; |
@@ -152,11 +162,6 @@ namespace { | |||
152 | boost::intrusive_ptr< LLIamHereLogin > gResponsePtr = 0; | 162 | boost::intrusive_ptr< LLIamHereLogin > gResponsePtr = 0; |
153 | }; | 163 | }; |
154 | 164 | ||
155 | void set_start_location(LLUICtrl* ctrl, void* data) | ||
156 | { | ||
157 | LLURLSimString::setString(ctrl->getValue().asString()); | ||
158 | } | ||
159 | |||
160 | //--------------------------------------------------------------------------- | 165 | //--------------------------------------------------------------------------- |
161 | // Public methods | 166 | // Public methods |
162 | //--------------------------------------------------------------------------- | 167 | //--------------------------------------------------------------------------- |
@@ -243,13 +248,13 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
243 | combo->setCurrentByIndex( 0 ); | 248 | combo->setCurrentByIndex( 0 ); |
244 | } | 249 | } |
245 | 250 | ||
246 | combo->setCommitCallback( &set_start_location ); | ||
247 | 251 | ||
248 | LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo"); | 252 | LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo"); |
249 | server_choice_combo->setCommitCallback(onSelectServer); | 253 | server_choice_combo->setCommitCallback(onSelectServer); |
250 | server_choice_combo->setFocusLostCallback(onServerComboLostFocus); | 254 | //server_choice_combo->setFocusLostCallback(onServerComboLostFocus); |
251 | 255 | ||
252 | childSetAction("connect_btn", onClickConnect, this); | 256 | childSetAction("connect_btn", onClickConnect, this); |
257 | childSetAction("grid_btn", onClickGrid, this); | ||
253 | 258 | ||
254 | setDefaultBtn("connect_btn"); | 259 | setDefaultBtn("connect_btn"); |
255 | 260 | ||
@@ -551,6 +556,7 @@ void LLPanelLogin::show(const LLRect &rect, | |||
551 | 556 | ||
552 | // Make sure that focus always goes here (and use the latest sInstance that was just created) | 557 | // Make sure that focus always goes here (and use the latest sInstance that was just created) |
553 | gFocusMgr.setDefaultKeyboardFocus(sInstance); | 558 | gFocusMgr.setDefaultKeyboardFocus(sInstance); |
559 | LLPanelLogin::addServer(LLViewerLogin::getInstance()->getGridLabel()); | ||
554 | } | 560 | } |
555 | 561 | ||
556 | // static | 562 | // static |
@@ -594,7 +600,7 @@ void LLPanelLogin::setFields(const std::string& firstname, | |||
594 | 600 | ||
595 | 601 | ||
596 | // static | 602 | // static |
597 | void LLPanelLogin::addServer(const std::string& server, S32 domain_name) | 603 | void LLPanelLogin::addServer(const std::string& server) |
598 | { | 604 | { |
599 | if (!sInstance) | 605 | if (!sInstance) |
600 | { | 606 | { |
@@ -602,17 +608,29 @@ void LLPanelLogin::addServer(const std::string& server, S32 domain_name) | |||
602 | return; | 608 | return; |
603 | } | 609 | } |
604 | 610 | ||
605 | LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); | 611 | const std::string &defaultGrid = gHippoGridManager->getDefaultGridNick(); |
606 | combo->add(server, LLSD(domain_name) ); | ||
607 | combo->setCurrentByIndex(0); | ||
608 | } | ||
609 | 612 | ||
613 | LLComboBox *grids = sInstance->getChild<LLComboBox>("server_combo"); | ||
614 | S32 selectIndex = -1, i = 0; | ||
615 | grids->removeall(); | ||
616 | if (defaultGrid != "") { | ||
617 | grids->add(defaultGrid); | ||
618 | selectIndex = i++; | ||
619 | } | ||
620 | HippoGridManager::GridIterator it, end = gHippoGridManager->endGrid(); | ||
621 | for (it = gHippoGridManager->beginGrid(); it != end; ++it) { | ||
622 | const std::string &grid = it->second->getGridNick(); | ||
623 | if (grid != defaultGrid) { | ||
624 | grids->add(grid); | ||
625 | //if (grid == mCurGrid) selectIndex = i; | ||
626 | i++; | ||
627 | } | ||
628 | } | ||
629 | grids->setCurrentByIndex(0); | ||
610 | 630 | ||
611 | // static | 631 | //LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); |
612 | void LLPanelLogin::setServer(S32 domain_name) | 632 | //combo->add(server, LLSD(domain_name) ); |
613 | { | 633 | //combo->setCurrentByIndex(0); |
614 | LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); | ||
615 | combo->setCurrentByIndex(domain_name); | ||
616 | } | 634 | } |
617 | 635 | ||
618 | // static | 636 | // static |
@@ -690,10 +708,27 @@ void LLPanelLogin::refreshLocation( bool force_visible ) | |||
690 | if ( ! force_visible ) | 708 | if ( ! force_visible ) |
691 | show_start = gSavedSettings.getBOOL("ShowStartLocation"); | 709 | show_start = gSavedSettings.getBOOL("ShowStartLocation"); |
692 | 710 | ||
711 | |||
712 | // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | ||
713 | // TODO-RLVa: figure out some way to make this work with RLV_EXTENSION_STARTLOCATION | ||
714 | #ifndef RLV_EXTENSION_STARTLOCATION | ||
715 | if (rlv_handler_t::isEnabled()) | ||
716 | { | ||
717 | show_start = FALSE; | ||
718 | } | ||
719 | #endif // RLV_EXTENSION_STARTLOCATION | ||
720 | // [/RLVa:KB] | ||
721 | |||
722 | |||
693 | sInstance->childSetVisible("start_location_combo", show_start); | 723 | sInstance->childSetVisible("start_location_combo", show_start); |
694 | sInstance->childSetVisible("start_location_text", show_start); | 724 | sInstance->childSetVisible("start_location_text", show_start); |
695 | 725 | ||
726 | /*#if LL_RELEASE_FOR_DOWNLOAD | ||
727 | BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid"); | ||
728 | sInstance->childSetVisible("server_combo", show_server); | ||
729 | #else*/ | ||
696 | sInstance->childSetVisible("server_combo", TRUE); | 730 | sInstance->childSetVisible("server_combo", TRUE); |
731 | //#endif | ||
697 | 732 | ||
698 | #endif | 733 | #endif |
699 | } | 734 | } |
@@ -726,18 +761,39 @@ void LLPanelLogin::setAlwaysRefresh(bool refresh) | |||
726 | } | 761 | } |
727 | 762 | ||
728 | 763 | ||
764 | // static | ||
765 | void LLPanelLogin::refreshLoginPage() | ||
766 | { | ||
767 | if (!sInstance) return; | ||
768 | |||
769 | sInstance->childSetVisible("create_new_account_text", | ||
770 | !gHippoGridManager->getConnectedGrid()->getRegisterUrl().empty()); | ||
771 | sInstance->childSetVisible("forgot_password_text", | ||
772 | !gHippoGridManager->getConnectedGrid()->getPasswordUrl().empty()); | ||
773 | |||
774 | // kick off a request to grab the url manually | ||
775 | gResponsePtr = LLIamHereLogin::build(sInstance); | ||
776 | std::string login_page = gHippoGridManager->getConnectedGrid()->getLoginPage(); | ||
777 | if (!login_page.empty()) { | ||
778 | LLHTTPClient::head(login_page, gResponsePtr); | ||
779 | } else { | ||
780 | sInstance->setSiteIsAlive(false); | ||
781 | } | ||
782 | } | ||
783 | |||
729 | 784 | ||
730 | void LLPanelLogin::loadLoginPage() | 785 | void LLPanelLogin::loadLoginPage() |
731 | { | 786 | { |
732 | if (!sInstance) return; | 787 | if (!sInstance) return; |
733 | 788 | ||
734 | std::ostringstream oStr; | ||
735 | 789 | ||
736 | std::string login_page = gSavedSettings.getString("LoginPage"); | 790 | std::string login_page = gHippoGridManager->getConnectedGrid()->getLoginPage(); |
737 | if (login_page.empty()) | 791 | if (login_page.empty()) { |
738 | { | 792 | sInstance->setSiteIsAlive(false); |
739 | login_page = sInstance->getString( "real_url" ); | 793 | return; |
740 | } | 794 | } |
795 | |||
796 | std::ostringstream oStr; | ||
741 | oStr << login_page; | 797 | oStr << login_page; |
742 | 798 | ||
743 | // Use the right delimeter depending on how LLURI parses the URL | 799 | // Use the right delimeter depending on how LLURI parses the URL |
@@ -772,11 +828,12 @@ void LLPanelLogin::loadLoginPage() | |||
772 | curl_free(curl_version); | 828 | curl_free(curl_version); |
773 | 829 | ||
774 | // Grid | 830 | // Grid |
775 | char* curl_grid = curl_escape(LLViewerLogin::getInstance()->getGridCodeName().c_str(), 0); | 831 | char* curl_grid = curl_escape(LLViewerLogin::getInstance()->getGridLabel().c_str(), 0); |
776 | oStr << "&grid=" << curl_grid; | 832 | oStr << "&grid=" << curl_grid; |
777 | curl_free(curl_grid); | 833 | curl_free(curl_grid); |
778 | 834 | ||
779 | gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid()); | 835 | gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid()); |
836 | //LLViewerLogin::getInstance()->setMenuColor(); | ||
780 | gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor()); | 837 | gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor()); |
781 | 838 | ||
782 | 839 | ||
@@ -915,7 +972,15 @@ void LLPanelLogin::onClickConnect(void *) | |||
915 | } | 972 | } |
916 | } | 973 | } |
917 | } | 974 | } |
975 | } | ||
918 | 976 | ||
977 | void LLPanelLogin::onClickGrid(void *) | ||
978 | { | ||
979 | if (sInstance && sInstance->mCallback) | ||
980 | { | ||
981 | LoginFloater::newShow(std::string("Test"), false); | ||
982 | } | ||
983 | } | ||
919 | 984 | ||
920 | // static | 985 | // static |
921 | bool LLPanelLogin::newAccountAlertCallback(const LLSD& notification, const LLSD& response) | 986 | bool LLPanelLogin::newAccountAlertCallback(const LLSD& notification, const LLSD& response) |
@@ -983,7 +1048,7 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) | |||
983 | } | 1048 | } |
984 | 1049 | ||
985 | // static | 1050 | // static |
986 | void LLPanelLogin::onSelectServer(LLUICtrl*, void*) | 1051 | void LLPanelLogin::onSelectServer(LLUICtrl* ctrl, void*) |
987 | { | 1052 | { |
988 | // *NOTE: The paramters for this method are ignored. | 1053 | // *NOTE: The paramters for this method are ignored. |
989 | // LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) | 1054 | // LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) |
@@ -992,46 +1057,29 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*) | |||
992 | // The user twiddled with the grid choice ui. | 1057 | // The user twiddled with the grid choice ui. |
993 | // apply the selection to the grid setting. | 1058 | // apply the selection to the grid setting. |
994 | std::string grid_label; | 1059 | std::string grid_label; |
995 | S32 grid_index; | 1060 | //S32 grid_index; |
996 | 1061 | ||
997 | LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); | 1062 | LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); |
998 | LLSD combo_val = combo->getValue(); | 1063 | LLSD combo_val = combo->getValue(); |
999 | 1064 | ||
1000 | if (LLSD::TypeInteger == combo_val.type()) | 1065 | std::string mCurGrid = ctrl->getValue().asString(); |
1001 | { | 1066 | //KOW |
1002 | grid_index = combo->getValue().asInteger(); | 1067 | gHippoGridManager->setCurrentGrid(mCurGrid); |
1003 | 1068 | // HippoGridInfo *gridInfo = gHippoGridManager->getGrid(mCurGrid); | |
1004 | if ((S32)GRID_INFO_OTHER == grid_index) | 1069 | // if (gridInfo) { |
1005 | { | 1070 | // //childSetText("gridnick", gridInfo->getGridNick()); |
1006 | // This happens if the user specifies a custom grid | 1071 | // //platform->setCurrentByIndex(gridInfo->getPlatform()); |
1007 | // via command line. | 1072 | // //childSetText("gridname", gridInfo->getGridName()); |
1008 | grid_label = combo->getSimple(); | 1073 | // LLPanelLogin::setFields( gridInfo->getFirstName(), gridInfo->getLastName(), gridInfo->getAvatarPassword(), 1 ); |
1009 | } | 1074 | // } |
1010 | } | ||
1011 | else | ||
1012 | { | ||
1013 | // no valid selection, return other | ||
1014 | grid_index = (S32)GRID_INFO_OTHER; | ||
1015 | grid_label = combo_val.asString(); | ||
1016 | } | ||
1017 | 1075 | ||
1018 | // This new seelction will override preset uris | 1076 | |
1019 | // from the command line. | 1077 | llwarns << "current grid = " << mCurGrid << llendl; |
1020 | LLViewerLogin* vl = LLViewerLogin::getInstance(); | ||
1021 | vl->resetURIs(); | ||
1022 | if(grid_index != GRID_INFO_OTHER) | ||
1023 | { | ||
1024 | vl->setGridChoice((EGridInfo)grid_index); | ||
1025 | } | ||
1026 | else | ||
1027 | { | ||
1028 | vl->setGridChoice(grid_label); | ||
1029 | } | ||
1030 | 1078 | ||
1031 | // grid changed so show new splash screen (possibly) | 1079 | // grid changed so show new splash screen (possibly) |
1032 | loadLoginPage(); | 1080 | loadLoginPage(); |
1033 | } | 1081 | } |
1034 | 1082 | /* | |
1035 | void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) | 1083 | void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) |
1036 | { | 1084 | { |
1037 | LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); | 1085 | LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); |
@@ -1040,3 +1088,4 @@ void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*) | |||
1040 | onSelectServer(combo, NULL); | 1088 | onSelectServer(combo, NULL); |
1041 | } | 1089 | } |
1042 | } | 1090 | } |
1091 | */ | ||