1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02: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()
{
if (m_reply->error() != QNetworkReply::NoError) {
emit error();
}
else {
// Ignore error and always emit iconLoaded, even when icon is null
const QByteArray data = m_reply->readAll();
emit iconLoaded(QIcon(QPixmap::fromImage(QImage::fromData(data))));
}
delete m_reply;
m_reply = Q_NULLPTR;

View File

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

View File

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