diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-09-30 10:21:58 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-09-30 10:21:58 +0200 |
commit | b4516b0bacb68179eb6f7cbff9c6474ec03cc9ab (patch) | |
tree | ac6ffe5c874627302ddbce6a7dd350e1b6efb0c6 /src/previewimage.cpp | |
parent | a lot fo changes in the history/bookmarks page (restored initial method rewam... (diff) | |
download | rekonq-b4516b0bacb68179eb6f7cbff9c6474ec03cc9ab.tar.xz |
BIG BIG commit
removed:
- last closed tabs feature
- new tab page settings (unuseful, we need something better)
implemented
- new home page layout (needs love)
- new about: protocol to load home page sections
- preview images cache
todo:
- cleaning cache mechanism
- bug fixing
- add/remove to preferred actions
Diffstat (limited to 'src/previewimage.cpp')
-rw-r--r-- | src/previewimage.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/previewimage.cpp b/src/previewimage.cpp index c10f8924..9cd1fdaa 100644 --- a/src/previewimage.cpp +++ b/src/previewimage.cpp @@ -35,21 +35,22 @@ #include <KStandardDirs> #include <KDebug> -PreviewImage::PreviewImage(const QString &url, const QString &pos) + +PreviewImage::PreviewImage(const QString &url) : QLabel() , ws(0) , m_url(url) { - QString path = KStandardDirs::locateLocal("cache", QString("thumbs/rek") + pos + ".png", true); + m_savePath = KStandardDirs::locateLocal("cache", QString("thumbs/") + guessNameFromUrl(m_url) + ".png", true); - if(QFile::exists(path)) + if(QFile::exists(m_savePath)) { - m_pixmap.load(path); + m_pixmap.load(m_savePath); setPixmap( m_pixmap ); } else { - ws = new WebSnap( url, pos ); + ws = new WebSnap( url ); connect(ws, SIGNAL(finished()), this, SLOT(setSiteImage())); QString path = KStandardDirs::locate("appdata", "pics/busywidget.gif"); @@ -73,7 +74,10 @@ void PreviewImage::setSiteImage() delete m; setMovie(0); - setPixmap( ws->previewImage() ); + m_pixmap = ws->previewImage(); + setPixmap(m_pixmap); + + m_pixmap.save(m_savePath); } @@ -82,3 +86,9 @@ void PreviewImage::mousePressEvent(QMouseEvent *event) Q_UNUSED(event) Application::instance()->loadUrl(m_url); } + + +QString PreviewImage::guessNameFromUrl(QString url) +{ + return QUrl(url).toString( QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash ); +} |