Commit 7494996c authored by David Faure's avatar David Faure
Browse files

Akregator: fix URL/path confusion which led to KIO warnings and possibly missing icons

Summary:
The faviconUrl stored in ~/.local/share/akregator/data was a path rather
than a URL.

It's also pretty pointless to then do a download job on that local file...

Test Plan:
I've been having some trouble finding RSS sites with icons...
Please double-check.

Reviewers: mlaurent

Differential Revision: https://phabricator.kde.org/D28581
parent a7d36991
......@@ -376,15 +376,19 @@ void Feed::loadFavicon(const QString &url, bool downloadFavicon)
if (u.scheme().isEmpty()) {
qCWarning(AKREGATOR_LOG) << "Invalid url" << url;
}
if (u.isLocalFile()) {
setFaviconLocalPath(u.toLocalFile());
} else {
Akregator::DownloadFeedIconJob *job = new Akregator::DownloadFeedIconJob(this);
job->setFeedIconUrl(u);
job->setDownloadFavicon(downloadFavicon);
connect(job, &DownloadFeedIconJob::result, this, [this](const QString &result) {
setFaviconUrl(result);
connect(job, &DownloadFeedIconJob::result, this, [this](const QString &fileName) {
setFaviconLocalPath(fileName);
});
if (!job->start()) {
qCWarning(AKREGATOR_LOG) << "Impossible to start DownloadFeedIconJob for url: " << url;
}
}
}
bool Feed::useCustomFetchInterval() const
......@@ -505,16 +509,19 @@ Feed::ImageInfo Feed::faviconInfo() const
return d->m_faviconInfo;
}
void Feed::setFaviconUrl(const QString &url)
void Feed::setFaviconLocalPath(const QString &localPath)
{
d->m_faviconInfo.imageUrl = url;
setFavicon(QIcon(d->m_faviconInfo.imageUrl));
d->m_faviconInfo.imageUrl = QUrl::fromLocalFile(localPath).toString();
setFavicon(QIcon(localPath));
}
void Feed::setFaviconInfo(const Feed::ImageInfo &info)
{
d->m_faviconInfo = info;
setFavicon(QIcon(info.imageUrl));
QUrl u(info.imageUrl);
if (u.isLocalFile()) {
setFavicon(QIcon(u.toLocalFile()));
}
}
QString Feed::description() const
......
......@@ -230,7 +230,7 @@ public:
Q_REQUIRED_RESULT QString comment() const;
void setComment(const QString &comment);
void setFaviconUrl(const QString &url);
void setFaviconLocalPath(const QString &file);
void setCopyright(const QString &copyright);
Q_REQUIRED_RESULT QString copyright() const;
public Q_SLOTS:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment