Exemplo n.º 1
0
// static
void LLPanelLogin::onSelectSavedLogin(LLUICtrl*, void*)
{
	// *NOTE: The paramters for this method are ignored. 
	LL_INFOS("AppInit") << "onSelectSavedLogin" << LL_ENDL;

	
	LLComboBox* combo = sInstance->getChild<LLComboBox>("username_combo");
	LLSD combo_val = combo->getSelectedValue();
	if (combo_val.isUndefined())
	{
		combo_val = combo->getValue();
	}

	
	std::string credName = combo_val.asString();
	
	if(combo_val.asString().find("@")<0)		
		return;


	// if they've selected another grid, we should load the credentials
	// for that grid and set them to the UI.
	if(sInstance)
	{
		LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(credName);
		if(credential->getIdentifier()["first_name"].asString().size()<=0 && credential->getIdentifier()["account_name"].asString().size()<=0 ) return;
		LLSD authenticator = credential->getAuthenticator();
		sInstance->setFields(credential);
	}

}
Exemplo n.º 2
0
void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData)
{
    // get the time
    LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>(
                               "WLKeyPresets");
    LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
                                  "WLDayCycleKeys");

    // do nothing if no sliders
    if(sldr->getValue().size() == 0) {
        return;
    }

    // change the map
    std::string newPreset(comboBox->getSelectedValue().asString());
    const std::string& curSldr = sldr->getCurSlider();

    // if null, don't use
    if(curSldr == "") {
        return;
    }

    sSliderToKey[curSldr].presetName = newPreset;

    syncTrack();
}
void LLFloaterPostProcess::onChangeEffectName(LLUICtrl* ctrl, void * userData)
{
	// get the combo box and name
	LLComboBox * comboBox = static_cast<LLComboBox*>(ctrl);
	LLLineEditor* editBox = sPostProcess->getChild<LLLineEditor>("PPEffectNameEditor");

	// set the parameter's new name
	editBox->setValue(comboBox->getSelectedValue());
}
void LLFloaterPostProcess::onLoadEffect(void* userData)
{
	LLComboBox* comboBox = static_cast<LLComboBox*>(userData);

	LLSD::String effectName(comboBox->getSelectedValue().asString());

	gPostProcess->setSelectedEffect(effectName);

	sPostProcess->syncMenu();
}
Exemplo n.º 5
0
// static
void LLPanelLogin::onSelectLoginEntry(LLUICtrl* ctrl, void* data)
{
	if (sInstance)
	{
		LLComboBox* combo = sInstance->getChild<LLComboBox>("name_combo");
		if (ctrl == combo)
		{
			LLSD selected_entry = combo->getSelectedValue();
			if (!selected_entry.isUndefined())
			{
				LLSavedLoginEntry entry(selected_entry);
				setFields(entry);
			}
			// This stops the automatic matching of the first name to a selected grid.
			LLViewerLogin::getInstance()->setNameEditted(true);
		}
	}
}
Exemplo n.º 6
0
void LLFloaterDayCycle::onAddKey(void* userData)
{
	LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>( 
		"WLKeyPresets");
	LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>( 
		"WLDayCycleKeys");
	LLMultiSliderCtrl* tSldr = sDayCycle->getChild<LLMultiSliderCtrl>( 
		"WLTimeSlider");
	
	llassert_always(sSliderToKey.size() == kSldr->getValue().size());

	// get the values
	std::string newPreset(comboBox->getSelectedValue().asString());

	// add the slider key
	addSliderKey(tSldr->getCurSliderValue(), newPreset);

	syncTrack();
}
Exemplo n.º 7
0
//static
void LLPrefsAscentVan::onManualClientUpdate(void* data)
{
	LLPrefsAscentVan* self = (LLPrefsAscentVan*)data;
	std::string client_uuid;
	U32 client_index;
	//Colors ------------------------------------------------------------------------------
	LLComboBox* combo = self->getChild<LLComboBox>("tag_spoofing_combobox");
	if (combo)
	{
		client_index = combo->getCurrentIndex();
		//Don't rebake if it's not neccesary.
		if (client_index != gSavedSettings.getU32("AscentReportClientIndex"))
		{
			client_uuid = combo->getSelectedValue().asString();
			gSavedSettings.setString("AscentReportClientUUID",  client_uuid);
			gSavedSettings.setU32("AscentReportClientIndex",  client_index);
			LLVOAvatar* avatar = gAgent.getAvatarObject();
			if (!avatar) return;

			gAgent.sendAgentSetAppearance();
		}
	}

    LLChat chat;
    chat.mSourceType = CHAT_SOURCE_SYSTEM;
    chat.mText = llformat("Definitions already up-to-date.");
    if (LLVOAvatar::updateClientTags())
    {
        chat.mText = llformat("Client definitions updated.");
        LLVOAvatar::loadClientTags();
        for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
        iter != LLCharacter::sInstances.end(); ++iter)
        {
            LLVOAvatar* avatarp = (LLVOAvatar*) *iter;
            if(avatarp)
            {
                LLVector3 root_pos_last = avatarp->mRoot.getWorldPosition();
                avatarp->mClientTag = "";
            }
        }
    }
    LLFloaterChat::addChat(chat);
}
Exemplo n.º 8
0
void LLPrefsAscentVan::onCommitClientTag(LLUICtrl* ctrl)
{
    std::string client_uuid;
    U32 client_index;

	LLComboBox* combo = static_cast<LLComboBox*>(ctrl);

	client_index = combo->getCurrentIndex();
	//Don't rebake if it's not neccesary.
	if (client_index != mSelectedClient)
	{
		client_uuid = combo->getSelectedValue().asString();
		gSavedSettings.setString("AscentReportClientUUID",  client_uuid);
		gSavedSettings.setU32("AscentReportClientIndex",  client_index);

		if (gAgentAvatarp)
		{
			// Slam pending upload count to "unstick" things
			bool slam_for_debug = true;
			gAgentAvatarp->forceBakeAllTextures(slam_for_debug);
		}
	}
}
// static
void LLFloaterReporter::onClickSend(void *userdata)
{
	LLFloaterReporter *self = (LLFloaterReporter *)userdata;
	
	if (self->mPicking)
	{
		closePickTool(self);
	}

	if(self->validateReport())
	{
		const int IP_CONTENT_REMOVAL = 66;
		const int IP_PERMISSONS_EXPLOIT = 37;
		LLComboBox* combo = self->getChild<LLComboBox>( "category_combo");
		int category_value = combo->getSelectedValue().asInteger();

		if ( ! self->mCopyrightWarningSeen )
		{
			std::string details_lc = self->getChild<LLUICtrl>("details_edit")->getValue().asString();
			LLStringUtil::toLower( details_lc );
			std::string summary_lc = self->getChild<LLUICtrl>("summary_edit")->getValue().asString();
			LLStringUtil::toLower( summary_lc );
			if ( details_lc.find( "copyright" ) != std::string::npos ||
				summary_lc.find( "copyright" ) != std::string::npos  ||
				category_value == IP_CONTENT_REMOVAL ||
				category_value == IP_PERMISSONS_EXPLOIT)
			{
				LLNotificationsUtil::add("HelpReportAbuseContainsCopyright");
				self->mCopyrightWarningSeen = TRUE;
				return;
			}
		}
		else if (category_value == IP_CONTENT_REMOVAL)
		{
			// IP_CONTENT_REMOVAL *always* shows the dialog -
			// ergo you can never send that abuse report type.
			LLNotificationsUtil::add("HelpReportAbuseContainsCopyright");
			return;
		}

		LLUploadDialog::modalUploadDialog(LLTrans::getString("uploading_abuse_report"));
		// *TODO don't upload image if checkbox isn't checked
		std::string url = gAgent.getRegion()->getCapability("SendUserReport");
		std::string sshot_url = gAgent.getRegion()->getCapability("SendUserReportWithScreenshot");
		if(!url.empty() || !sshot_url.empty())
		{
			self->sendReportViaCaps(url, sshot_url, self->gatherReport());
			self->close();
		}
		else
		{
			if(self->getChild<LLUICtrl>("screen_check")->getValue())
			{
				self->getChildView("send_btn")->setEnabled(FALSE);
				self->getChildView("cancel_btn")->setEnabled(FALSE);
				// the callback from uploading the image calls sendReportViaLegacy()
				self->uploadImage();
			}
			else
			{
				self->sendReportViaLegacy(self->gatherReport());
				LLUploadDialog::modalUploadFinished();
				self->close();
			}
		}
	}
}
// static
void FSPanelLogin::onClickConnect(void *)
{
	if (sInstance && sInstance->mCallback)
	{
		// JC - Make sure the fields all get committed.
		sInstance->setFocus(FALSE);

		LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
		LLSD combo_val = combo->getSelectedValue();

		// the grid definitions may come from a user-supplied grids.xml, so they may not be good
		LL_DEBUGS("AppInit")<<"grid "<<combo_val.asString()<<LL_ENDL;
		try
		{
			LLGridManager::getInstance()->setGridChoice(combo_val.asString());
		}
		catch (LLInvalidGridName ex)
		{
			LLSD args;
			args["GRID"] = ex.name();
			LLNotificationsUtil::add("InvalidGrid", args);
			return;
		}

		// The start location SLURL has already been sent to LLStartUp::setStartSLURL

		std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
		gSavedSettings.setString("UserLoginInfo", credentialName()); // <FS:CR>

		LLSD blocked = FSData::instance().allowedLogin();
		if (!blocked.isMap()) //hack for testing for an empty LLSD
		{
			if(username.empty())
			{
				// user must type in something into the username field
				LLSD args;
				args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
				LLNotificationsUtil::add("MustHaveAccountToLogIn", args);
			}
			else
			{
				LLPointer<LLCredential> cred;
				BOOL remember;
				getFields(cred, remember);
				std::string identifier_type;
				cred->identifierType(identifier_type);
				LLSD allowed_credential_types;
				LLGridManager::getInstance()->getLoginIdentifierTypes(allowed_credential_types);
			
				// check the typed in credential type against the credential types expected by the server.
				for(LLSD::array_iterator i = allowed_credential_types.beginArray();
					i != allowed_credential_types.endArray();
					i++)
				{
				
					if(i->asString() == identifier_type)
					{
						// yay correct credential type
						sInstance->mCallback(0, sInstance->mCallbackData);
						return;
					}
				}
			
				// Right now, maingrid is the only thing that is picky about
				// credential format, as it doesn't yet allow account (single username)
				// format creds.  - Rox.  James, we wanna fix the message when we change
				// this.
				LLNotificationsUtil::add("InvalidCredentialFormat");
			}
		}
		else
		{
			LLNotificationsUtil::add("BlockLoginInfo", blocked);
		}
	}
}
void FSPanelLogin::onSelectUser()
{
	LL_INFOS("AppInit") << "onSelectUser()" << LL_ENDL;
	
	if (!sInstance)
	{
		return;
	}

	LLComboBox* combo = sInstance->getChild<LLComboBox>("username_combo");

	if (combo->getValue().asString() == sInstance->mPreviousUsername)
	{
		return;
	}

	LLSD combo_val = combo->getSelectedValue();
	if (combo_val.isUndefined())
	{
		// Previously unknown username was entered
		if (!sInstance->mPasswordModified)
		{
			// Clear password unless manually entered
			sInstance->getChild<LLLineEditor>("password_edit")->clear();
		}
		sInstance->addFavoritesToStartLocation();
		sInstance->mPreviousUsername = combo->getValue().asString();
		sInstance->getChild<LLButton>("remove_user_btn")->setEnabled(FALSE);
		return;
	}

	// Saved username was either selected or entered; continue...
	const std::string cred_name = combo_val.asString();

	LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(cred_name);
	sInstance->setFields(credential);
	sInstance->mPasswordModified = FALSE;
	sInstance->getChild<LLButton>("remove_user_btn")->setEnabled(TRUE);

	size_t arobase = cred_name.find("@");
	if (arobase != std::string::npos && arobase + 1 < cred_name.length())
	{
		const std::string grid_name = cred_name.substr(arobase + 1, cred_name.length() - arobase - 1);

		// Grid has changed - set new grid and update server combo
		if (LLGridManager::getInstance()->getGrid() != grid_name)
		{
			try
			{
				LLGridManager::getInstance()->setGridChoice(grid_name);
			}
			catch (LLInvalidGridName ex)
			{
				LL_WARNS("AppInit") << "Could not set grid '" << ex.name() << "'" << LL_ENDL;
			}
			updateServer();
		}
	}

	sInstance->addFavoritesToStartLocation();
}
Exemplo n.º 12
0
// static
void LLPanelLogin::onClickConnect(void *)
{
	if (sInstance && sInstance->mCallback)
	{
		// tell the responder we're not here anymore
		if ( gResponsePtr )
			gResponsePtr->setParent( 0 );

		// JC - Make sure the fields all get committed.
		sInstance->setFocus(FALSE);

		LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
		LLSD combo_val = combo->getSelectedValue();
		if (combo_val.isUndefined())
		{
			combo_val = combo->getValue();
		}
		if(combo_val.isUndefined())
		{
			LLNotificationsUtil::add("StartRegionEmpty");
			return;
		}		
		try
		{
			LLGridManager::getInstance()->setGridChoice(combo_val.asString());
		}
		catch (LLInvalidGridName ex)
		{
			LLSD args;
			args["GRID"] = combo_val.asString();
			LLNotificationsUtil::add("InvalidGrid", args);
			return;
		}
		updateStartSLURL();
		std::string username = sInstance->getChild<LLUICtrl>("username_edit")->getValue().asString();

		
		if(username.empty())
		{
			// user must type in something into the username field
			LLNotificationsUtil::add("MustHaveAccountToLogIn");
		}
		else
		{
			LLPointer<LLCredential> cred;
			BOOL remember;
			getFields(cred, remember);
			std::string identifier_type;
			cred->identifierType(identifier_type);
			LLSD allowed_credential_types;
			LLGridManager::getInstance()->getLoginIdentifierTypes(allowed_credential_types);
			
			// check the typed in credential type against the credential types expected by the server.
			for(LLSD::array_iterator i = allowed_credential_types.beginArray();
				i != allowed_credential_types.endArray();
				i++)
			{
				
				if(i->asString() == identifier_type)
				{
					// yay correct credential type
					sInstance->mCallback(0, sInstance->mCallbackData);
					return;
				}
			}
			
			// Right now, maingrid is the only thing that is picky about
			// credential format, as it doesn't yet allow account (single username)
			// format creds.  - Rox.  James, we wanna fix the message when we change
			// this.
			LLNotificationsUtil::add("InvalidCredentialFormat");			
		}
	}
}
// static
void LLWindlightRemoteCtrl::onCommitPreset(LLUICtrl* ctrl, void* data)
{
	LLWindlightRemoteCtrl* self = (LLWindlightRemoteCtrl*)data;

	LLComboBox*	presetsCombo = self->getChild<LLComboBox>("Presets");

	LLCtrlListInterface* presets = presetsCombo ? presetsCombo->getListInterface() : NULL;
	if (presets)
	{
		S32 index = presets->getFirstSelectedIndex();
		if (index < 0)
		{
			// Open Advanced Sky
			LLFloaterWindLight::show();
			return;
		}

		// check for World menu options; if none, apply preset
		std::string selected = presetsCombo->getSelectedValue().asString();

		/*if (selected == self->getString("atmosphere"))
		{
			if (!LLFloaterWindLight::instance()->getVisible())
			{
				LLFloaterWindLight::show();
			}
			LLFloaterWindLight::instance()->selectTab("Atmosphere");
		}
		else if (selected == self->getString("lighting"))
		{
			if (!LLFloaterWindLight::instance()->getVisible())
			{
				LLFloaterWindLight::show();
			}
			LLFloaterWindLight::instance()->selectTab("Lighting");
		}
		else if (selected == self->getString("clouds"))
		{
			if (!LLFloaterWindLight::instance()->getVisible())
			{
				LLFloaterWindLight::show();
			}
			LLFloaterWindLight::instance()->selectTab("Clouds");
		}
		else if (selected == self->getString("advanced_water"))
		{
			LLFloaterWater::show();
		}
		else*/ if (selected == self->getString("sunrise"))
		{
			// set the value, turn off animation
			LLWLParamManager::instance()->mAnimator.setDayTime(0.25);
			LLWLParamManager::instance()->mAnimator.mIsRunning = false;
			LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;

			// then call update once
			LLWLParamManager::instance()->mAnimator.update(
				LLWLParamManager::instance()->mCurParams);
		}
		else if (selected == self->getString("noon"))
		{
			// set the value, turn off animation
			LLWLParamManager::instance()->mAnimator.setDayTime(0.567);
			LLWLParamManager::instance()->mAnimator.mIsRunning = false;
			LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;

			// then call update once
			LLWLParamManager::instance()->mAnimator.update(
				LLWLParamManager::instance()->mCurParams);
		}
		else if (selected == self->getString("sunset"))
		{
			// set the value, turn off animation
			LLWLParamManager::instance()->mAnimator.setDayTime(0.75);
			LLWLParamManager::instance()->mAnimator.mIsRunning = false;
			LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;

			// then call update once
			LLWLParamManager::instance()->mAnimator.update(
				LLWLParamManager::instance()->mCurParams);
		}
		else if (selected == self->getString("midnight"))
		{
			// set the value, turn off animation
			LLWLParamManager::instance()->mAnimator.setDayTime(0.0);
			LLWLParamManager::instance()->mAnimator.mIsRunning = false;
			LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;

			// then call update once
			LLWLParamManager::instance()->mAnimator.update(
				LLWLParamManager::instance()->mCurParams);
		}
		else if (selected == self->getString("revert_region"))
		{
			LLWLParamManager::instance()->mAnimator.mIsRunning = true;
			LLWLParamManager::instance()->mAnimator.mUseLindenTime = true;	
		}
		else
		{
			// Apply preset
			LLWLParamManager::instance()->mAnimator.mIsRunning = false;
			LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
			LLWLParamManager::instance()->loadPreset(selected, true);
		}
	}
}
void LLFacebookPhotoPanel::updateResolution(BOOL do_update)
{
	LLComboBox* combobox = static_cast<LLComboBox *>(mResolutionComboBox);
	LLComboBox* filterbox = static_cast<LLComboBox *>(mFilterComboBox);

	std::string sdstring = combobox->getSelectedValue();
	LLSD sdres;
	std::stringstream sstream(sdstring);
	LLSDSerialize::fromNotation(sdres, sstream, sdstring.size());

	S32 width = sdres[0];
	S32 height = sdres[1];

    // Note : index 0 of the filter drop down is assumed to be "No filter" in whichever locale
    std::string filter_name = (filterbox->getCurrentIndex() ? filterbox->getSimple() : "");

	LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get());
	if (previewp && combobox->getCurrentIndex() >= 0)
	{
		// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare; moved up
		checkAspectRatio(width);

		S32 original_width = 0 , original_height = 0 ;
		previewp->getSize(original_width, original_height) ;

		if (width == 0 || height == 0)
		{
			// take resolution from current window size
			LL_DEBUGS() << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL;
			previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
		}
		// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare
		else if (width == -1 || height == -1)
		{
			// take resolution from custom size
			LLSpinCtrl* width_spinner = getChild<LLSpinCtrl>("custom_snapshot_width");
			LLSpinCtrl* height_spinner = getChild<LLSpinCtrl>("custom_snapshot_height");
			S32 custom_width = width_spinner->getValue().asInteger();
			S32 custom_height = height_spinner->getValue().asInteger();
			if (checkImageSize(previewp, custom_width, custom_height, TRUE, previewp->getMaxImageSize()))
			{
				width_spinner->set(custom_width);
				height_spinner->set(custom_height);
			}
			LL_DEBUGS() << "Setting preview res from custom: " << custom_width << "x" << custom_height << LL_ENDL;
			previewp->setSize(custom_width, custom_height);
		}
		// </FS:Ansariel>
		else
		{
			// use the resolution from the selected pre-canned drop-down choice
			LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL;
			previewp->setSize(width, height);
		}

		// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare; moved up
		//checkAspectRatio(width);

		previewp->getSize(width, height);
        
        // Recompute quality setting
        mQuality = compute_jpeg_quality(width, height);
        previewp->setSnapshotQuality(mQuality, false);
		
		if (original_width != width || original_height != height)
		{
			previewp->setSize(width, height);
			if (do_update)
			{
                previewp->updateSnapshot(TRUE);
				updateControls();
			}
		}
        // Get the old filter, compare to the current one "filter_name" and set if changed
        std::string original_filter = previewp->getFilter();
		if (original_filter != filter_name)
		{
            previewp->setFilter(filter_name);
			if (do_update)
			{
                previewp->updateSnapshot(FALSE, TRUE);
				updateControls();
			}
		}
	}

	// <FS:Ansariel> FIRE-15112: Allow custom resolution for SLShare
	BOOL custom_resolution = static_cast<LLComboBox *>(mResolutionComboBox)->getSelectedValue().asString() == "[i-1,i-1]";
	getChild<LLSpinCtrl>("custom_snapshot_width")->setEnabled(custom_resolution);
	getChild<LLSpinCtrl>("custom_snapshot_height")->setEnabled(custom_resolution);
	getChild<LLCheckBoxCtrl>("keep_aspect_ratio")->setEnabled(custom_resolution);
	// </FS:Ansariel>
}
Exemplo n.º 15
0
// static
void LLPanelLogin::onClickConnect(void *)
{
	if (sInstance && sInstance->mCallback)
	{
		// JC - Make sure the fields all get committed.
		sInstance->setFocus(FALSE);

		LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
		LLSD combo_val = combo->getSelectedValue();
		if (combo_val.isUndefined())
		{
			combo_val = combo->getValue();
		}
		if(combo_val.isUndefined())
		{
			LLNotificationsUtil::add("StartRegionEmpty");
			return;
		}		

		std::string new_combo_value = combo_val.asString();
		if (!new_combo_value.empty())
		{
			std::string match = "://";
			size_t found = new_combo_value.find(match);
			if (found != std::string::npos)	
				new_combo_value.erase( 0,found+match.length());
		}

		try
		{
			LLGridManager::getInstance()->setGridChoice(new_combo_value);
		}
		catch (LLInvalidGridName ex)
		{
			LLSD args;
			args["GRID"] = ex.name();
			LLNotificationsUtil::add("InvalidGrid", args);
			return;
		}
		updateStartSLURL();
		std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
		gSavedSettings.setString("UserLoginInfo", credential_name());

		LLSD blocked = FSData::getInstance()->allowed_login();
		if (!blocked.isMap()) //hack for testing for an empty LLSD
		{
			if(username.empty())
			{
				LLSD args;
				args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
				// user must type in something into the username field
				LLNotificationsUtil::add("MustHaveAccountToLogIn", args);
			}
			else
			{
				LLPointer<LLCredential> cred;
				BOOL remember;
				getFields(cred, remember);
				std::string identifier_type;
				cred->identifierType(identifier_type);
				LLSD allowed_credential_types;
				LLGridManager::getInstance()->getLoginIdentifierTypes(allowed_credential_types);
				
				// check the typed in credential type against the credential types expected by the server.
				for(LLSD::array_iterator i = allowed_credential_types.beginArray();
					i != allowed_credential_types.endArray();
					i++)
				{
					
					if(i->asString() == identifier_type)
					{
						// yay correct credential type
						sInstance->mCallback(0, sInstance->mCallbackData);
						return;
					}
				}
				
				// Right now, maingrid is the only thing that is picky about
				// credential format, as it doesn't yet allow account (single username)
				// format creds.  - Rox.  James, we wanna fix the message when we change
				// this.
				LLNotificationsUtil::add("InvalidCredentialFormat");			
			}
		}
	}
}
Exemplo n.º 16
0
// static
void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
{
	// *NOTE: The paramters for this method are ignored. 
	// LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
	// calls this method.

	// The user twiddled with the grid choice ui.
	// apply the selection to the grid setting.
//	LLPointer<LLCredential> credential; <- SA: is this ever used?
	
	LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
	LLSD combo_val = combo->getSelectedValue();
	if (combo_val.isUndefined())
	{
		combo_val = combo->getValue();
	}


// <AW: opensim>
	std::string new_combo_value = combo_val.asString();
	if (!new_combo_value.empty())
	{
		std::string match = "://";
		size_t found = new_combo_value.find(match);
		if (found != std::string::npos)	
			new_combo_value.erase( 0,found+match.length());
	}

	// e.g user clicked into loginpage
	if(LLGridManager::getInstance()->getGrid() == new_combo_value)
	{
		return;
	}

	try
	{
		LLGridManager::getInstance()->setGridChoice(new_combo_value);
	}
	catch (LLInvalidGridName ex)
	{
		// do nothing
	}
// </AW: opensim>
	//Clear the PW for security reasons, if the Grid changed manually.
	sInstance->getChild<LLLineEditor>("password_edit")->clear();

	LL_INFOS("AppInit") << "onSelectServer " << new_combo_value << LL_ENDL;

	
	combo = sInstance->getChild<LLComboBox>("start_location_combo");	
//	combo->setCurrentByIndex(1);  <- SA: Why???

	
	LLStartUp::setStartSLURL(LLSLURL(gSavedSettings.getString("LoginLocation")));



	// This new selection will override preset uris
	// from the command line.
	updateServer();
	updateLoginPanelLinks();
}