コード例 #1
0
void ParserMaker::getHttpAuthentication(ForumSubscription *fsub, QAuthenticator *authenticator) {
    CredentialsRequest cr;
    cr.credentialType = CredentialsRequest::SH_CREDENTIAL_HTTP;
    cr.subscription = fsub;
    CredentialsDialog *creds = new CredentialsDialog(this, &cr);
    creds->setModal(true);
    creds->exec();
    authenticator->setUser(cr.authenticator.user());
    authenticator->setPassword(cr.authenticator.password());
    creds->deleteLater();
}
コード例 #2
0
ファイル: gitarre.cpp プロジェクト: poznyakovskiy/gitarre
int Gitarre::RCredentialsCb (git_cred **cred, const char *url, const char *username_from_url, unsigned int allowed_types)
{
	CredentialsDialog *dialog = new CredentialsDialog (url, username_from_url, this);
	int res = dialog->exec();
	if (res == QDialog::Accepted)
	{
		git_cred *credentials;
		git_cred_userpass_plaintext_new (&credentials, dialog->GetUsername().toStdString().c_str(), dialog->GetPassword().toStdString().c_str());
		*cred = credentials;
		return 0;
	}
	else
		return -1;
}