summaryrefslogtreecommitdiff
path: root/src/websnap.cpp
diff options
context:
space:
mode:
authormatgic78 <matgic78@gmail.com>2010-01-29 19:55:08 +0100
committermatgic78 <matgic78@gmail.com>2010-02-06 11:22:47 +0100
commitd7b37b950bb9ac396914d937df44891e02a64811 (patch)
tree8557f4dfc2479d643be37088cbbbbadb88d978bb /src/websnap.cpp
parentbugfixing... (diff)
downloadrekonq-d7b37b950bb9ac396914d937df44891e02a64811.tar.xz
bugfix : previews were sometimes saved using the good size
Diffstat (limited to 'src/websnap.cpp')
-rw-r--r--src/websnap.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/websnap.cpp b/src/websnap.cpp
index fde7bd94..983da716 100644
--- a/src/websnap.cpp
+++ b/src/websnap.cpp
@@ -80,17 +80,10 @@ QPixmap WebSnap::renderPreview(const QWebPage &page,int w, int h)
// find the best size
QSize size;
- if (page.viewportSize().width() && page.viewportSize().height())
- {
- size = page.viewportSize();
- }
- else
- {
- int width = page.mainFrame()->contentsSize().width();
- if (width < 640) width = 640;
- size = QSize(width,width*((0.0+h)/w));
- page.setViewportSize(size);
- }
+ int width = page.mainFrame()->contentsSize().width();
+ if (width < 640) width = 640;
+ size = QSize(width,width*((0.0+h)/w));
+ page.setViewportSize(size);
// create the page image
QImage pageImage = QImage(size, QImage::Format_ARGB32_Premultiplied);
@@ -108,13 +101,12 @@ QPixmap WebSnap::renderPreview(const QWebPage &page,int w, int h)
page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded);
return QPixmap::fromImage(pageImage);
-
- kDebug() << w << h;
}
void WebSnap::savePreview(QPixmap pm, KUrl url)
{
+ kDebug() << "saving preview";
QFile::remove(fileForUrl(url).toLocalFile());
pm.save(fileForUrl(url).toLocalFile());
}