本文整理汇总了C++中KHTMLPart::requestObject方法的典型用法代码示例。如果您正苦于以下问题:C++ KHTMLPart::requestObject方法的具体用法?C++ KHTMLPart::requestObject怎么用?C++ KHTMLPart::requestObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KHTMLPart
的用法示例。
在下文中一共展示了KHTMLPart::requestObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: partLoadingErrorNotify
bool RenderPartObject::partLoadingErrorNotify( khtml::ChildFrame *childFrame, const KURL& url, const QString& serviceType )
{
KHTMLPart *part = static_cast<KHTMLView *>(m_view)->part();
//kdDebug() << "RenderPartObject::partLoadingErrorNotify serviceType=" << serviceType << endl;
// Check if we just tried with e.g. nsplugin
// and fallback to the activexhandler if there is a classid
// and a codebase, where we may download the ocx if it's missing
if( (serviceType != "application/x-activex-handler") && (element()->id()==ID_OBJECT) ) {
// check for embed child object
HTMLObjectElementImpl *o = static_cast<HTMLObjectElementImpl *>(element());
HTMLEmbedElementImpl *embed = 0;
NodeImpl *child = o->firstChild();
while ( child ) {
if ( child->id() == ID_EMBED )
embed = static_cast<HTMLEmbedElementImpl *>( child );
child = child->nextSibling();
}
if( embed && !o->classId.isEmpty() &&
!( static_cast<ElementImpl *>(o)->getAttribute(ATTR_CODEBASE).string() ).isEmpty() )
{
KParts::URLArgs args;
args.serviceType = "application/x-activex-handler";
if (part->requestObject( childFrame, url, args ))
return true; // success
}
}
// Dissociate ourselves from the current event loop (to prevent crashes
// due to the message box staying up)
QTimer::singleShot( 0, this, SLOT( slotPartLoadingErrorNotify() ) );
Tokenizer *tokenizer = static_cast<DOM::DocumentImpl *>(part->document().handle())->tokenizer();
if (tokenizer) tokenizer->setOnHold( true );
slotPartLoadingErrorNotify();
if (tokenizer) tokenizer->setOnHold( false );
return false;
}
示例2: updateWidget
//.........这里部分代码省略.........
}
// Then try the PARAM tags for the URL and type attributes.
NodeImpl *child = o->firstChild();
while (child && (url.isEmpty() || serviceType.isEmpty())) {
if (child->id() == ID_PARAM) {
HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>( child );
QString name = p->name().lower();
if (url.isEmpty() && (QString::equals(name,"src") || QString::equals(name,"movie") || QString::equals(name,"code"))) {
url = p->value();
}
if (serviceType.isEmpty() && QString::equals(name,"type")) {
serviceType = p->value();
}
}
child = child->nextSibling();
}
// Lastly try to map a specific CLASSID to a type.
if (serviceType.isEmpty() && !o->classId.isEmpty()) {
if (o->classId.contains("D27CDB6E-AE6D-11cf-96B8-444553540000")) {
// It is ActiveX, but the nsplugin system handling
// should also work, that's why we don't override the
// serviceType with application/x-activex-handler
// but let the KTrader in khtmlpart::createPart() detect
// the user's preference: launch with activex viewer or
// with nspluginviewer (Niko)
serviceType = "application/x-shockwave-flash";
} else if(o->classId.contains("CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA")) {
serviceType = "audio/x-pn-realaudio-plugin";
} else if(o->classId.contains("02BF25D5-8C17-4B23-BC80-D3488ABDDC6B")) {
serviceType = "video/quicktime";
} else if(o->classId.contains("166B1BCA-3F9C-11CF-8075-444553540000")) {
serviceType = "application/x-director";
} else {
// We have a clsid, means this is activex (Niko)
serviceType = "application/x-activex-handler";
}
// TODO: add more plugins here
}
// If no URL and type, abort.
if (url.isEmpty() && serviceType.isEmpty()) {
#ifdef DEBUG_LAYOUT
kdDebug() << "RenderPartObject::close - empty url and serverType" << endl;
#endif
return;
}
// Turn the attributes of either the EMBED tag or OBJECT tag into an array.
NamedAttrMapImpl* attributes = embedOrObject->attributes();
if (attributes) {
for (unsigned long i = 0; i < attributes->length(); ++i) {
AttributeImpl* it = attributes->attributeItem(i);
params.append(o->getDocument()->attrName(it->id()).string() + "=\"" + it->value().string() + "\"");
}
}
params.append( QString::fromLatin1("__KHTML__CLASSID=\"%1\"").arg( o->classId ) );
params.append( QString::fromLatin1("__KHTML__CODEBASE=\"%1\"").arg( o->getAttribute(ATTR_CODEBASE).string() ) );
part->requestObject( this, url, serviceType, params );
} else if ( element()->id() == ID_EMBED ) {
HTMLEmbedElementImpl *o = static_cast<HTMLEmbedElementImpl *>(element());
url = o->url;
serviceType = o->serviceType;
if ( url.isEmpty() && serviceType.isEmpty() ) {
#ifdef DEBUG_LAYOUT
kdDebug() << "RenderPartObject::close - empty url and serverType" << endl;
#endif
return;
}
// add all attributes set on the embed object
NamedAttrMapImpl* a = o->attributes();
if (a) {
for (unsigned long i = 0; i < a->length(); ++i) {
AttributeImpl* it = a->attributeItem(i);
params.append(o->getDocument()->attrName(it->id()).string() + "=\"" + it->value().string() + "\"");
}
}
part->requestObject( this, url, serviceType, params );
} else {
assert(element()->id() == ID_IFRAME);
HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(element());
url = o->url.string();
if (url.isEmpty())
url = "about:blank";
KHTMLView *v = static_cast<KHTMLView *>(m_view);
bool requestSucceeded = v->part()->requestFrame( this, url, o->name.string(), QStringList(), true );
if (requestSucceeded && QString::equals(url,"about:blank")) {
KHTMLPart *newPart = v->part()->findFrame( o->name.string() );
if (newPart && newPart->xmlDocImpl()) {
newPart->xmlDocImpl()->setBaseURL( v->part()->baseURL().url() );
}
}
}
}