Skip to content
Snippets Groups Projects
Commit 652247dc authored by Oz Linden's avatar Oz Linden
Browse files

PATH-805: guard all uses of sInstance in LLPanelLogin

parent e8f0e006
No related branches found
No related tags found
No related merge requests found
...@@ -405,16 +405,19 @@ void LLPanelLogin::giveFocus() ...@@ -405,16 +405,19 @@ void LLPanelLogin::giveFocus()
// static // static
void LLPanelLogin::showLoginWidgets() void LLPanelLogin::showLoginWidgets()
{ {
// *NOTE: Mani - This may or may not be obselete code. if (sInstance)
// It seems to be part of the defunct? reg-in-client project. {
sInstance->getChildView("login_widgets")->setVisible( true); // *NOTE: Mani - This may or may not be obselete code.
LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html"); // It seems to be part of the defunct? reg-in-client project.
sInstance->reshapeBrowser(); sInstance->getChildView("login_widgets")->setVisible( true);
// *TODO: Append all the usual login parameters, like first_login=Y etc. LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
std::string splash_screen_url = LLGridManager::getInstance()->getLoginPage(); sInstance->reshapeBrowser();
web_browser->navigateTo( splash_screen_url, "text/html" ); // *TODO: Append all the usual login parameters, like first_login=Y etc.
LLUICtrl* username_combo = sInstance->getChild<LLUICtrl>("username_combo"); std::string splash_screen_url = LLGridManager::getInstance()->getLoginPage();
username_combo->setFocus(TRUE); web_browser->navigateTo( splash_screen_url, "text/html" );
LLUICtrl* username_combo = sInstance->getChild<LLUICtrl>("username_combo");
username_combo->setFocus(TRUE);
}
} }
// static // static
...@@ -691,13 +694,14 @@ void LLPanelLogin::closePanel() ...@@ -691,13 +694,14 @@ void LLPanelLogin::closePanel()
// static // static
void LLPanelLogin::setAlwaysRefresh(bool refresh) void LLPanelLogin::setAlwaysRefresh(bool refresh)
{ {
if (LLStartUp::getStartupState() >= STATE_LOGIN_CLEANUP) return; if (sInstance && LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
if (web_browser)
{ {
web_browser->setAlwaysRefresh(refresh); LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
if (web_browser)
{
web_browser->setAlwaysRefresh(refresh);
}
} }
} }
...@@ -768,21 +772,6 @@ void LLPanelLogin::loadLoginPage() ...@@ -768,21 +772,6 @@ void LLPanelLogin::loadLoginPage()
void LLPanelLogin::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent event) void LLPanelLogin::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent event)
{ {
if(event == MEDIA_EVENT_NAVIGATE_COMPLETE)
{
LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
if (web_browser)
{
// *HACK HACK HACK HACK!
/* Stuff a Tab key into the browser now so that the first field will
** get the focus! The embedded javascript on the page that properly
** sets the initial focus in a real web browser is not working inside
** the viewer, so this is an UGLY HACK WORKAROUND for now.
*/
// Commented out as it's not reliable
//web_browser->handleKey(KEY_TAB, MASK_NONE, false);
}
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -859,7 +848,10 @@ void LLPanelLogin::onClickConnect(void *) ...@@ -859,7 +848,10 @@ void LLPanelLogin::onClickConnect(void *)
// static // static
void LLPanelLogin::onClickNewAccount(void*) void LLPanelLogin::onClickNewAccount(void*)
{ {
LLWeb::loadURLExternal(sInstance->getString("create_account_url")); if (sInstance)
{
LLWeb::loadURLExternal(sInstance->getString("create_account_url"));
}
} }
...@@ -895,7 +887,7 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) ...@@ -895,7 +887,7 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
This->mPasswordModified = TRUE; This->mPasswordModified = TRUE;
if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE) if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE)
{ {
// *TODO: use another way to notify user about enabled caps lock, see EXT-6858 // *TODO: use another way to notify user about enabled caps lock, see EXT-6858
sCapslockDidNotification = TRUE; sCapslockDidNotification = TRUE;
} }
} }
...@@ -903,33 +895,36 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) ...@@ -903,33 +895,36 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
void LLPanelLogin::updateServer() void LLPanelLogin::updateServer()
{ {
try if (sInstance)
{ {
// if they've selected another grid, we should load the credentials try
// for that grid and set them to the UI.
if(sInstance && !sInstance->areCredentialFieldsDirty())
{ {
LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); // if they've selected another grid, we should load the credentials
bool remember = sInstance->getChild<LLUICtrl>("remember_check")->getValue(); // for that grid and set them to the UI.
sInstance->setFields(credential, remember); if(!sInstance->areCredentialFieldsDirty())
} {
LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
bool remember = sInstance->getChild<LLUICtrl>("remember_check")->getValue();
sInstance->setFields(credential, remember);
}
// update the login panel links // update the login panel links
bool system_grid = LLGridManager::getInstance()->isSystemGrid(); bool system_grid = LLGridManager::getInstance()->isSystemGrid();
sInstance->getChildView("create_new_account_text")->setVisible( system_grid); sInstance->getChildView("create_new_account_text")->setVisible( system_grid);
sInstance->getChildView("forgot_password_text")->setVisible( system_grid); sInstance->getChildView("forgot_password_text")->setVisible( system_grid);
// grid changed so show new splash screen (possibly) // grid changed so show new splash screen (possibly)
loadLoginPage(); loadLoginPage();
} }
catch (LLInvalidGridName ex) catch (LLInvalidGridName ex)
{ {
LL_WARNS("AppInit")<<"server '"<<ex.name()<<"' selection failed"<<LL_ENDL; LL_WARNS("AppInit")<<"server '"<<ex.name()<<"' selection failed"<<LL_ENDL;
LLSD args; LLSD args;
args["GRID"] = ex.name(); args["GRID"] = ex.name();
LLNotificationsUtil::add("InvalidGrid", args); LLNotificationsUtil::add("InvalidGrid", args);
return; return;
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment