1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Another cleanups

Removed printPage() functions + removed SslManager
This commit is contained in:
David Rosca 2015-09-29 23:40:59 +02:00
parent 730577c0e4
commit 36929a45bf
7 changed files with 0 additions and 607 deletions

View File

@ -1096,30 +1096,6 @@ bool BrowserWindow::event(QEvent* event)
return QMainWindow::event(event); return QMainWindow::event(event);
} }
void BrowserWindow::printPage(QWebEngineFrame* frame)
{
Q_UNUSED(frame)
#if QTWEBENGINE_DISABLED
QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->resize(800, 750);
dialog->printer()->setCreator(tr("QupZilla %1 (%2)").arg(Qz::VERSION, Qz::WWWADDRESS));
if (!frame) {
dialog->printer()->setDocName(QzTools::getFileNameFromUrl(weView()->url()));
connect(dialog, SIGNAL(paintRequested(QPrinter*)), weView(), SLOT(print(QPrinter*)));
}
else {
dialog->printer()->setDocName(QzTools::getFileNameFromUrl(QzTools::frameUrl(frame)));
connect(dialog, SIGNAL(paintRequested(QPrinter*)), frame, SLOT(print(QPrinter*)));
}
dialog->open();
#endif
}
void BrowserWindow::savePageScreen() void BrowserWindow::savePageScreen()
{ {
#if QTWEBENGINE_DISABLED #if QTWEBENGINE_DISABLED

View File

@ -140,7 +140,6 @@ public slots:
void bookmarkAllTabs(); void bookmarkAllTabs();
void loadAddress(const QUrl &url); void loadAddress(const QUrl &url);
void showSource(WebView *view = Q_NULLPTR); void showSource(WebView *view = Q_NULLPTR);
void printPage(QWebEngineFrame* frame = 0);
private slots: private slots:
void addTab(); void addTab();

View File

@ -176,7 +176,6 @@ SOURCES += \
preferences/pluginlistdelegate.cpp \ preferences/pluginlistdelegate.cpp \
preferences/pluginsmanager.cpp \ preferences/pluginsmanager.cpp \
preferences/preferences.cpp \ preferences/preferences.cpp \
preferences/sslmanager.cpp \
preferences/thememanager.cpp \ preferences/thememanager.cpp \
preferences/useragentdialog.cpp \ preferences/useragentdialog.cpp \
session/recoveryjsobject.cpp \ session/recoveryjsobject.cpp \
@ -374,7 +373,6 @@ HEADERS += \
preferences/pluginlistdelegate.h \ preferences/pluginlistdelegate.h \
preferences/pluginsmanager.h \ preferences/pluginsmanager.h \
preferences/preferences.h \ preferences/preferences.h \
preferences/sslmanager.h \
preferences/thememanager.h \ preferences/thememanager.h \
preferences/useragentdialog.h \ preferences/useragentdialog.h \
session/recoveryjsobject.h \ session/recoveryjsobject.h \
@ -471,7 +469,6 @@ FORMS += \
preferences/jsoptions.ui \ preferences/jsoptions.ui \
preferences/pluginslist.ui \ preferences/pluginslist.ui \
preferences/preferences.ui \ preferences/preferences.ui \
preferences/sslmanager.ui \
preferences/thememanager.ui \ preferences/thememanager.ui \
preferences/useragentdialog.ui \ preferences/useragentdialog.ui \
sidebar/bookmarkssidebar.ui \ sidebar/bookmarkssidebar.ui \

View File

@ -1036,9 +1036,6 @@ void Preferences::saveSettings()
mApp->history()->loadSettings(); mApp->history()->loadSettings();
mApp->reloadSettings(); mApp->reloadSettings();
mApp->plugins()->c2f_saveSettings(); mApp->plugins()->c2f_saveSettings();
#if QTWEBENGINE_DISABLED
mApp->networkManager()->loadSettings();
#endif
mApp->desktopNotifications()->loadSettings(); mApp->desktopNotifications()->loadSettings();
mApp->autoFill()->loadSettings(); mApp->autoFill()->loadSettings();
} }

View File

@ -1,242 +0,0 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "sslmanager.h"
#include "ui_sslmanager.h"
#include "networkmanager.h"
#include "mainapplication.h"
#include "qztools.h"
#include "certificateinfowidget.h"
#include <QFileDialog>
#include <QSslSocket>
SSLManager::SSLManager(QWidget* parent)
: QDialog(parent)
, ui(new Ui::SSLManager)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
ui->caList->setLayoutDirection(Qt::LeftToRight);
ui->localList->setLayoutDirection(Qt::LeftToRight);
ui->pathList->setLayoutDirection(Qt::LeftToRight);
refreshLocalList();
refreshCAList();
refreshPaths();
connect(ui->caList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(showCaCertInfo()));
connect(ui->caInfoButton, SIGNAL(clicked()), this, SLOT(showCaCertInfo()));
connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteCertificate()));
connect(ui->localList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(showLocalCertInfo()));
connect(ui->localInfoButton, SIGNAL(clicked()), this, SLOT(showLocalCertInfo()));
connect(ui->addLocalCert, SIGNAL(clicked()), this, SLOT(addLocalCertificate()));
connect(ui->addPath, SIGNAL(clicked()), this, SLOT(addPath()));
connect(ui->deletePath, SIGNAL(clicked()), this, SLOT(deletePath()));
connect(ui->ignoreAll, SIGNAL(clicked(bool)), this, SLOT(ignoreAll(bool)));
connect(ui->disableWeakCiphers, SIGNAL(clicked(bool)), this, SLOT(disableWeakCiphers(bool)));
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()));
// Settings
#if QTWEBENGINE_DISABLED
ui->disableWeakCiphers->setChecked(mApp->networkManager()->isDisablingWeakCiphers());
ui->ignoreAll->setChecked(mApp->networkManager()->isIgnoringAllWarnings());
#endif
}
void SSLManager::addPath()
{
QString path = QzTools::getExistingDirectory("SSLManager-AddPath", this, tr("Choose path..."));
if (path.isEmpty()) {
return;
}
ui->pathList->addItem(path);
}
void SSLManager::deletePath()
{
delete ui->pathList->currentItem();
}
void SSLManager::refreshCAList()
{
ui->caList->setUpdatesEnabled(false);
ui->caList->clear();
m_caCerts = QSslSocket::defaultCaCertificates();
foreach (const QSslCertificate &cert, m_caCerts) {
if (m_localCerts.contains(cert)) {
continue;
}
QListWidgetItem* item = new QListWidgetItem(ui->caList);
item->setText(CertificateInfoWidget::certificateItemText(cert));
item->setData(Qt::UserRole + 10, m_caCerts.indexOf(cert));
ui->caList->addItem(item);
}
ui->caList->setCurrentRow(0);
ui->caList->setUpdatesEnabled(true);
}
void SSLManager::refreshLocalList()
{
#if QTWEBENGINE_DISABLED
ui->localList->setUpdatesEnabled(false);
ui->localList->clear();
m_localCerts = mApp->networkManager()->getLocalCertificates();
foreach (const QSslCertificate &cert, m_localCerts) {
QListWidgetItem* item = new QListWidgetItem(ui->localList);
item->setText(CertificateInfoWidget::certificateItemText(cert));
item->setData(Qt::UserRole + 10, m_localCerts.indexOf(cert));
ui->localList->addItem(item);
}
ui->localList->setCurrentRow(0);
ui->localList->setUpdatesEnabled(true);
#endif
}
void SSLManager::refreshPaths()
{
#if QTWEBENGINE_DISABLED
foreach (const QString &path, mApp->networkManager()->certificatePaths()) {
ui->pathList->addItem(path);
}
#endif
}
void SSLManager::showCaCertInfo()
{
QListWidgetItem* item = ui->caList->currentItem();
if (!item) {
return;
}
QSslCertificate cert = m_caCerts.at(item->data(Qt::UserRole + 10).toInt());
showCertificateInfo(cert);
}
void SSLManager::addLocalCertificate()
{
#if QTWEBENGINE_DISABLED
const QString path = QzTools::getOpenFileName("SSLManager-AddLocalCert", this, tr("Import certificate..."), QDir::homePath(), "*.crt");
if (path.isEmpty()) {
return;
}
const QList<QSslCertificate> list = QSslCertificate::fromPath(path);
if (list.isEmpty()) {
return;
}
mApp->networkManager()->addLocalCertificate(list.at(0));
refreshLocalList();
#endif
}
void SSLManager::showLocalCertInfo()
{
QListWidgetItem* item = ui->localList->currentItem();
if (!item) {
return;
}
QSslCertificate cert = m_localCerts.at(item->data(Qt::UserRole + 10).toInt());
showCertificateInfo(cert);
}
void SSLManager::showCertificateInfo(const QSslCertificate &cert)
{
QDialog* w = new QDialog(this);
w->setAttribute(Qt::WA_DeleteOnClose);
w->setWindowTitle(tr("Certificate Informations"));
w->setLayout(new QVBoxLayout);
CertificateInfoWidget* c = new CertificateInfoWidget(cert);
w->layout()->addWidget(c);
QDialogButtonBox* b = new QDialogButtonBox(w);
b->setStandardButtons(QDialogButtonBox::Close);
connect(b, SIGNAL(clicked(QAbstractButton*)), w, SLOT(close()));
w->layout()->addWidget(b);
w->resize(w->sizeHint());
QzTools::centerWidgetToParent(w, this);
w->show();
}
void SSLManager::deleteCertificate()
{
#if QTWEBENGINE_DISABLED
QListWidgetItem* item = ui->localList->currentItem();
if (!item) {
return;
}
QSslCertificate cert = m_localCerts.at(item->data(Qt::UserRole + 10).toInt());
m_localCerts.removeOne(cert);
mApp->networkManager()->removeLocalCertificate(cert);
refreshLocalList();
#endif
}
void SSLManager::ignoreAll(bool state)
{
Q_UNUSED(state)
#if QTWEBENGINE_DISABLED
mApp->networkManager()->setIgnoreAllWarnings(state);
#endif
}
void SSLManager::disableWeakCiphers(bool state)
{
Q_UNUSED(state)
#if QTWEBENGINE_DISABLED
mApp->networkManager()->setDisableWeakCiphers(state);
#endif
}
void SSLManager::closeEvent(QCloseEvent* e)
{
#if QTWEBENGINE_DISABLED
QStringList paths;
for (int i = 0; i < ui->pathList->count(); i++) {
QListWidgetItem* item = ui->pathList->item(i);
if (!item || item->text().isEmpty()) {
continue;
}
paths.append(item->text());
}
mApp->networkManager()->setCertificatePaths(paths);
mApp->networkManager()->saveSettings();
#endif
QWidget::closeEvent(e);
}
SSLManager::~SSLManager()
{
delete ui;
}

View File

@ -1,65 +0,0 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef SSLMANAGER_H
#define SSLMANAGER_H
#include <QDialog>
#include <QSslCertificate>
#include "qzcommon.h"
namespace Ui
{
class SSLManager;
}
class QUPZILLA_EXPORT SSLManager : public QDialog
{
Q_OBJECT
public:
explicit SSLManager(QWidget* parent = 0);
~SSLManager();
private slots:
void showLocalCertInfo();
void showCaCertInfo();
void addLocalCertificate();
void deleteCertificate();
void ignoreAll(bool state);
void disableWeakCiphers(bool state);
void addPath();
void deletePath();
private:
void closeEvent(QCloseEvent* e);
void refreshLocalList();
void refreshCAList();
void refreshPaths();
void showCertificateInfo(const QSslCertificate &cert);
Ui::SSLManager* ui;
QList<QSslCertificate> m_localCerts;
QList<QSslCertificate> m_caCerts;
};
#endif // SSLMANAGER_H

View File

@ -1,269 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SSLManager</class>
<widget class="QDialog" name="SSLManager">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>653</width>
<height>389</height>
</rect>
</property>
<property name="windowTitle">
<string>Certificate Manager</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>CA Authorities Certificates</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QListWidget" name="caList"/>
</item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="caInfoButton">
<property name="text">
<string>Show info</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>This is a list of CA Authorities Certificates stored in the standard system path and in user specified paths.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Local Certificates</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QListWidget" name="localList"/>
</item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="addLocalCert">
<property name="text">
<string>Import</string>
</property>
</widget>
</item>
<item>
<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>
<item>
<widget class="QPushButton" name="localInfoButton">
<property name="text">
<string>Show info</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deleteButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>This is a list of Local Certificates stored in your user profile. It also contains all certificates, that have received an exception.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Settings</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="4" column="0">
<widget class="QListWidget" name="pathList"/>
</item>
<item row="4" column="1">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="addPath">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deletePath">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_3">
<property name="text">
<string>If CA Authorities Certificates were not automatically loaded from the system, you can specify paths manually where the certificates are stored.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>&lt;b&gt;NOTE:&lt;/b&gt; Setting this option is a high security risk!</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" 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>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="ignoreAll">
<property name="text">
<string>Ignore all SSL Warnings</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="disableWeakCiphers">
<property name="text">
<string>Disable weak ciphers</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="0" colspan="2">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>All certificates must have .crt suffix.
After adding or removing certificate paths, it is neccessary to restart QupZilla in order to take effect the changes.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>