From 27addebee71183965720662b05be2caf619d4d57 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 12 Jul 2013 15:46:50 +0200 Subject: Review ssl widget generation code. This also seems to fix some way problem about multiple widget creations What about you, guys? CCBUG:321226 --- src/urlbar/urlbar.cpp | 25 ++++++++++++++++++++++--- src/urlbar/urlbar.h | 3 ++- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'src/urlbar') diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index 6775e02c..87e30f48 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -45,6 +45,7 @@ #include "adblockwidget.h" #include "bookmarkwidget.h" #include "rsswidget.h" +#include "sslwidget.h" #include "completionwidget.h" #include "urlresolver.h" @@ -61,6 +62,7 @@ #include #include #include +#include #include #include @@ -647,7 +649,7 @@ void UrlBar::suggest() void UrlBar::refreshFavicon() { - disconnect(_icon); + _icon->disconnect(); const QString scheme = _tab->url().protocol(); @@ -668,7 +670,7 @@ void UrlBar::refreshFavicon() _icon->setIcon(KIcon("security-low")); } - connect(_icon, SIGNAL(clicked(QPoint)), _tab->page(), SLOT(showSSLInfo(QPoint))); + connect(_icon, SIGNAL(clicked(QPoint)), this, SLOT(showSSLInfo(QPoint)), Qt::UniqueConnection); return; } @@ -759,7 +761,7 @@ void UrlBar::updateRightIconPosition(IconButton *icon, int iconsCount) } -void UrlBar::showRSSInfo(const QPoint &pos) +void UrlBar::showRSSInfo(QPoint pos) { QWebElementCollection col = _tab->page()->mainFrame()->findAllElements("link[type=\"application/rss+xml\"]"); col.append(_tab->page()->mainFrame()->findAllElements("link[type=\"application/atom+xml\"]")); @@ -793,6 +795,23 @@ void UrlBar::showRSSInfo(const QPoint &pos) } +void UrlBar::showSSLInfo(QPoint pos) +{ + if (_tab->url().scheme() == QL1S("https")) + { + SSLWidget *widget = new SSLWidget(_tab->url(), _tab->page()->sslInfo(), this); + widget->showAt(pos); + } + else + { + KMessageBox::information(this, + i18n("This site does not contain SSL information."), + i18nc("Secure Sockets Layer", "SSL") + ); + } +} + + void UrlBar::manageStarred(QPoint pos) { KMenu menu; diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h index 9c645f00..324e489b 100644 --- a/src/urlbar/urlbar.h +++ b/src/urlbar/urlbar.h @@ -127,7 +127,8 @@ private Q_SLOTS: */ void loadTypedUrl(); - void showRSSInfo(const QPoint &); + void showRSSInfo(QPoint); + void showSSLInfo(QPoint); protected: void paintEvent(QPaintEvent *event); -- cgit v1.2.1