summaryrefslogtreecommitdiff
path: root/src
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
parentbugfixing... (diff)
downloadrekonq-d7b37b950bb9ac396914d937df44891e02a64811.tar.xz
bugfix : previews were sometimes saved using the good size
Diffstat (limited to 'src')
-rw-r--r--src/rekonqpage/previewselectorbar.cpp2
-rw-r--r--src/websnap.cpp18
2 files changed, 6 insertions, 14 deletions
diff --git a/src/rekonqpage/previewselectorbar.cpp b/src/rekonqpage/previewselectorbar.cpp
index bbdce9d4..00950526 100644
--- a/src/rekonqpage/previewselectorbar.cpp
+++ b/src/rekonqpage/previewselectorbar.cpp
@@ -135,7 +135,7 @@ void PreviewSelectorBar::loadFinished()
void PreviewSelectorBar::clicked()
{
KUrl url = m_page->mainFrame()->url();
-
+
WebSnap::savePreview(WebSnap::renderPreview(*m_page), url);
QStringList names = ReKonfig::previewNames();
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());
}