|
|
|
|
@ -37,6 +37,10 @@ |
|
|
|
|
#include <khtml_part.h> |
|
|
|
|
#include <khtmlview.h> |
|
|
|
|
|
|
|
|
|
#include <dom/dom_string.h> |
|
|
|
|
#include <dom/html_document.h> |
|
|
|
|
#include <dom/html_image.h> |
|
|
|
|
#include <dom/html_misc.h> |
|
|
|
|
|
|
|
|
|
#include <cassert> |
|
|
|
|
|
|
|
|
|
@ -61,6 +65,8 @@ namespace KMail { |
|
|
|
|
reset(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
mEmbeddedPartMap.clear(); |
|
|
|
|
|
|
|
|
|
// clear the widget:
|
|
|
|
|
mHtmlPart->view()->setUpdatesEnabled( false ); |
|
|
|
|
mHtmlPart->view()->viewport()->setUpdatesEnabled( false ); |
|
|
|
|
@ -75,6 +81,9 @@ namespace KMail { |
|
|
|
|
void KHtmlPartHtmlWriter::end() { |
|
|
|
|
kdWarning( mState != Begun, 5006 ) << "KHtmlPartHtmlWriter: end() called on non-begun or queued session!" << endl; |
|
|
|
|
mHtmlPart->end(); |
|
|
|
|
|
|
|
|
|
resolveCidUrls(); |
|
|
|
|
|
|
|
|
|
mHtmlPart->view()->viewport()->setUpdatesEnabled( true ); |
|
|
|
|
mHtmlPart->view()->setUpdatesEnabled( true ); |
|
|
|
|
mHtmlPart->view()->viewport()->repaint( false ); |
|
|
|
|
@ -118,7 +127,27 @@ namespace KMail { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void KHtmlPartHtmlWriter::embedPart( const QCString & contentId, |
|
|
|
|
const QString & contentURL ) { |
|
|
|
|
mEmbeddedPartMap[QString(contentId)] = contentURL; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void KHtmlPartHtmlWriter::resolveCidUrls() |
|
|
|
|
{ |
|
|
|
|
DOM::HTMLDocument document = mHtmlPart->htmlDocument(); |
|
|
|
|
DOM::HTMLCollection images = document.images(); |
|
|
|
|
for ( DOM::Node node = images.firstItem(); !node.isNull(); node = images.nextItem() ) { |
|
|
|
|
DOM::HTMLImageElement image( node ); |
|
|
|
|
KURL url( image.src().string() ); |
|
|
|
|
if ( url.protocol() == "cid" ) { |
|
|
|
|
EmbeddedPartMap::const_iterator it = mEmbeddedPartMap.find( url.path() ); |
|
|
|
|
if ( it != mEmbeddedPartMap.end() ) { |
|
|
|
|
kdDebug(5006) << "Replacing " << url.prettyURL() << " by " << it.data() << endl; |
|
|
|
|
image.setSrc( it.data() ); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} // namespace KMail
|
|
|
|
|
|
|
|
|
|
|