bool KHTMLImage::openURL( const KURL &url ) { static const QString &html = KGlobal::staticQString( "<html><body><img src=\"%1\"></body></html>" ); m_url = url; emit started( 0 ); KParts::URLArgs args = m_ext->urlArgs(); m_mimeType = args.serviceType; m_khtml->begin( m_url, args.xOffset, args.yOffset ); m_khtml->setAutoloadImages( true ); DOM::DocumentImpl *impl = dynamic_cast<DOM::DocumentImpl *>( m_khtml->document().handle() ); // ### hack ;-) if ( impl && m_ext->urlArgs().reload ) impl->docLoader()->setCachePolicy( KIO::CC_Refresh ); m_khtml->write( html.arg( m_url.url() ) ); m_khtml->end(); emit setWindowCaption( url.prettyURL() ); connect( khtml::Cache::loader(), SIGNAL( requestDone( khtml::DocLoader*, khtml::CachedObject *) ), this, SLOT( updateWindowCaption() ) ); return true; }
bool KHTMLImage::openUrl( const KUrl &url ) { static const QString &html = KGlobal::staticQString( "<html><body><img src=\"%1\"></body></html>" ); // Propagate statusbar to our kid part. KParts::StatusBarExtension::childObject( m_khtml )->setStatusBar( m_sbExt->statusBar() ); disposeImage(); setUrl(url); emit started( 0 ); KParts::OpenUrlArguments args = arguments(); m_mimeType = args.mimeType(); emit setWindowCaption( url.prettyUrl() ); // Need to keep a copy of the offsets since they are cleared when emitting completed m_xOffset = args.xOffset(); m_yOffset = args.yOffset(); m_khtml->begin( this->url() ); m_khtml->setAutoloadImages( true ); DOM::DocumentImpl *impl = dynamic_cast<DOM::DocumentImpl *>( m_khtml->document().handle() ); // ### hack ;-) if (!impl) return false; if ( arguments().reload() ) impl->docLoader()->setCachePolicy( KIO::CC_Reload ); khtml::DocLoader *dl = impl->docLoader(); m_image = dl->requestImage( this->url().url() ); if ( m_image ) m_image->ref( this ); m_khtml->write( html.arg( this->url().url() ) ); m_khtml->end(); /* connect( khtml::Cache::loader(), SIGNAL(requestDone(khtml::DocLoader*,khtml::CachedObject*)), this, SLOT(updateWindowCaption()) ); */ return true; }
bool KHTMLImage::openURL(const KURL &url) { static const QString &html = KGlobal::staticQString("<html><body><img src=\"%1\"></body></html>"); disposeImage(); m_url = url; emit started(0); KParts::URLArgs args = m_ext->urlArgs(); m_mimeType = args.serviceType; emit setWindowCaption(url.prettyURL()); // Need to keep a copy of the offsets since they are cleared when emitting completed m_xOffset = args.xOffset; m_yOffset = args.yOffset; m_khtml->begin(m_url); m_khtml->setAutoloadImages(true); DOM::DocumentImpl *impl = dynamic_cast< DOM::DocumentImpl * >(m_khtml->document().handle()); // ### hack ;-) if(!impl) return false; if(m_ext->urlArgs().reload) impl->docLoader()->setCachePolicy(KIO::CC_Reload); khtml::DocLoader *dl = impl->docLoader(); m_image = dl->requestImage(m_url.url()); if(m_image) m_image->ref(this); m_khtml->write(html.arg(m_url.url())); m_khtml->end(); /* connect( khtml::Cache::loader(), SIGNAL( requestDone( khtml::DocLoader*, khtml::CachedObject *) ), this, SLOT( updateWindowCaption() ) ); */ return true; }