本文整理汇总了C++中KHTMLPart::encoding方法的典型用法代码示例。如果您正苦于以下问题:C++ KHTMLPart::encoding方法的具体用法?C++ KHTMLPart::encoding怎么用?C++ KHTMLPart::encoding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KHTMLPart
的用法示例。
在下文中一共展示了KHTMLPart::encoding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
void HTMLLinkElementImpl::process()
{
if(!inDocument())
return;
QString type = getAttribute(ATTR_TYPE).string().lower();
QString rel = getAttribute(ATTR_REL).string().lower();
KHTMLPart *part = getDocument()->view() ? getDocument()->view()->part() : 0;
// IE extension: location of small icon for locationbar / bookmarks
// Uses both "shortcut icon" and "icon"
if(part && rel.contains("icon") && !m_url.isEmpty() && !part->parentPart())
part->browserExtension()->setIconURL(KURL(m_url.string()));
// Stylesheet
else if(!m_isDisabled && (type.contains("text/css") || rel.contains("stylesheet")))
{
// no need to load style sheets which aren't for the screen output
// ### there may be in some situations e.g. for an editor or script to manipulate
if(m_media.isNull() || m_media.contains("screen") || m_media.contains("all") || m_media.contains("print"))
{
m_loading = true;
// Add ourselves as a pending sheet, but only if we aren't an alternate
// stylesheet. Alternate stylesheets don't hold up render tree construction.
m_alternate = rel.contains("alternate");
if(!isAlternate())
getDocument()->addPendingSheet();
QString chset = getAttribute(ATTR_CHARSET).string();
// set chset to charset of referring document when attribute CHARSET is absent.
// http://www.w3.org/TR/CSS21/syndata.html(4.4)
if(chset.isEmpty() && part)
chset = part->encoding();
if(m_cachedSheet)
m_cachedSheet->deref(this);
m_cachedSheet = getDocument()->docLoader()->requestStyleSheet(m_url, chset);
if(m_cachedSheet)
{
m_isCSSSheet = true;
m_cachedSheet->ref(this);
}
else if(!isAlternate())
{
// Error requesting sheet; decrement pending sheet count
getDocument()->styleSheetLoaded();
}
}
}
else if(m_sheet)
{
// we no longer contain a stylesheet, e.g. perhaps rel or type was changed
m_sheet->deref();
m_sheet = 0;
m_isCSSSheet = false;
getDocument()->updateStyleSelector();
}
}