本文整理汇总了C++中WebPage::setSslInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ WebPage::setSslInfo方法的具体用法?C++ WebPage::setSslInfo怎么用?C++ WebPage::setSslInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebPage
的用法示例。
在下文中一共展示了WebPage::setSslInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openUrl
bool KWebKitPart::openUrl(const QUrl &_u)
{
QUrl u (_u);
kDebug() << u;
// Ignore empty requests...
if (u.isEmpty())
return false;
// If the URL given is a supported local protocol, e.g. "bookmark" but lacks
// a path component, we set the path to "/" here so that the security context
// will properly allow access to local resources.
if (u.host().isEmpty() && u.path().isEmpty()
&& KProtocolInfo::protocolClass(u.scheme()) == QL1S(":local")) {
u.setPath(QL1S("/"));
}
// Do not emit update history when url is typed in since the embedding part
// should handle that automatically itself. At least Konqueror does that.
m_emitOpenUrlNotify = false;
// Pointer to the page object...
WebPage* p = page();
Q_ASSERT(p);
// Handle error conditions...
if (u.scheme() == QL1S("error")) {
/**
* The format of the error url is that two variables are passed in the query:
* error = int kio error code, errText = QString error text from kio
* and the URL where the error happened is passed as a sub URL.
*/
const QUrl mainUrl(u.fragment());
if (mainUrl.isValid()) {
QString query = u.query(QUrl::FullyDecoded);
QRegularExpression pattern("error=(\\d+)&errText=(.*)");
QRegularExpressionMatch match = pattern.match(query);
int error = match.captured(1).toInt();
// error=0 isn't a valid error code, so 0 means it's missing from the URL
if (error == 0) {
error = KIO::ERR_UNKNOWN;
}
const QString errorText = match.captured(2);
emit m_browserExtension->setLocationBarUrl(mainUrl.toDisplayString());
if (p) {
m_webView->setHtml(p->errorPage(error, errorText, mainUrl));
return true;
}
}
return false;
}
KParts::BrowserArguments bargs (m_browserExtension->browserArguments());
KParts::OpenUrlArguments args (arguments());
if (u != *globalBlankUrl) {
// Get the SSL information sent, if any...
if (args.metaData().contains(QL1S("ssl_in_use"))) {
WebSslInfo sslInfo;
sslInfo.restoreFrom(KIO::MetaData(args.metaData()).toVariant());
sslInfo.setUrl(u);
p->setSslInfo(sslInfo);
}
}
// Set URL in KParts before emitting started; konq plugins rely on that.
setUrl(u);
m_doLoadFinishedActions = true;
m_webView->loadUrl(u, args, bargs);
return true;
}