当前位置: 首页>>代码示例>>C++>>正文


C++ QNetworkCookie::toRawForm方法代码示例

本文整理汇总了C++中QNetworkCookie::toRawForm方法的典型用法代码示例。如果您正苦于以下问题:C++ QNetworkCookie::toRawForm方法的具体用法?C++ QNetworkCookie::toRawForm怎么用?C++ QNetworkCookie::toRawForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QNetworkCookie的用法示例。


在下文中一共展示了QNetworkCookie::toRawForm方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setSessionCookie

void NResponse::setSessionCookie(const QString & sessionId, bool secured)
{
    QNetworkCookie sessionCookie;
    sessionCookie.setHttpOnly (true);
    sessionCookie.setName ("nawis_sessionId");
    sessionCookie.setPath ("/");
    sessionCookie.setSecure(secured);
    sessionCookie.setValue(sessionId.toAscii());

    m_httpHeader.setValue("Set-Cookie", sessionCookie.toRawForm(QNetworkCookie::Full));
}
开发者ID:sdolard,项目名称:nawis,代码行数:11,代码来源:n_response.cpp

示例2: insertCookie

bool CookieStore::insertCookie(const QNetworkCookie& cookie, const QUrl& firstUrl)
{
    sqlite3_stmt* stmt;
    int rc;
    
    QByteArray domain = cookie.domain().toLatin1();
    QByteArray path = cookie.path().toLatin1();
    QByteArray name = cookie.name();
    QByteArray fdomain = firstUrl.host().toLower().toLatin1();
    QByteArray expiration;
    if (cookie.isSessionCookie()) {
        expiration = "0";
    } else {
        expiration = cookie.expirationDate().toString().toLatin1();
    }
    QByteArray content = cookie.toRawForm();

    rc = sqlite3_prepare(m_db,
                         "insert into thirdPartyCookies (domain, path, name, fdomain, expiration, content) values (?, ?, ?, ?, ?, ?)",
                         -1, &stmt, 0);
    if (rc != SQLITE_OK) {
        qDebug() << "insertCookie prepare fail:" << rc;
        return false;
    }

    QByteArray text[6] = {domain, path, name, fdomain, expiration, content};
    
    for (int i = 0; i < 6; ++i) {
        rc = sqlite3_bind_text(stmt, i + 1, text[i].constData(), text[i].size(), SQLITE_TRANSIENT);
        if (rc != SQLITE_OK) {
            qDebug() << "insertCookie bind fail:" << i;
            sqlite3_finalize(stmt);
            return false;
        }
    }

    rc = sqlite3_step(stmt);
    if (rc != SQLITE_DONE) {
        qDebug() << "insertCookie step (execute) fail";
        sqlite3_finalize(stmt);
        return false;
    }

    sqlite3_finalize(stmt);
    return true;
}
开发者ID:wenqingchu,项目名称:revised-browser,代码行数:46,代码来源:CookieStore.cpp

示例3: cookiesFormUrl

QScriptValue MyWebView::cookiesFormUrl(QScriptValue url)
{
    QUrl targetUrl;
    if (url.isUndefined()) {
        targetUrl = this->url();
    } else if (url.toString().toLower().trimmed().indexOf("http://") == 0) {
        targetUrl = QUrl(url.toString().toLower().trimmed());
    } else {
        targetUrl = this->url();
    }

    QByteArray str;

    QNetworkCookie cookie;
    QList<QNetworkCookie> list = cookieJar->cookiesForUrl(targetUrl);
    foreach (cookie, list)
    {
        str += cookie.toRawForm() + "\n";
    }
开发者ID:leeight,项目名称:berserkJS,代码行数:19,代码来源:mywebview.cpp

示例4: makePostData

QVariant NicoLiveManager::makePostData(QString session_id)
{
    QVariant postData;

    // make cookies
    QList <QNetworkCookie> cookies;
    QNetworkCookie ck;
    ck.toRawForm(QNetworkCookie::NameAndValueOnly);
    ck.setName("user_session");

    QByteArray user_id_ba;
    user_id_ba.append(session_id);

    ck.setValue(user_id_ba);
    cookies.append(ck);

    postData.setValue(cookies);
    return postData;
}
开发者ID:GitHub30,项目名称:Viqo,代码行数:19,代码来源:nicolivemanager.cpp

示例5:

QDebug operator<<(QDebug s, const QNetworkCookie &cookie)
{
    s.nospace() << "QNetworkCookie(" << cookie.toRawForm(QNetworkCookie::Full) << ')';
    return s.space();
}
开发者ID:NikhilNJ,项目名称:screenplay-dx,代码行数:5,代码来源:qnetworkcookie.cpp

示例6: save

void SourcesSettingsWindow::save()
{
	m_site->setSetting("name", ui->lineSiteName->text(), m_site->url());
	QStringList referers = QStringList() << "none" << "host" << "page" << "image";
	QStringList referers_preview = QStringList() << "" << "none" << "host" << "page" << "image";
	QStringList referers_image = QStringList() << "" << "none" << "host" << "page" << "details" << "image";
	m_site->setSetting("referer", referers[ui->comboReferer->currentIndex()], "none");
	m_site->setSetting("referer_preview", referers_preview[ui->comboRefererPreview->currentIndex()], "");
	m_site->setSetting("referer_image", referers_image[ui->comboRefererImage->currentIndex()], "");
	m_site->setSetting("ignore/always", ui->spinIgnoreAlways->value(), 0);
	m_site->setSetting("ignore/1", ui->spinIgnore1->value(), 0);
	m_site->setSetting("ssl", ui->checkSsl->isChecked(), false);

	m_site->setSetting("download/imagesperpage", ui->spinImagesPerPage->value(), 200);
	m_site->setSetting("download/simultaneous", ui->spinSimultaneousDownloads->value(), 10);
	m_site->setSetting("download/throttle_details", ui->spinThrottleDetails->value(), 0);
	m_site->setSetting("download/throttle_image", ui->spinThrottleImage->value(), 0);
	m_site->setSetting("download/throttle_page", ui->spinThrottlePage->value(), 0);
	m_site->setSetting("download/throttle_retry", ui->spinThrottleRetry->value(), 0);
	m_site->setSetting("download/throttle_thumbnail", ui->spinThrottleThumbnail->value(), 0);

	QStringList sources = QStringList() << "" << "xml" << "json" << "regex" << "rss";
	m_site->setSetting("sources/usedefault", ui->checkSourcesDefault->isChecked(), true);
	m_site->setSetting("sources/source_1", sources[qMax(0, ui->comboSources1->currentIndex())], m_globalSettings->value("source_1", sources[0]).toString());
	m_site->setSetting("sources/source_2", sources[qMax(0, ui->comboSources2->currentIndex())], m_globalSettings->value("source_2", sources[1]).toString());
	m_site->setSetting("sources/source_3", sources[qMax(0, ui->comboSources3->currentIndex())], m_globalSettings->value("source_3", sources[2]).toString());
	m_site->setSetting("sources/source_4", sources[qMax(0, ui->comboSources4->currentIndex())], m_globalSettings->value("source_4", sources[3]).toString());


	m_site->setSetting("auth/pseudo", ui->lineAuthPseudo->text(), "");
	m_site->setSetting("auth/password", ui->lineAuthPassword->text(), "");

	// Login
	QStringList types = QStringList() << "url" << "get" << "post" << "oauth1" << "oauth2";
	m_site->setSetting("login/type", types[ui->comboLoginType->currentIndex()], "url");
	m_site->setSetting("login/get/url", ui->lineLoginGetUrl->text(), "");
	m_site->setSetting("login/get/pseudo", ui->lineLoginGetPseudo->text(), "");
	m_site->setSetting("login/get/password", ui->lineLoginGetPassword->text(), "");
	m_site->setSetting("login/get/cookie", ui->lineLoginGetCookie->text(), "");
	m_site->setSetting("login/post/url", ui->lineLoginPostUrl->text(), "");
	m_site->setSetting("login/post/pseudo", ui->lineLoginPostPseudo->text(), "");
	m_site->setSetting("login/post/password", ui->lineLoginPostPassword->text(), "");
	m_site->setSetting("login/post/cookie", ui->lineLoginPostCookie->text(), "");
	m_site->setSetting("login/oauth1/requestTokenUrl", ui->lineLoginOAuth1RequestTokenUrl->text(), "");
	m_site->setSetting("login/oauth1/authorizeUrl", ui->lineLoginOAuth1AuthorizeUrl->text(), "");
	m_site->setSetting("login/oauth1/accessTokenUrl", ui->lineLoginOAuth1AccessTokenUrl->text(), "");
	m_site->setSetting("login/oauth2/requestUrl", ui->lineLoginOAuth2RequestUrl->text(), "");
	m_site->setSetting("login/oauth2/tokenUrl", ui->lineLoginOAuth2TokenUrl->text(), "");
	m_site->setSetting("login/oauth2/refreshTokenUrl", ui->lineLoginOAuth2RefreshTokenUrl->text(), "");
	m_site->setSetting("login/oauth2/scope", ui->lineLoginOAuth2Scope->text(), "");
	m_site->setSetting("login/maxPage", ui->spinLoginMaxPage->value(), 0);

	// Cookies
	QList<QVariant> cookies;
	for (int i = 0; i < ui->tableCookies->rowCount(); ++i)
	{
		if (ui->tableCookies->item(i, 0)->text().isEmpty())
			continue;

		QNetworkCookie cookie;
		cookie.setName(ui->tableCookies->item(i, 0)->text().toLatin1());
		cookie.setValue(ui->tableCookies->item(i, 1)->text().toLatin1());
		cookies.append(cookie.toRawForm());
	}
	m_site->setSetting("cookies", cookies, QList<QVariant>());

	// Headers
	QMap<QString, QVariant> headers;
	for (int i = 0; i < ui->tableHeaders->rowCount(); ++i)
	{
		if (ui->tableHeaders->item(i, 0)->text().isEmpty())
			continue;

		headers.insert(ui->tableHeaders->item(i, 0)->text(), ui->tableHeaders->item(i, 1)->text());
	}
	m_site->setSetting("headers", headers, QMap<QString, QVariant>());

	m_site->syncSettings();

	m_site->loadConfig();
}
开发者ID:cubbu,项目名称:imgbrd-grabber,代码行数:81,代码来源:sourcessettingswindow.cpp


注:本文中的QNetworkCookie::toRawForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。