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:
parent
e052bda768
commit
58d895e272
@ -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();
|
const QByteArray data = m_reply->readAll();
|
||||||
}
|
emit iconLoaded(QIcon(QPixmap::fromImage(QImage::fromData(data))));
|
||||||
else {
|
|
||||||
const QByteArray data = m_reply->readAll();
|
|
||||||
emit iconLoaded(QIcon(QPixmap::fromImage(QImage::fromData(data))));
|
|
||||||
}
|
|
||||||
|
|
||||||
delete m_reply;
|
delete m_reply;
|
||||||
m_reply = Q_NULLPTR;
|
m_reply = Q_NULLPTR;
|
||||||
|
@ -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();
|
||||||
|
@ -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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user