diff options
Diffstat (limited to 'src/urlbar')
-rw-r--r-- | src/urlbar/listitem.cpp | 24 | ||||
-rw-r--r-- | src/urlbar/listitem.h | 3 |
2 files changed, 3 insertions, 24 deletions
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index 6f91aabd..229b43e9 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -31,6 +31,7 @@ // Local Includes #include "urlresolver.h" #include "application.h" +#include "websnap.h" // KDE Includes #include <KIcon> @@ -238,7 +239,8 @@ ItemPreview::ItemPreview(const QString &url, int width, int height, QWidget *par setFixedSize(width, height); setFrameStyle(QFrame::StyledPanel | QFrame::Raised); - QString path = KStandardDirs::locateLocal("cache", QString("thumbs/") + guessNameFromUrl( QUrl(url) ) + ".png", true); + KUrl u = WebSnap::fileForUrl( QUrl(url) ); + QString path = u.pathOrUrl(); if(QFile::exists(path)) { QPixmap preview; @@ -248,26 +250,6 @@ ItemPreview::ItemPreview(const QString &url, int width, int height, QWidget *par } -//TODO: REMOVE DUPLICATE CODE WITH PREVIEWIMAGE -QString ItemPreview::guessNameFromUrl(QUrl url) -{ - QString name = url.toString( QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash ); - - // TODO learn Regular Expressions :) - // and implement something better here.. - name.remove('/'); - name.remove('&'); - name.remove('.'); - name.remove('-'); - name.remove('_'); - name.remove('?'); - name.remove('='); - name.remove('+'); - - return name; -} - - // --------------------------------------------------------------- diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h index 2f6f898a..8a6f520f 100644 --- a/src/urlbar/listitem.h +++ b/src/urlbar/listitem.h @@ -193,9 +193,6 @@ class ItemPreview : public QLabel public: ItemPreview(const QString &url, int width, int height, QWidget *parent = 0); - -private: - static QString guessNameFromUrl(QUrl url); }; |