--------------Boundary-00=_JOP4NBZJGIH8B10JW8UO Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Qt seems to identify PNG images as MNG sometimes and does not show them=20 correctly as a result. The following patch lets khtml use the mimetype emitted by the slave to=20 determine when an image is png and will not treat it as a movie in that c= ase. The problem can be seen on http://www.kde.org with the=20 http://www.kde.org/img/patent_button.png image. Please comment. Cheers, Waldo --=20 bastian@kde.org | SuSE Labs KDE Developer | bastian@suse.com --------------Boundary-00=_JOP4NBZJGIH8B10JW8UO Content-Type: text/x-diff; charset="us-ascii"; name="khtml_img.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="khtml_img.diff" ? cvs.diff ? loader.loT Index: loader.cpp =================================================================== RCS file: /home/kde/kdelibs/khtml/misc/loader.cpp,v retrieving revision 1.111 diff -u -p -r1.111 loader.cpp --- loader.cpp 2002/04/03 00:41:05 1.111 +++ loader.cpp 2002/04/06 04:22:11 @@ -810,6 +810,16 @@ void CachedImage::data ( QBuffer &_buffe } } +void CachedImage::mimetype(const QString &mime) +{ + if (mime.lower().endsWith("png")) + { + kdDebug( 6060 ) << "Image is PNG!" << endl; + typeChecked = true; + formatType = false; + } +} + void CachedImage::error( int /*err*/, const char */*text*/ ) { #ifdef CACHE_DEBUG @@ -1020,6 +1030,8 @@ void Loader::servePendingRequests() connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotFinished( KIO::Job * ) ) ); connect( job, SIGNAL( data( KIO::Job*, const QByteArray &)), SLOT( slotData( KIO::Job*, const QByteArray &))); + connect( job, SIGNAL( mimetype( KIO::Job*, const QString &)), + SLOT( slotMimetype( KIO::Job*, const QString &))); if ( req->object->schedule() ) KIO::Scheduler::scheduleJob( job ); @@ -1075,6 +1087,16 @@ void Loader::slotData( KIO::Job*job, con if(r->incremental) r->object->data( r->m_buffer, false ); +} + +void Loader::slotMimetype( KIO::Job*job, const QString &mime ) +{ + Request *r = m_requestsLoading[job]; + if(!r) { + kdDebug( 6060 ) << "got mimetype for unknown request!" << endl; + return; + } + r->object->mimetype(mime); } int Loader::numRequests( DocLoader* dl ) const Index: loader.h =================================================================== RCS file: /home/kde/kdelibs/khtml/misc/loader.h,v retrieving revision 1.43 diff -u -p -r1.43 loader.h --- loader.h 2002/04/03 00:41:05 1.43 +++ loader.h 2002/04/06 04:22:11 @@ -119,6 +119,7 @@ namespace khtml virtual void data( QBuffer &buffer, bool eof) = 0; virtual void error( int err, const char *text ) = 0; + virtual void mimetype(const QString &) { }; const DOM::DOMString &url() const { return m_url; } Type type() const { return m_type; } @@ -263,6 +264,7 @@ namespace khtml virtual void data( QBuffer &buffer, bool eof ); virtual void error( int err, const char *text ); + virtual void mimetype(const QString &mime); bool isTransparent() const { return isFullyTransparent; } bool isErrorImage() const { return errorOccured; } @@ -393,6 +395,7 @@ namespace khtml protected slots: void slotFinished( KIO::Job * ); void slotData( KIO::Job *, const QByteArray & ); + void slotMimetype( KIO::Job *, const QString & ); private: void servePendingRequests(); --------------Boundary-00=_JOP4NBZJGIH8B10JW8UO--