From b6edd26ca08c95530f0f82561459e3765856058c Mon Sep 17 00:00:00 2001 From: Anmol Gautam Date: Wed, 2 May 2018 21:40:56 +0530 Subject: [PATCH] Use security state icon in popup location bar Reviewers: drosca Reviewed By: drosca Subscribers: falkon Tags: #falkon Differential Revision: https://phabricator.kde.org/D12666 --- src/lib/popupwindow/popuplocationbar.cpp | 11 ++++++++++- src/lib/popupwindow/popuplocationbar.h | 1 + src/lib/popupwindow/popupwindow.cpp | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib/popupwindow/popuplocationbar.cpp b/src/lib/popupwindow/popuplocationbar.cpp index 9fed1f2fe..93a72fa0c 100644 --- a/src/lib/popupwindow/popuplocationbar.cpp +++ b/src/lib/popupwindow/popuplocationbar.cpp @@ -106,5 +106,14 @@ void PopupLocationBar::showUrl(const QUrl &url) void PopupLocationBar::showSiteIcon() { - m_siteIcon->setIcon(m_view->icon()); + QIcon icon = IconProvider::emptyWebIcon(); + if (property("secured").toBool()) { + icon = QIcon::fromTheme(QSL("document-encrypted"), icon); + } + m_siteIcon->setIcon(QIcon(icon.pixmap(16))); +} + +void PopupLocationBar::setPrivacyState(bool state) +{ + setProperty("secured", QVariant(state)); } diff --git a/src/lib/popupwindow/popuplocationbar.h b/src/lib/popupwindow/popuplocationbar.h index 41c2a29f7..031cf0261 100644 --- a/src/lib/popupwindow/popuplocationbar.h +++ b/src/lib/popupwindow/popuplocationbar.h @@ -46,6 +46,7 @@ public: public Q_SLOTS: void showUrl(const QUrl &url); void showSiteIcon(); + void setPrivacyState(bool state); private: PopupWebView* m_view; diff --git a/src/lib/popupwindow/popupwindow.cpp b/src/lib/popupwindow/popupwindow.cpp index 860bc1f90..41835c401 100644 --- a/src/lib/popupwindow/popupwindow.cpp +++ b/src/lib/popupwindow/popupwindow.cpp @@ -143,6 +143,7 @@ PopupWindow::PopupWindow(PopupWebView* view) connect(m_view, &WebView::loadStarted, this, &PopupWindow::loadStarted); connect(m_view, &WebView::loadProgress, this, &PopupWindow::loadProgress); connect(m_view, &WebView::loadFinished, this, &PopupWindow::loadFinished); + connect(m_view, &WebView::privacyChanged, m_locationBar, &PopupLocationBar::setPrivacyState); auto pageChanged = [this](WebPage *page) { connect(page, &WebPage::linkHovered, this, &PopupWindow::showStatusBarMessage);