diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-09-17 00:42:55 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-09-17 00:42:55 +0200 |
commit | 596d75fa61f58f489a898ce1918ee04170dbcf6a (patch) | |
tree | 58051bd873d88f4896c2c84e24a20071a721d877 /src/websnap.cpp | |
parent | Merge commit 'refs/merge-requests/2295' of git://gitorious.org/rekonq/mainline (diff) | |
parent | Websnaps: change the image path to use base64. (diff) | |
download | rekonq-596d75fa61f58f489a898ce1918ee04170dbcf6a.tar.xz |
Merge commit 'refs/merge-requests/211' of git://gitorious.org/rekonq/mainline into m211
Diffstat (limited to 'src/websnap.cpp')
-rw-r--r-- | src/websnap.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/websnap.cpp b/src/websnap.cpp index afa08c64..54cf1053 100644 --- a/src/websnap.cpp +++ b/src/websnap.cpp @@ -38,7 +38,6 @@ // Qt Includes #include <QtCore/QSize> -#include <QtCore/QTimer> #include <QtCore/QFile> #include <QtGui/QPainter> @@ -61,7 +60,7 @@ WebSnap::WebSnap(const KUrl& url, QObject *parent) connect(&m_page, SIGNAL(loadFinished(bool)), this, SLOT(saveResult(bool))); - QTimer::singleShot(0, this, SLOT(load())); + QMetaObject::invokeMethod(this, "load", Qt::QueuedConnection); } @@ -184,9 +183,9 @@ QPixmap WebSnap::renderPagePreview(const QWebPage &page, int w, int h) QString WebSnap::imagePathFromUrl(const KUrl &url) { QUrl temp = QUrl(url.url()); - QString name = temp.toString(QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash); - name.remove(QRegExp(QL1S("[&+=_?./-]"))); - return KStandardDirs::locateLocal("cache", QString("thumbs/") + name + ".png", true); + QByteArray name = temp.toEncoded(QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash); + + return KStandardDirs::locateLocal("cache", QString("thumbs/") + name.toBase64() + ".png", true); } @@ -194,7 +193,7 @@ void WebSnap::saveResult(bool ok) { if (ok) { - QPixmap image = renderPagePreview(m_page, WIDTH, HEIGHT); + QPixmap image = renderPagePreview(m_page, defaultWidth, defaultHeight); QString path = imagePathFromUrl(m_url); QFile::remove(path); image.save(path); |