Permalink
Browse files

Porting QWebView (WebKit) to QWebEngineView

  • Loading branch information...
fcecconi committed Aug 12, 2017
1 parent 42afddb commit 674e565d384c21091554496c0a54640a2eded3ac
Showing with 20 additions and 23 deletions.
  1. +5 −7 CMakeLists.txt
  2. +1 −2 src/CMakeLists.txt
  3. +1 −2 src/platform/nsemanager.h
  4. +9 −9 src/platform/vulnerability.cpp
  5. +4 −3 src/platform/vulnerability.h
@@ -2,19 +2,18 @@ PROJECT( nmapsi4 )
set(VERSION_MAJOR 0)
set(VERSION_MINOR 4)
set(VERSION_PATCH 70)
set(VERSION_PATCH 80)
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
cmake_minimum_required(VERSION 2.8.2)
if (NOT WIN32 AND NOT APPLE)
FIND_PACKAGE(Qt5 5.2.0 COMPONENTS
FIND_PACKAGE(Qt5 5.4.0 COMPONENTS
Core
Widgets
Network
WebKitWidgets
WebKit
WebEngineWidgets
DBus
Script
LinguistTools
@@ -23,13 +22,12 @@ if (NOT WIN32 AND NOT APPLE)
Gui
REQUIRED)
else (NOT WIN32 AND NOT APPLE)
FIND_PACKAGE(Qt5 5.2.0
FIND_PACKAGE(Qt5 5.4.0
COMPONENTS
Core
Widgets
Network
WebKitWidgets
WebKit
WebEngineWidgets
Script
LinguistTools
Quick
@@ -145,10 +145,9 @@ endif (NOT WIN32 AND NOT APPLE)
target_link_libraries(nmapsi4
${QT5_LIBRARIES}
${QT5_QTWEBKIT_LIBRARY}
${QT5_QTNETWORK_LIBRARY}
Qt5::Widgets
Qt5::WebKitWidgets
Qt5::WebEngineWidgets
Qt5::DBus
Qt5::Quick
)
@@ -1,5 +1,5 @@
/*
Copyright 2011-2013 Francesco Cecconi <francesco.cecconi@gmail.com>
Copyright 2011-2017 Francesco Cecconi <francesco.cecconi@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
@@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QTreeWidgetItem>
#include <QtCore/QSettings>
#include <QtCore/QPointer>
#include <QWebView>
#include "processthread.h"
#include "memorytools.h"
@@ -1,5 +1,5 @@
/*
Copyright 2011-2015 Francesco Cecconi <francesco.cecconi@gmail.com>
Copyright 2011-2017 Francesco Cecconi <francesco.cecconi@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
@@ -192,14 +192,14 @@ void Vulnerability::openTab(const QUrl& address, const QString& tabName)
m_vulnerabilityWidget->tWresult->setVisible(true);
}
// create new tab with a QWebView
QWebView *page = new QWebView(m_ui);
// create new tab with a QWebEngineView
QWebEngineView *page = new QWebEngineView(m_ui);
page->setContextMenuPolicy(Qt::NoContextMenu);
m_webViewList.push_back(page);
page->load(address);
m_vulnerabilityWidget->tWresult->addTab(page, tabName);
connect(page, &QWebView::loadProgress, m_vulnerabilityWidget->progressWeb, &QProgressBar::setValue);
connect(page, &QWebView::loadFinished, this, &Vulnerability::vulnPostScan);
connect(page, &QWebEngineView::loadProgress, m_vulnerabilityWidget->progressWeb, &QProgressBar::setValue);
connect(page, &QWebEngineView::loadFinished, this, &Vulnerability::vulnPostScan);
}
void Vulnerability::searchVulnFromTreeWidget()
@@ -218,7 +218,7 @@ void Vulnerability::searchVulnFromTreeWidget()
void Vulnerability::closeVulnTab(int index)
{
QWebView *page = m_webViewList.takeAt(index);
QWebEngineView *page = m_webViewList.takeAt(index);
m_vulnerabilityWidget->tWresult->removeTab(index);
delete page;
@@ -232,17 +232,17 @@ void Vulnerability::closeVulnTab(int index)
void Vulnerability::tabWebBack()
{
m_webViewList[m_vulnerabilityWidget->tWresult->currentIndex()]->triggerPageAction(QWebPage::Back);
m_webViewList[m_vulnerabilityWidget->tWresult->currentIndex()]->triggerPageAction(QWebEnginePage::Back);
}
void Vulnerability::tabWebForward()
{
m_webViewList[m_vulnerabilityWidget->tWresult->currentIndex()]->triggerPageAction(QWebPage::Forward);
m_webViewList[m_vulnerabilityWidget->tWresult->currentIndex()]->triggerPageAction(QWebEnginePage::Forward);
}
void Vulnerability::tabWebStop()
{
m_webViewList[m_vulnerabilityWidget->tWresult->currentIndex()]->triggerPageAction(QWebPage::Stop);
m_webViewList[m_vulnerabilityWidget->tWresult->currentIndex()]->triggerPageAction(QWebEnginePage::Stop);
}
void Vulnerability::vulnPostScan()
@@ -1,5 +1,5 @@
/*
Copyright 2011-2013 Francesco Cecconi <francesco.cecconi@gmail.com>
Copyright 2011-2017 Francesco Cecconi <francesco.cecconi@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
@@ -27,7 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QCompleter>
#include <QStringListModel>
#include <QSplitter>
#include <QWebView>
#include <QWebEngineView>
#include <QWebEnginePage>
#include <QtQuick/QQuickView>
#include <QPointer>
@@ -65,7 +66,7 @@ class Vulnerability : public QObject
void updateCompleter();
const QList< QPair<QString, QString> > getDefaultUrlList();
QList<QWebView*> m_webViewList;
QList<QWebEngineView*> m_webViewList;
MainWindow* m_ui;
QQuickView* m_welcomeQml;
QCompleter* m_completerVuln;

0 comments on commit 674e565

Please sign in to comment.