1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

WebView: Always update site icon, even when icon is null

This commit is contained in:
David Rosca 2015-10-23 12:04:43 +02:00
parent e052bda768
commit 58d895e272
3 changed files with 3 additions and 12 deletions

View File

@ -33,13 +33,9 @@ IconLoader::IconLoader(const QUrl &url, QObject *parent)
void IconLoader::finished() void IconLoader::finished()
{ {
if (m_reply->error() != QNetworkReply::NoError) { // Ignore error and always emit iconLoaded, even when icon is null
emit error();
}
else {
const QByteArray data = m_reply->readAll(); const QByteArray data = m_reply->readAll();
emit iconLoaded(QIcon(QPixmap::fromImage(QImage::fromData(data)))); emit iconLoaded(QIcon(QPixmap::fromImage(QImage::fromData(data))));
}
delete m_reply; delete m_reply;
m_reply = Q_NULLPTR; m_reply = Q_NULLPTR;

View File

@ -35,7 +35,6 @@ public:
signals: signals:
void iconLoaded(const QIcon &icon); void iconLoaded(const QIcon &icon);
void error();
private slots: private slots:
void finished(); void finished();

View File

@ -394,12 +394,8 @@ void WebView::slotIconUrlChanged(const QUrl &url)
m_siteIconLoader = new IconLoader(url, this); m_siteIconLoader = new IconLoader(url, this);
connect(m_siteIconLoader, &IconLoader::iconLoaded, [this, url](const QIcon &icon) { connect(m_siteIconLoader, &IconLoader::iconLoaded, [this, url](const QIcon &icon) {
if (icon.isNull())
return;
m_siteIcon = icon; m_siteIcon = icon;
emit iconChanged(); emit iconChanged();
IconProvider::instance()->saveIcon(this); IconProvider::instance()->saveIcon(this);
}); });
} }