From kde-commits Thu May 12 18:25:40 2005 From: =?utf-8?q?Pascal=20L=C3=A9tourneau?= Date: Thu, 12 May 2005 18:25:40 +0000 To: kde-commits Subject: branches/KDE/3.4/kdelibs/khtml Message-Id: <1115922340.559400.29067.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=111592235821101 SVN commit 412816 by pletourn: Convert the pixmap to an image only when needed BUG:105112 M +5 -5 branches/KDE/3.4/kdelibs/khtml/khtml_ext.cpp --- branches/KDE/3.4/kdelibs/khtml/khtml_ext.cpp #412815:412816 @@ -377,7 +377,7 @@ KHTMLPart *m_khtml; KURL m_url; KURL m_imageURL; - QImage m_image; + QPixmap m_pixmap; QString m_suggestedFilename; }; @@ -530,7 +530,7 @@ if(imageimpl) // should be true always. right? { if(imageimpl->complete()) { - d->m_image = imageimpl->currentImage(); + d->m_pixmap = imageimpl->currentPixmap(); } } } @@ -544,10 +544,10 @@ #ifndef QT_NO_MIMECLIPBOARD (new KAction( i18n( "Copy Image" ), 0, this, SLOT( slotCopyImage() ), - actionCollection(), "copyimage" ))->setEnabled(!d->m_image.isNull()); + actionCollection(), "copyimage" ))->setEnabled(!d->m_pixmap.isNull()); #endif - if(d->m_image.isNull()) { //fallback to image location if still loading the image. this will always be true if ifdef QT_NO_MIMECLIPBOARD + if(d->m_pixmap.isNull()) { //fallback to image location if still loading the image. this will always be true if ifdef QT_NO_MIMECLIPBOARD new KAction( i18n( "Copy Image Location" ), 0, this, SLOT( slotCopyImageLocation() ), actionCollection(), "copyimagelocation" ); } @@ -628,7 +628,7 @@ lst.append( safeURL ); KMultipleDrag *drag = new KMultipleDrag(d->m_khtml->view(), "Image"); - drag->addDragObject( new QImageDrag(d->m_image) ); + drag->addDragObject( new QImageDrag(d->m_pixmap.convertToImage()) ); drag->addDragObject( new KURLDrag(lst, d->m_khtml->view(), "Image URL") ); // Set it in both the mouse selection and in the clipboard