From a2aa440d3e97226d7c3b9e0c4c31a3151e2e88ed Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= Date: Tue, 11 Nov 2008 23:51:32 +0100 Subject: [PATCH] test approach --- runtime/kioslave/thumbnail/htmlcreator.cpp | 4 ++- runtime/kioslave/thumbnail/thumbnail.cpp | 43 ------------------------------ 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/runtime/kioslave/thumbnail/htmlcreator.cpp b/runtime/kioslave/thumbnail/htmlcreator.cpp index c6236064..c2544a79 100644 --- a/runtime/kioslave/thumbnail/htmlcreator.cpp +++ b/runtime/kioslave/thumbnail/htmlcreator.cpp @@ -94,6 +94,8 @@ bool HTMLCreator::create(const QString &path, int width, int height, QImage &img m_html->paint(&p, rc); p.end(); + p.fillRect(QRect(0, 0, width, height), Qt::red); + img = pix.toImage(); m_html->closeUrl(); @@ -113,7 +115,7 @@ void HTMLCreator::slotCompleted() ThumbCreator::Flags HTMLCreator::flags() const { - return DrawFrame; + return None; } #include "htmlcreator.moc" diff --git a/runtime/kioslave/thumbnail/thumbnail.cpp b/runtime/kioslave/thumbnail/thumbnail.cpp index 3d95ad6b..7e722044 100644 --- a/runtime/kioslave/thumbnail/thumbnail.cpp +++ b/runtime/kioslave/thumbnail/thumbnail.cpp @@ -58,8 +58,6 @@ #include #include -// Use correctly KComponentData instead of KApplication (but then no QPixmap) -#undef USE_KINSTANCE // Fix thumbnail: protocol #define THUMBNAIL_HACK (1) @@ -99,9 +97,6 @@ int kdemain(int argc, char **argv) nice( 5 ); #endif -#ifdef USE_KINSTANCE - KComponentData componentData("kio_thumbnail"); -#else // creating KApplication in a slave in not a very good idea, // as dispatchLoop() doesn't allow it to process its messages, // so it for example wouldn't reply to ksmserver - on the other @@ -114,7 +109,6 @@ int kdemain(int argc, char **argv) KCmdLineArgs::init(&about); KApplication app( true); -#endif if (argc != 4) { @@ -302,43 +296,6 @@ void ThumbnailProtocol::get(const KUrl &url) img = img.scaled(m_width, int(qMax((double)m_width * imgRatio, 1.0)), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); } -// ### FIXME -#ifndef USE_KINSTANCE - if (flags & ThumbCreator::DrawFrame) - { - QPixmap pix = QPixmap::fromImage( img ); - int x2 = pix.width() - 1; - int y2 = pix.height() - 1; - // paint a black rectangle around the "page" - QPainter p; - p.begin( &pix ); - p.setPen( QColor( 48, 48, 48 )); - p.drawLine( x2, 0, x2, y2 ); - p.drawLine( 0, y2, x2, y2 ); - p.setPen( QColor( 215, 215, 215 )); - p.drawLine( 0, 0, x2, 0 ); - p.drawLine( 0, 0, 0, y2 ); - p.end(); - - const QBitmap& mask = pix.mask(); - if ( !mask.isNull() ) // need to update it so we can see the frame - { - QBitmap bitmap( mask ); - QPainter painter; - painter.begin( &bitmap ); - painter.drawLine( x2, 0, x2, y2 ); - painter.drawLine( 0, y2, x2, y2 ); - painter.drawLine( 0, 0, x2, 0 ); - painter.drawLine( 0, 0, 0, y2 ); - painter.end(); - - pix.setMask( bitmap ); - } - - img = pix.toImage(); - } -#endif - if ((flags & ThumbCreator::BlendIcon) && KIconLoader::global()->alphaBlending(KIconLoader::Desktop)) { // blending the mimetype icon in -- 2.11.4.GIT