diff options
Diffstat (limited to 'src/previewimage.cpp')
-rw-r--r-- | src/previewimage.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/previewimage.cpp b/src/previewimage.cpp index 2d963171..d027bfd1 100644 --- a/src/previewimage.cpp +++ b/src/previewimage.cpp @@ -26,19 +26,32 @@ #include "previewimage.h" #include "previewimage.moc" +#include <QFile> + #include <KUrl> #include <KStandardDirs> #include <KDebug> -PreviewImage::PreviewImage(const QString &url) +PreviewImage::PreviewImage(const QString &url, const QString &pos) : QLabel() , ws(0) -{ - QString path = KStandardDirs::locate("appdata", "pics/loading.mng"); //QString("thumbs/") + m_fileName, true); - setPixmap( QPixmap(path) ); - kDebug() << url; - ws = new WebSnap( KUrl(url) ); - connect(ws, SIGNAL(finished()), this, SLOT(setSiteImage())); +{ + QString path = KStandardDirs::locateLocal("cache", QString("thumbs/rek") + pos + ".png", true); + + if(QFile::exists(path)) + { + kDebug() << "exists! Loading it..."; + m_pixmap.load(path); + setPixmap( m_pixmap ); + } + else + { + QString path = KStandardDirs::locate("appdata", "pics/loading.mng"); + setPixmap( QPixmap(path) ); + + ws = new WebSnap( url, pos ); + connect(ws, SIGNAL(finished()), this, SLOT(setSiteImage())); + } } |