1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

Added basic SSL Certificate support and improved about site dialog (not

final version yet)
This commit is contained in:
nowrep 2011-03-22 21:36:15 +01:00
parent 3cfe47cf82
commit 09c4747ab6
18 changed files with 586 additions and 116 deletions

View File

@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>282</width>
<width>250</width>
<height>166</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>

View File

@ -66,5 +66,8 @@
<file>icons/other/keys.png</file>
<file>icons/other/bigrss.png</file>
<file>icons/preferences/applications-fonts.png</file>
<file>icons/preferences/applications-graphics.png</file>
<file>icons/preferences/document-properties.png</file>
<file>icons/preferences/stock_keyring.png</file>
</qresource>
</RCC>

View File

@ -26,6 +26,7 @@
#include "bookmarksmodel.h"
#include "siteinfowidget.h"
#include "rsswidget.h"
#include "webpage.h"
LocationBar::LocationBar(QupZilla* mainClass, QWidget* parent)
: LineEdit(parent)
@ -174,6 +175,9 @@ void LocationBar::rssIconClicked()
void LocationBar::checkBookmark()
{
if (!m_bookmarksModel)
m_bookmarksModel = mApp->bookmarks();
if (m_bookmarksModel->isBookmarked(QUrl(text()))) {
m_bookmarkButton->setPixmap(QPixmap(":/icons/locationbar/star.png"));
m_bookmarkButton->setToolTip(tr("Edit this bookmark"));
@ -217,14 +221,14 @@ void LocationBar::showUrl(const QUrl &url, bool empty)
setText(url.toEncoded());
setCursorPosition(0);
}
if (url.scheme() == "https")
setPrivacy(true);
else setPrivacy(false);
if (p_QupZilla->weView()->isLoading()) {
WebView* view = p_QupZilla->weView();
setPrivacy(view->webPage()->sslCertificate().isValid());
if (view->isLoading()) {
p_QupZilla->ipLabel()->hide();
p_QupZilla->progressBar()->setVisible(true);
p_QupZilla->progressBar()->setValue(p_QupZilla->weView()->getLoading());
p_QupZilla->progressBar()->setValue(view->getLoading());
p_QupZilla->buttonStop()->setVisible(true);
p_QupZilla->buttonReload()->setVisible(false);
p_QupZilla->statusBar()->showMessage(tr("Loading..."));
@ -236,12 +240,8 @@ void LocationBar::showUrl(const QUrl &url, bool empty)
p_QupZilla->ipLabel()->show();
}
hideGoButton();
if (!m_bookmarksModel)
m_bookmarksModel = mApp->bookmarks();
checkBookmark();
m_rssIcon->setVisible(p_QupZilla->weView()->hasRss());
m_rssIcon->setVisible(view->hasRss());
}

View File

@ -20,6 +20,7 @@
#include "autofillmodel.h"
#include "networkmanagerproxy.h"
#include "mainapplication.h"
#include "webpage.h"
NetworkManager::NetworkManager(QupZilla* mainClass, QObject* parent) :
NetworkManagerProxy(mainClass, parent)
@ -28,7 +29,7 @@ NetworkManager::NetworkManager(QupZilla* mainClass, QObject* parent) :
{
connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authentication(QNetworkReply*, QAuthenticator* )));
connect(this, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), this, SLOT(sslError(QNetworkReply*,QList<QSslError>)));
// connect(this, SIGNAL(finished(QNetworkReply*)), this, SLOT(setSSLConfiguration(QNetworkReply*)));
connect(this, SIGNAL(finished(QNetworkReply*)), this, SLOT(setSSLConfiguration(QNetworkReply*)));
loadSettings();
}
@ -46,23 +47,32 @@ void NetworkManager::loadSettings()
}
m_ignoreAllWarnings = settings.value("IgnoreAllSSLWarnings", false).toBool();
settings.endGroup();
QSslConfiguration config = QSslConfiguration::defaultConfiguration();
config.setProtocol(QSsl::AnyProtocol);
QSslConfiguration::setDefaultConfiguration(config);
}
//void NetworkManager::setSSLConfiguration(QNetworkReply *reply)
//{
// if (!reply->sslConfiguration().isNull()) {
// QNetworkRequest request = reply->request();
// QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
// QWebPage* webPage = (QWebPage*)(v.value<void*>());
// v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 102));
// WebView* webView = (WebView*)(v.value<void*>());
// if (!webPage || !webView)
// return;
void NetworkManager::setSSLConfiguration(QNetworkReply *reply)
{
if (!reply->sslConfiguration().isNull()) {
QSslCertificate cert = reply->sslConfiguration().peerCertificate();
if (!cert.isValid())
return;
// if (webView->url().host() == reply->url().host())
// qDebug() << reply->sslConfiguration().peerCertificate() << webPage << webView;
// }
//}
QNetworkRequest request = reply->request();
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
WebPage* webPage = (WebPage*)(v.value<void*>());
v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 102));
WebView* webView = (WebView*)(v.value<void*>());
if (!webPage || !webView)
return;
if (webView->url().host() == reply->url().host())
webPage->setSSLCertificate( cert );
}
}
void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> errors)
{

View File

@ -53,7 +53,7 @@ signals:
public slots:
void authentication(QNetworkReply* reply, QAuthenticator* auth);
void sslError(QNetworkReply* reply, QList<QSslError> errors);
// void setSSLConfiguration(QNetworkReply* reply);
void setSSLConfiguration(QNetworkReply* reply);
private:
QupZilla* p_QupZilla;

View File

@ -51,7 +51,7 @@ void AboutDialog::showAbout()
m_aboutHtml.append(tr("<p>&copy; %1 %2<br/>All rights reserved.<br/>").arg(QupZilla::COPYRIGHT, QupZilla::AUTHOR));
m_aboutHtml.append(tr("Build time: %1 </p>").arg(QupZilla::BUILDTIME));
m_aboutHtml.append(QString("<p><a href=%1>%1</a></p>").arg(QupZilla::WWWADDRESS));
m_aboutHtml.append("<p>"+mApp->getWindow()->weView()->getPage()->userAgentForUrl(QUrl())+"</p>");
m_aboutHtml.append("<p>"+mApp->getWindow()->weView()->webPage()->userAgentForUrl(QUrl())+"</p>");
m_aboutHtml.append("</div>");
}
ui->textBrowser->setHtml(m_aboutHtml);

View File

@ -512,7 +512,6 @@ void Preferences::saveSettings()
Preferences::~Preferences()
{
qDebug() << __FUNCTION__ << "called";
delete ui;
delete m_autoFillManager;
delete m_pluginsList;

View File

@ -26,6 +26,9 @@
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>

View File

@ -43,6 +43,7 @@ private slots:
void ignoreAll(bool state);
private:
void refresh();
Ui::SSLManager* ui;
QList<QSslCertificate> m_certs;
};

View File

@ -19,6 +19,7 @@
#include "ui_siteinfo.h"
#include "qupzilla.h"
#include "webview.h"
#include "webpage.h"
SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
QDialog(parent)
@ -29,12 +30,14 @@ SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
WebView* view = p_QupZilla->weView();
QWebFrame* frame = view->page()->mainFrame();
QString title = view->title();
if (title.isEmpty())
title = tr("No Named Page");
QSslCertificate cert = view->webPage()->sslCertificate();
ui->siteName->setText(title);
//GENERAL
ui->heading->setText(QString("<b>%1</b>:").arg(title));
ui->siteAddress->setText(frame->baseUrl().toString());
//Meta
QWebElementCollection meta = frame->findAllElements("meta");
for (int i = 0; i<meta.count(); i++) {
QWebElement element = meta.at(i);
@ -52,6 +55,7 @@ SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
ui->treeTags->addTopLevelItem(item);
}
//MEDIA
QWebElementCollection img = frame->findAllElements("img");
for (int i = 0; i<img.count(); i++) {
QWebElement element = img.at(i);
@ -75,6 +79,35 @@ SiteInfo::SiteInfo(QupZilla* mainClass, QWidget* parent) :
ui->treeImages->addTopLevelItem(item);
}
//SECURITY
if (cert.isValid()) {
ui->certLabel->setText(tr("<b>Your connection to this page is secured: </b>"));
//Issued to
ui->issuedToCN->setText( cert.subjectInfo(QSslCertificate::CommonName) );
ui->issuedToO->setText( cert.subjectInfo(QSslCertificate::Organization) );
ui->issuedToOU->setText( cert.subjectInfo(QSslCertificate::OrganizationalUnitName) );
ui->issuedToSN->setText( cert.serialNumber() );
//Issued By
ui->issuedByCN->setText( cert.issuerInfo(QSslCertificate::CommonName) );
ui->issuedByO->setText( cert.issuerInfo(QSslCertificate::Organization) );
ui->issuedByOU->setText( cert.issuerInfo(QSslCertificate::OrganizationalUnitName) );
//Validity
ui->validityIssuedOn->setText( cert.effectiveDate().toString("dddd d. MMMM yyyy") );
ui->validityExpiresOn->setText( cert.expiryDate().toString("dddd d. MMMM yyyy") );
} else {
ui->certFrame->setVisible(false);
ui->certLabel->setText(tr("<b>Your connection to this page is not secured!</b>"));
}
connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
}
void SiteInfo::itemChanged(QListWidgetItem *item)
{
if (!item)
return;
int index = item->whatsThis().toInt();
ui->stackedWidget->setCurrentIndex(index);
}
SiteInfo::~SiteInfo()

View File

@ -19,6 +19,7 @@
#define SITEINFO_H
#include <QDialog>
#include <QListWidgetItem>
namespace Ui {
class SiteInfo;
@ -33,6 +34,9 @@ public:
explicit SiteInfo(QupZilla* mainClass, QWidget* parent = 0);
~SiteInfo();
private slots:
void itemChanged(QListWidgetItem* item);
private:
Ui::SiteInfo* ui;
QupZilla* p_QupZilla;

View File

@ -6,53 +6,19 @@
<rect>
<x>0</x>
<y>0</y>
<width>727</width>
<height>571</height>
<width>590</width>
<height>455</height>
</rect>
</property>
<property name="windowTitle">
<string>Site Info</string>
</property>
<property name="windowIcon">
<iconset resource="icons.qrc">
<iconset resource="../data/icons.qrc">
<normaloff>:/icons/qupzilla.png</normaloff>:/icons/qupzilla.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="0" colspan="2">
<widget class="QTreeWidget" name="treeTags">
<attribute name="headerDefaultSectionSize">
<number>200</number>
</attribute>
<column>
<property name="text">
<string>Tag</string>
</property>
</column>
<column>
<property name="text">
<string>Value</string>
</property>
</column>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QTreeWidget" name="treeImages">
<attribute name="headerDefaultSectionSize">
<number>200</number>
</attribute>
<column>
<property name="text">
<string>Image</string>
</property>
</column>
<column>
<property name="text">
<string>Image address</string>
</property>
</column>
</widget>
</item>
<item row="6" column="0" colspan="2">
<item row="7" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -62,52 +28,479 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<item row="1" column="1">
<widget class="SqueezeLabel" name="heading">
<property name="text">
<string>Site address:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Site name:</string>
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="SqueezeLabel" name="siteName">
<property name="text">
<string/>
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>55</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="flow">
<enum>QListView::LeftToRight</enum>
</property>
<property name="resizeMode">
<enum>QListView::Fixed</enum>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="currentRow">
<number>0</number>
</property>
<item>
<property name="text">
<string>General</string>
</property>
<property name="whatsThis">
<string notr="true">0</string>
</property>
<property name="icon">
<iconset resource="../data/icons.qrc">
<normaloff>:/icons/preferences/document-properties.png</normaloff>:/icons/preferences/document-properties.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Media</string>
</property>
<property name="whatsThis">
<string notr="true">1</string>
</property>
<property name="icon">
<iconset resource="../data/icons.qrc">
<normaloff>:/icons/preferences/applications-graphics.png</normaloff>:/icons/preferences/applications-graphics.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Security</string>
</property>
<property name="whatsThis">
<string notr="true">2</string>
</property>
<property name="icon">
<iconset resource="../data/icons.qrc">
<normaloff>:/icons/preferences/stock_keyring.png</normaloff>:/icons/preferences/stock_keyring.png</iconset>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="SqueezeLabel" name="siteAddress">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Meta tags of site:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Images on site:</string>
<item row="4" column="1">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" colspan="3">
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="1" column="1">
<widget class="SqueezeLabel" name="encodingLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Size:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="SqueezeLabel" name="sizeLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="SqueezeLabel" name="siteAddress">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Site address:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Encoding:</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="3">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Meta tags of site:</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QTreeWidget" name="treeTags">
<attribute name="headerDefaultSectionSize">
<number>200</number>
</attribute>
<column>
<property name="text">
<string>Tag</string>
</property>
</column>
<column>
<property name="text">
<string>Value</string>
</property>
</column>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;b&gt;Security information&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="securityLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="secDetailsButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Details</string>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
<zorder>label_9</zorder>
<zorder>treeTags</zorder>
<zorder>label_2</zorder>
<zorder>securityLabel</zorder>
<zorder>secDetailsButton</zorder>
<zorder>horizontalSpacer</zorder>
</widget>
<widget class="QWidget" name="page_3">
<layout class="QGridLayout" name="gridLayout_3">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTreeWidget" name="treeImages">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>150</height>
</size>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<attribute name="headerDefaultSectionSize">
<number>200</number>
</attribute>
<column>
<property name="text">
<string>Image</string>
</property>
</column>
<column>
<property name="text">
<string>Image address</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>&lt;b&gt;Preview&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QGraphicsView" name="mediaPreview"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<layout class="QGridLayout" name="gridLayout_4">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="2" column="0">
<widget class="QFrame" name="certFrame">
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;b&gt;Issued To&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Common Name (CN):</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="SqueezeLabel" name="issuedToCN">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Organization (O):</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="SqueezeLabel" name="issuedToO">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Organizational Unit (OU):</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="SqueezeLabel" name="issuedToOU">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Serial Number:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="SqueezeLabel" name="issuedToSN">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>&lt;b&gt;Issued By&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_17">
<property name="text">
<string>Common Name (CN):</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="SqueezeLabel" name="issuedByCN">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Organization (O):</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="SqueezeLabel" name="issuedByO">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Organizational Unit (OU):</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="SqueezeLabel" name="issuedByOU">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>&lt;b&gt;Validity&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Issued On:</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="SqueezeLabel" name="validityIssuedOn">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Expires On:</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="SqueezeLabel" name="validityExpiresOn">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="certLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@ -120,7 +513,7 @@
</customwidget>
</customwidgets>
<resources>
<include location="icons.qrc"/>
<include location="../data/icons.qrc"/>
</resources>
<connections>
<connection>

View File

@ -18,21 +18,22 @@
#include "siteinfowidget.h"
#include "ui_siteinfowidget.h"
#include "qupzilla.h"
#include "webpage.h"
SiteInfoWidget::SiteInfoWidget(QupZilla* mainClass, QWidget* parent) :
QMenu(parent)
,ui(new Ui::SiteInfoWidget)
,p_QupZilla(mainClass)
{
QUrl url = p_QupZilla->weView()->url();
WebView* view = p_QupZilla->weView();
QUrl url = view->url();
if (url.isEmpty())
return;
this->setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
QString scheme = url.scheme();
if (scheme == "https") {
if (view->webPage()->sslCertificate().isValid()) {
ui->secureLabel->setText(tr("Your connection to this site is <b>secured</b>."));
ui->secureIcon->setPixmap(QPixmap(":/icons/locationbar/accept.png"));
}
@ -41,6 +42,7 @@ SiteInfoWidget::SiteInfoWidget(QupZilla* mainClass, QWidget* parent) :
ui->secureIcon->setPixmap(QPixmap(":/icons/locationbar/warning.png"));
}
QString scheme = url.scheme();
QSqlQuery query;
QString host = url.host();
QString host2 = host;

View File

@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>213</width>
<height>140</height>
<width>117</width>
<height>89</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>

View File

@ -31,7 +31,7 @@ WebPage::WebPage(WebView* parent, QupZilla* mainClass)
setForwardUnsupportedContent(true);
setPluginFactory(new WebPluginFactory(this));
connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), SLOT(handleUnsupportedContent(QNetworkReply*)));
// connect(this, SIGNAL())
connect(this, SIGNAL(loadStarted()), this, SLOT(clearSSLCert()));
}
void WebPage::handleUnsupportedContent(QNetworkReply* reply)
@ -60,6 +60,12 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply)
qDebug() << "error" << reply->errorString();
}
void WebPage::setSSLCertificate(QSslCertificate cert)
{
// if (cert != m_SslCert)
m_SslCert = cert;
}
bool WebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type)
{
m_lastRequest = request;

View File

@ -40,6 +40,8 @@ public:
void populateNetworkRequest(QNetworkRequest &request);
~WebPage();
void setSSLCertificate(QSslCertificate cert);
QSslCertificate sslCertificate() { return m_SslCert; }
QString userAgentForUrl(const QUrl &url) const;
bool supportsExtension(Extension extension) const { return (extension == ErrorPageExtension); }
bool extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output);
@ -47,6 +49,7 @@ public:
protected slots:
QWebPage* createWindow(QWebPage::WebWindowType type);
void handleUnsupportedContent(QNetworkReply* url);
void clearSSLCert() { m_SslCert = 0; }
protected:
bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type);
@ -55,6 +58,7 @@ protected:
QNetworkRequest m_lastRequest;
QWebPage::NavigationType m_lastRequestType;
WebView* m_view;
QSslCertificate m_SslCert;
};
#endif // WEBPAGE_H

View File

@ -73,7 +73,7 @@ WebView::WebView(QupZilla* mainClass, QWidget* parent)
m_zoomLevels << 30 << 50 << 67 << 80 << 90 << 100 << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
}
WebPage* WebView::getPage() const
WebPage* WebView::webPage() const
{
return m_page;
}

View File

@ -50,7 +50,7 @@ public:
QUrl url() const;
QString title() const;
void reload();
WebPage* getPage() const;
WebPage* webPage() const;
QString getIp() { return m_currentIp; }
QLabel* animationLoading(int index, bool addMovie);
void addNotification(QWidget* notif);