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 ++- src/webtab/webpage.cpp | 16 ++-------------- src/webtab/webpage.h | 7 ++++--- 4 files changed, 30 insertions(+), 21 deletions(-) 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); diff --git a/src/webtab/webpage.cpp b/src/webtab/webpage.cpp index fae67ce6..8f454759 100644 --- a/src/webtab/webpage.cpp +++ b/src/webtab/webpage.cpp @@ -48,7 +48,6 @@ #include "websnap.h" #include "webtab.h" #include "sslinfodialog.h" -#include "sslwidget.h" #include "searchengine.h" #include "webwindow.h" @@ -893,18 +892,7 @@ bool WebPage::hasSslValid() const } -void WebPage::showSSLInfo(QPoint pos) +WebSslInfo WebPage::sslInfo() { - if (mainFrame()->url().scheme() == QL1S("https")) - { - SSLWidget *widget = new SSLWidget(mainFrame()->url(), _sslInfo, view()); - widget->showAt(pos); - } - else - { - KMessageBox::information(view(), - i18n("This site does not contain SSL information."), - i18nc("Secure Sockets Layer", "SSL") - ); - } + return _sslInfo; } diff --git a/src/webtab/webpage.h b/src/webtab/webpage.h index 43073d58..0f768f73 100644 --- a/src/webtab/webpage.h +++ b/src/webtab/webpage.h @@ -63,6 +63,8 @@ public: bool hasSslValid() const; + WebSslInfo sslInfo(); + public Q_SLOTS: void downloadAllContentsWithKGet(); @@ -84,8 +86,7 @@ private Q_SLOTS: void manageNetworkErrors(QNetworkReply *reply); void loadStarted(); void loadFinished(bool); - void showSSLInfo(QPoint); - + void copyToTempFileResult(KJob*); private: @@ -94,7 +95,7 @@ private: ProtocolHandler _protHandler; WebSslInfo _sslInfo; - + QString _mimeType; QString _suggestedFileName; -- cgit v1.2.1