1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Fixed showing bad site icon on some pages

This commit is contained in:
nowrep 2011-04-04 16:00:27 +02:00
parent aedfdd3309
commit fe1e3806e9
6 changed files with 30 additions and 13 deletions

View File

@ -573,7 +573,7 @@ bool MainApplication::checkProfileDir()
versionFile.write(QupZilla::VERSION.toAscii());
versionFile.close();
if (rData.contains("0.9.6") || rData.contains("0.9.7") || rData.contains("0.9.8")) // Data not changed from this version
if (rData.contains("0.9.") || rData.contains("0.9.7") || rData.contains("0.9.8")) // Data not changed from this version
return true;
dir.mkdir("profiles");

View File

@ -247,15 +247,17 @@ void LocationBar::showUrl(const QUrl &url, bool empty)
void LocationBar::siteIconChanged()
{
const QPixmap* icon_ = 0;
if (!p_QupZilla->weView()->isLoading())
icon_ = p_QupZilla->weView()->animationLoading( p_QupZilla->tabWidget()->currentIndex(), false)->pixmap();
// const QPixmap* icon_ = 0;
QIcon icon_;
// if (!p_QupZilla->weView()->isLoading())
// icon_ = p_QupZilla->weView()->animationLoading( p_QupZilla->tabWidget()->currentIndex(), false)->pixmap();
icon_ = p_QupZilla->weView()->siteIcon();
if (!icon_) {
if (icon_.isNull()) {
m_siteIcon->setIcon(QIcon(":icons/locationbar/unknownpage.png"));
} else {
QIcon icon = *icon_;
m_siteIcon->setIcon(icon);
// QIcon icon(*icon_);
m_siteIcon->setIcon(icon_);
}
}

View File

@ -32,7 +32,7 @@ WebPage::WebPage(WebView* parent, QupZilla* mainClass)
setForwardUnsupportedContent(true);
setPluginFactory(new WebPluginFactory(this));
connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), SLOT(handleUnsupportedContent(QNetworkReply*)));
connect(this, SIGNAL(loadStarted()), this, SLOT(clearSSLCert()));
connect(this, SIGNAL(loadStarted()), this, SLOT(loadingStarted()));
}
void WebPage::handleUnsupportedContent(QNetworkReply* reply)
@ -66,6 +66,18 @@ void WebPage::setSSLCertificate(QSslCertificate cert)
m_SslCert = cert;
}
QSslCertificate WebPage::sslCertificate()
{
// QSslCertificate cert;
// foreach (QSslCertificate c, m_SslCerts) {
// qDebug() << c;
// if (c.subjectInfo(QSslCertificate::CommonName).contains(QRegExp(mainFrame()->url().host())))
// return c;
// }
// return cert;
return m_SslCert;
}
bool WebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type)
{
m_lastRequest = request;

View File

@ -46,7 +46,7 @@ public:
~WebPage();
void setSSLCertificate(QSslCertificate cert);
QSslCertificate sslCertificate() { return m_SslCert; }
QSslCertificate sslCertificate();
QString userAgentForUrl(const QUrl &url) const;
bool supportsExtension(Extension extension) const { return (extension == ErrorPageExtension); }
bool extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output);
@ -57,7 +57,7 @@ public:
protected slots:
QWebPage* createWindow(QWebPage::WebWindowType type);
void handleUnsupportedContent(QNetworkReply* url);
void clearSSLCert() { m_SslCert = 0; m_adBlockedEntries.clear(); }
void loadingStarted() { m_adBlockedEntries.clear(); /*m_SslCert.clear();*/ }
protected:
bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type);
@ -67,6 +67,7 @@ protected:
QWebPage::NavigationType m_lastRequestType;
WebView* m_view;
QSslCertificate m_SslCert;
QList<QSslCertificate> m_SslCerts;
QList<AdBlockedEntry> m_adBlockedEntries;
// bool m_isOpeningNextWindowAsNewTab;
};

View File

@ -76,8 +76,7 @@ WebView::WebView(QupZilla* mainClass, QWidget* parent)
void WebView::slotIconChanged()
{
if (!isLoading())
qDebug() << "icon changed";
m_siteIcon = icon();
}
WebPage* WebView::webPage() const
@ -233,7 +232,8 @@ void WebView::titleChanged()
void WebView::iconChanged()
{
QIcon icon_ = icon();
// QIcon icon_ = icon();
QIcon icon_ = siteIcon();
if (!icon_.isNull())
animationLoading(tabIndex(), false)->setPixmap(icon_.pixmap(16,16));
else

View File

@ -53,6 +53,7 @@ public:
WebPage* webPage() const;
QString getIp() { return m_currentIp; }
QLabel* animationLoading(int index, bool addMovie);
QIcon siteIcon() { return m_siteIcon; }
void addNotification(QWidget* notif);
bool hasRss() { return !m_rss.isEmpty(); }
QList<QPair<QString,QString> > getRss() { return m_rss; }
@ -122,6 +123,7 @@ private:
bool m_wantsClose;
QString m_currentIp;
QList<QPair<QString,QString> > m_rss;
QIcon m_siteIcon;
WebPage* m_page;
NetworkManagerProxy* m_networkProxy;