diff options
author | Lionel Chauvin <megabigbug@yahoo.fr> | 2011-01-19 22:25:03 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-01-19 22:25:03 +0100 |
commit | 966f6f99a3a2e89f6974bfee05886b8499385992 (patch) | |
tree | fe419a5a321a812aeac51630da6381a7d7c363f4 /src/urlbar/listitem.cpp | |
parent | Updating AUTHORS list. (diff) | |
download | rekonq-966f6f99a3a2e89f6974bfee05886b8499385992.tar.xz |
Save downloaded images of opensearch suggestions like websnaps
RB:100397
Reviewed by me ;)
Diffstat (limited to 'src/urlbar/listitem.cpp')
-rw-r--r-- | src/urlbar/listitem.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index f7514f2a..1794233e 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -365,15 +365,23 @@ PreviewLabel::PreviewLabel(const QString &url, int width, int height, QWidget *p ImageLabel::ImageLabel(const QString &url, int width, int height, QWidget *parent) : QLabel(parent), - m_width(width), - m_height(height) + m_url(url) { setFixedSize(width, height); - KIO::TransferJob *job = KIO::get(KUrl(url), KIO::NoReload, KIO::HideProgressInfo); - connect(job, SIGNAL(data(KIO::Job *, const QByteArray &)), - this, SLOT(slotData(KIO::Job*, const QByteArray&))); - connect(job, SIGNAL(result(KJob *)), - this, SLOT(slotResult(KJob *))); + if (WebSnap::existsImage(KUrl(url))) + { + QPixmap pix; + pix.load(WebSnap::imagePathFromUrl(url)); + setPixmap(pix); + } + else + { + KIO::TransferJob *job = KIO::get(KUrl(url), KIO::NoReload, KIO::HideProgressInfo); + connect(job, SIGNAL(data(KIO::Job *, const QByteArray &)), + this, SLOT(slotData(KIO::Job*, const QByteArray&))); + connect(job, SIGNAL(result(KJob *)), + this, SLOT(slotResult(KJob *))); + } } @@ -390,6 +398,7 @@ void ImageLabel::slotResult(KJob *) if (!pix.loadFromData(m_data)) kDebug() << "error while loading image: "; setPixmap(pix); + pix.save(WebSnap::imagePathFromUrl(m_url), "PNG"); } |