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

Initial port to QtWebEngine

This is first quick port to QtWebEngine, most of advanced features
are not working yet. Please read README.

For now, it will use separate profile directory as well as browser
session, that means you can use both QtWebEngine and QtWebKit versions
at the same time.
This commit is contained in:
David Rosca 2015-01-27 11:01:52 +01:00
parent cc08957148
commit 60b2386a6e
107 changed files with 1013 additions and 570 deletions

1
.gitignore vendored
View File

@ -5,7 +5,6 @@ DEBIAN
*.autosave *.autosave
*~ *~
*.a *.a
*.orig
*.qm *.qm
*.o *.o
!qt_*.qm !qt_*.qm

View File

@ -24,4 +24,4 @@ src_main.depends = sub-src-lib
src_plugins.subdir = src/plugins src_plugins.subdir = src/plugins
src_plugins.depends = sub-src-lib src_plugins.depends = sub-src-lib
SUBDIRS += src_lib src_main src_plugins SUBDIRS += src_lib src_main

View File

@ -1,99 +1,15 @@
QupZilla Web Browser QupZilla Web Browser - QtWebEngine
---------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------
[![Build Status](https://travis-ci.org/QupZilla/qupzilla.svg?branch=master)](https://travis-ci.org/QupZilla/qupzilla)
Homepage: [http://www.qupzilla.com](http://www.qupzilla.com) Homepage: [http://www.qupzilla.com](http://www.qupzilla.com)
Blog: [http://blog.qupzilla.com](http://blog.qupzilla.com) Blog: [http://blog.qupzilla.com](http://blog.qupzilla.com)
IRC: `#qupzilla` at `irc.freenode.net` IRC: `#qupzilla` at `irc.freenode.net`
Translations: [https://www.transifex.com](https://www.transifex.com/projects/p/qupzilla) Translations: [https://www.transifex.com](https://www.transifex.com/projects/p/qupzilla)
About QupZilla THIS IS QTWEBENGINE BRANCH
---------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------
QupZilla is a new and very fast QtWebKit browser. It aims to be a lightweight web browser Master branch is now for QtWebEngine. It is still in very early development state, so except
available through all major platforms. This project has been originally started only a lot of features found in QtWebKit branch not working here. Thanks for understanding!
for educational purposes. But from its start, QupZilla has grown into a feature-rich browser.
For QtWebKit, please use [v1.8](https://github.com/QupZilla/qupzilla/tree/v1.8)
QupZilla has all standard functions you expect from a web browser. It includes bookmarks,
history (both also in sidebar) and tabs. Above that, you can manage RSS feeds with an included
RSS reader, block ads with a built-in AdBlock plugin, block Flash content with Click2Flash
and edit the local CA Certificates database with an SSL Manager.
QupZilla's main aim is to be a very fast and very stable QtWebKit browser available to everyone.
There are already a lot of QtWebKit browsers available, but they are either bound to the KDE
environment (rekonq), are not actively developed or very unstable and miss important
features. But there is missing a multi-platform, modern and actively developed browser. QupZilla
is trying to fill this gap by providing a very stable browsing experience.
History
----------------------------------------------------------------------------------------
The very first version of QupZilla has been released in December 2010 and it was written
in Python with PyQt4 bindings. After a few versions, QupZilla has been completely rewritten
in C++ with the Qt Framework. The Windows version of QupZilla was compiled using MingW, but due to
a huge problem with Flash, it is now compiled with Microsoft Visual C++ Compiler 2008.
First public release was 1.0.0-b4.
Compiling
----------------------------------------------------------------------------------------
Before you start compiling, make sure that you have installed the Qt (>=4.7) development libraries
and you have read the [BUILDING](https://github.com/QupZilla/qupzilla/blob/master/BUILDING) information.
**Linux**
* OpenSSL (libcrypto) is required
* pkg-config is recommended (to correctly detect versions of QtWebKit)
* pkg-config is required for Hunspell spellcheck
* Hunspell development package for spellcheck
* QtWebKit 2.3 is needed to have support for spellcheck
**Windows**
* OpenSSL (libeay32) is required
* QtWebKit 2.3 is required
* Hunspell library is required for spellcheck
Then you can start compiling by running this commands:
$ qmake
$ make
After a successful compilation the executable binary can be found in the bin/ directory.
On Fedora and possibly other Linux distributions you need to replace `qmake` with `qmake-qt4` or `qmake-qt5` since `qmake` is for Qt3.
On Linux/Unix: To install QupZilla, run this command: (it may be necessary to run it as root)
$ make install
On Mac OS X: To deploy QupZilla in dmg image, run this command:
$ ./mac/macdeploy.sh full-path-to-macdeployqt
You need to specify path to `macdeployqt` only if it is not in PATH.
Current version
----------------------------------------------------------------------------------------
The current stable version of QupZilla is 1.8.6. You can download precompiled packages
and the sources from the download section at [homepage](http://www.qupzilla.com/download).
However, if you want the latest revision, just take the latest code snapshot either by
downloading a tarball or running:
$ git clone git://github.com/QupZilla/qupzilla.git
If you are using Ubuntu, you can download QupZilla from PPA:
$ sudo add-apt-repository ppa:nowrep/qupzilla
$ sudo apt-get update
$ sudo apt-get install qupzilla
for development version:
$ sudo apt-get install qupzilla-next
FAQ and Changelog
----------------------------------------------------------------------------------------
If you are experiencing some sort of problem, please read the FAQ before you open an issue.
[FAQ](https://github.com/QupZilla/qupzilla/wiki/FAQ) | [Changelog](https://github.com/QupZilla/qupzilla/blob/master/CHANGELOG) | [Bug Reports](https://github.com/QupZilla/qupzilla/wiki/Bug-Reports)

View File

@ -53,8 +53,7 @@
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QNetworkRequest> #include <QNetworkRequest>
#include <QWebFrame> #include <QWebEnginePage>
#include <QWebPage>
// Version for Qt < 4.8 has one issue, it will wrongly // Version for Qt < 4.8 has one issue, it will wrongly
// count .co.uk (and others) as second-level domain // count .co.uk (and others) as second-level domain
@ -352,12 +351,13 @@ bool AdBlockRule::matchObject(const QNetworkRequest &request) const
bool AdBlockRule::matchSubdocument(const QNetworkRequest &request) const bool AdBlockRule::matchSubdocument(const QNetworkRequest &request) const
{ {
QWebFrame* originatingFrame = static_cast<QWebFrame*>(request.originatingObject()); #if QTWEBENGINE_DISABLED
QWebEngineFrame* originatingFrame = static_cast<QWebEngineFrame*>(request.originatingObject());
if (!originatingFrame) { if (!originatingFrame) {
return false; return false;
} }
QWebPage* page = originatingFrame->page(); QWebEnginePage* page = originatingFrame->page();
if (!page) { if (!page) {
return false; return false;
} }
@ -365,6 +365,9 @@ bool AdBlockRule::matchSubdocument(const QNetworkRequest &request) const
bool match = !(originatingFrame == page->mainFrame()); bool match = !(originatingFrame == page->mainFrame());
return hasException(SubdocumentOption) ? !match : match; return hasException(SubdocumentOption) ? !match : match;
#else
return false;
#endif
} }
bool AdBlockRule::matchXmlHttpRequest(const QNetworkRequest &request) const bool AdBlockRule::matchXmlHttpRequest(const QNetworkRequest &request) const

View File

@ -82,8 +82,7 @@
#include <QDesktopServices> #include <QDesktopServices>
#include <QPrintPreviewDialog> #include <QPrintPreviewDialog>
#include <QPrinter> #include <QPrinter>
#include <QWebFrame> #include <QWebEngineHistory>
#include <QWebHistory>
#include <QMessageBox> #include <QMessageBox>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QToolTip> #include <QToolTip>
@ -105,7 +104,11 @@
#endif #endif
#endif /* Q_OS_WIN */ #endif /* Q_OS_WIN */
#if QTWEBENGINE_DISABLED
const QString BrowserWindow::WEBKITVERSION = qWebKitVersion(); const QString BrowserWindow::WEBKITVERSION = qWebKitVersion();
#else
const QString BrowserWindow::WEBKITVERSION = QSL("QtWebEngine");
#endif
static QKeySequence actionShortcut(QKeySequence shortcut, QKeySequence fallBack, QKeySequence shortcutRTL = QKeySequence(), QKeySequence fallbackRTL = QKeySequence()) static QKeySequence actionShortcut(QKeySequence shortcut, QKeySequence fallBack, QKeySequence shortcutRTL = QKeySequence(), QKeySequence fallbackRTL = QKeySequence())
{ {
@ -197,6 +200,7 @@ void BrowserWindow::postLaunch()
switch (m_windowType) { switch (m_windowType) {
case Qz::BW_FirstAppWindow: case Qz::BW_FirstAppWindow:
#if QTWEBENGINE_DISABLED
if (mApp->isStartingAfterCrash()) { if (mApp->isStartingAfterCrash()) {
addTab = true; addTab = true;
startUrl = QUrl("qupzilla:restore"); startUrl = QUrl("qupzilla:restore");
@ -204,6 +208,11 @@ void BrowserWindow::postLaunch()
else if (afterLaunch == 3 && mApp->restoreManager()) { else if (afterLaunch == 3 && mApp->restoreManager()) {
addTab = !mApp->restoreSession(this, mApp->restoreManager()->restoreData()); addTab = !mApp->restoreSession(this, mApp->restoreManager()->restoreData());
} }
#else
if (afterLaunch == 3 && mApp->restoreManager()) {
addTab = !mApp->restoreSession(this, mApp->restoreManager()->restoreData());
}
#endif
else { else {
// Pinned tabs are restored in MainApplication::restoreStateSlot // Pinned tabs are restored in MainApplication::restoreStateSlot
// Make sure they will be restored also when not restoring session // Make sure they will be restored also when not restoring session
@ -427,7 +436,11 @@ void BrowserWindow::createEncodingSubMenu(const QString &name, QStringList &code
std::sort(codecNames.begin(), codecNames.end()); std::sort(codecNames.begin(), codecNames.end());
QMenu* subMenu = new QMenu(name, menu); QMenu* subMenu = new QMenu(name, menu);
#if QTWEBENGINE_DISABLED
const QString activeCodecName = QWebSettings::globalSettings()->defaultTextEncoding(); const QString activeCodecName = QWebSettings::globalSettings()->defaultTextEncoding();
#else
const QString activeCodecName = QL1S("UTF-8");
#endif
foreach (const QString &codecName, codecNames) { foreach (const QString &codecName, codecNames) {
subMenu->addAction(createEncodingAction(codecName, activeCodecName, subMenu)); subMenu->addAction(createEncodingAction(codecName, activeCodecName, subMenu));
@ -668,7 +681,9 @@ void BrowserWindow::changeEncoding()
{ {
if (QAction* action = qobject_cast<QAction*>(sender())) { if (QAction* action = qobject_cast<QAction*>(sender())) {
const QString encoding = action->data().toString(); const QString encoding = action->data().toString();
QWebSettings::globalSettings()->setDefaultTextEncoding(encoding); #if QTWEBENGINE_DISABLED
QWebEngineSettings::globalSettings()->setDefaultTextEncoding(encoding);
#endif
Settings settings; Settings settings;
settings.setValue("Web-Browser-Settings/DefaultEncoding", encoding); settings.setValue("Web-Browser-Settings/DefaultEncoding", encoding);
@ -742,8 +757,9 @@ void BrowserWindow::showHistoryManager()
mApp->browsingLibrary()->showHistory(this); mApp->browsingLibrary()->showHistory(this);
} }
void BrowserWindow::showSource(QWebFrame* frame, const QString &selectedHtml) void BrowserWindow::showSource(QWebEngineFrame* frame, const QString &selectedHtml)
{ {
#if QTWEBENGINE_DISABLED
if (!frame) { if (!frame) {
frame = weView()->page()->mainFrame(); frame = weView()->page()->mainFrame();
} }
@ -751,6 +767,7 @@ void BrowserWindow::showSource(QWebFrame* frame, const QString &selectedHtml)
SourceViewer* source = new SourceViewer(frame, selectedHtml); SourceViewer* source = new SourceViewer(frame, selectedHtml);
QzTools::centerWidgetToParent(source, this); QzTools::centerWidgetToParent(source, this);
source->show(); source->show();
#endif
} }
SideBar* BrowserWindow::addSideBar() SideBar* BrowserWindow::addSideBar()
@ -863,12 +880,14 @@ void BrowserWindow::toggleTabsOnTop(bool enable)
void BrowserWindow::toggleCaretBrowsing() void BrowserWindow::toggleCaretBrowsing()
{ {
#if QTWEBENGINE_DISABLED
#if QTWEBKIT_FROM_2_3 #if QTWEBKIT_FROM_2_3
bool enable = !QWebSettings::globalSettings()->testAttribute(QWebSettings::CaretBrowsingEnabled); bool enable = !QWebEngineSettings::globalSettings()->testAttribute(QWebEngineSettings::CaretBrowsingEnabled);
Settings().setValue("Web-Browser-Settings/CaretBrowsing", enable); Settings().setValue("Web-Browser-Settings/CaretBrowsing", enable);
QWebSettings::globalSettings()->setAttribute(QWebSettings::CaretBrowsingEnabled, enable); QWebEngineSettings::globalSettings()->setAttribute(QWebEngineSettings::CaretBrowsingEnabled, enable);
#endif
#endif #endif
} }
@ -1000,7 +1019,11 @@ void BrowserWindow::createSidebarsMenu(QMenu* menu)
void BrowserWindow::createEncodingMenu(QMenu* menu) void BrowserWindow::createEncodingMenu(QMenu* menu)
{ {
#if QTWEBENGINE_DISABLED
const QString activeCodecName = QWebSettings::globalSettings()->defaultTextEncoding(); const QString activeCodecName = QWebSettings::globalSettings()->defaultTextEncoding();
#else
const QString activeCodecName = QL1S("UTF-8");
#endif
QStringList isoCodecs, utfCodecs, windowsCodecs, isciiCodecs, otherCodecs; QStringList isoCodecs, utfCodecs, windowsCodecs, isciiCodecs, otherCodecs;
@ -1193,7 +1216,7 @@ bool BrowserWindow::event(QEvent* event)
return QMainWindow::event(event); return QMainWindow::event(event);
} }
void BrowserWindow::printPage(QWebFrame* frame) void BrowserWindow::printPage(QWebEngineFrame* frame)
{ {
QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this); QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setAttribute(Qt::WA_DeleteOnClose);
@ -1206,9 +1229,11 @@ void BrowserWindow::printPage(QWebFrame* frame)
connect(dialog, SIGNAL(paintRequested(QPrinter*)), weView(), SLOT(print(QPrinter*))); connect(dialog, SIGNAL(paintRequested(QPrinter*)), weView(), SLOT(print(QPrinter*)));
} }
else { else {
#if QTWEBENGINE_DISABLED
dialog->printer()->setDocName(QzTools::getFileNameFromUrl(QzTools::frameUrl(frame))); dialog->printer()->setDocName(QzTools::getFileNameFromUrl(QzTools::frameUrl(frame)));
connect(dialog, SIGNAL(paintRequested(QPrinter*)), frame, SLOT(print(QPrinter*))); connect(dialog, SIGNAL(paintRequested(QPrinter*)), frame, SLOT(print(QPrinter*)));
#endif
} }
dialog->open(); dialog->open();
@ -1216,8 +1241,10 @@ void BrowserWindow::printPage(QWebFrame* frame)
void BrowserWindow::savePageScreen() void BrowserWindow::savePageScreen()
{ {
#if QTWEBENGINE_DISABLED
PageScreen* dialog = new PageScreen(weView(), this); PageScreen* dialog = new PageScreen(weView(), this);
dialog->show(); dialog->show();
#endif
} }
void BrowserWindow::resizeEvent(QResizeEvent* event) void BrowserWindow::resizeEvent(QResizeEvent* event)
@ -1409,6 +1436,7 @@ void BrowserWindow::keyPressEvent(QKeyEvent* event)
m_tabWidget->setCurrentIndex(number - 1); m_tabWidget->setCurrentIndex(number - 1);
return; return;
} }
#if QTWEBENGINE_DISABLED
if (event->modifiers() & Qt::ControlModifier && m_useSpeedDialNumberShortcuts) { if (event->modifiers() & Qt::ControlModifier && m_useSpeedDialNumberShortcuts) {
const QUrl url = mApp->plugins()->speedDial()->urlForShortcut(number - 1); const QUrl url = mApp->plugins()->speedDial()->urlForShortcut(number - 1);
if (url.isValid()) { if (url.isValid()) {
@ -1422,6 +1450,7 @@ void BrowserWindow::keyPressEvent(QKeyEvent* event)
if (number == 2) if (number == 2)
m_tabWidget->nextTab(); m_tabWidget->nextTab();
} }
#endif
} }
QMainWindow::keyPressEvent(event); QMainWindow::keyPressEvent(event);

View File

@ -28,7 +28,7 @@
class QLabel; class QLabel;
class QVBoxLayout; class QVBoxLayout;
class QSplitter; class QSplitter;
class QWebFrame; class QWebEngineFrame;
class QTimer; class QTimer;
class Menu; class Menu;
@ -142,8 +142,8 @@ public slots:
void bookmarkPage(); void bookmarkPage();
void bookmarkAllTabs(); void bookmarkAllTabs();
void loadAddress(const QUrl &url); void loadAddress(const QUrl &url);
void showSource(QWebFrame* frame = 0, const QString &selectedHtml = QString()); void showSource(QWebEngineFrame* frame = 0, const QString &selectedHtml = QString());
void printPage(QWebFrame* frame = 0); void printPage(QWebEngineFrame* frame = 0);
private slots: private slots:
void addTab(); void addTab();

View File

@ -209,6 +209,9 @@ MainApplication::MainApplication(int &argc, char** argv)
appId.append(QLatin1String("Portable")); appId.append(QLatin1String("Portable"));
} }
// QtWebEngine
appId.append(QL1S("-QtWebEngine"));
// TODO: This should generate some random string for appId // TODO: This should generate some random string for appId
if (newInstance) { if (newInstance) {
if (startProfile.isEmpty() || startProfile == QLatin1String("default")) { if (startProfile.isEmpty() || startProfile == QLatin1String("default")) {
@ -516,7 +519,11 @@ QNetworkDiskCache* MainApplication::networkCache()
Settings settings; Settings settings;
const QString defaultBasePath = QString("%1/networkcache/").arg(DataPaths::currentProfilePath()); const QString defaultBasePath = QString("%1/networkcache/").arg(DataPaths::currentProfilePath());
const QString basePath = settings.value("Web-Browser-Settings/CachePath", defaultBasePath).toString(); const QString basePath = settings.value("Web-Browser-Settings/CachePath", defaultBasePath).toString();
#if QTWEBENGINE_DISABLED
const QString cachePath = QString("%1/%2-Qt%3/").arg(basePath, qWebKitVersion(), qVersion()); const QString cachePath = QString("%1/%2-Qt%3/").arg(basePath, qWebKitVersion(), qVersion());
#else
const QString cachePath = QString("%1/QtWebEngine/").arg(basePath);
#endif
m_networkCache = new QNetworkDiskCache(this); m_networkCache = new QNetworkDiskCache(this);
m_networkCache->setCacheDirectory(cachePath); m_networkCache->setCacheDirectory(cachePath);
@ -533,6 +540,7 @@ BrowsingLibrary* MainApplication::browsingLibrary()
return m_browsingLibrary; return m_browsingLibrary;
} }
#if QTWEBENGINE_DISABLED
RSSManager* MainApplication::rssManager() RSSManager* MainApplication::rssManager()
{ {
if (!m_rssManager) { if (!m_rssManager) {
@ -540,11 +548,12 @@ RSSManager* MainApplication::rssManager()
} }
return m_rssManager; return m_rssManager;
} }
#endif
NetworkManager* MainApplication::networkManager() QNetworkAccessManager* MainApplication::networkManager()
{ {
if (!m_networkManager) { if (!m_networkManager) {
m_networkManager = new NetworkManager(this); m_networkManager = new QNetworkAccessManager(this);
} }
return m_networkManager; return m_networkManager;
} }
@ -636,8 +645,10 @@ void MainApplication::startPrivateBrowsing(const QUrl &startUrl)
void MainApplication::reloadUserStyleSheet() void MainApplication::reloadUserStyleSheet()
{ {
#if QTWEBENGINE_DISABLED
const QUrl userCss = userStyleSheet(Settings().value("Web-Browser-Settings/userStyleSheet", QString()).toString()); const QUrl userCss = userStyleSheet(Settings().value("Web-Browser-Settings/userStyleSheet", QString()).toString());
QWebSettings::globalSettings()->setUserStyleSheetUrl(userCss); QWebEngineSettings::globalSettings()->setUserStyleSheetUrl(userCss);
#endif
} }
void MainApplication::restoreOverrideCursor() void MainApplication::restoreOverrideCursor()
@ -690,7 +701,9 @@ void MainApplication::postLaunch()
} }
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, DataPaths::currentProfilePath()); QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, DataPaths::currentProfilePath());
QWebHistoryInterface::setDefaultInterface(new WebHistoryInterface(this)); #if QTWEBENGINE_DISABLED
QWebEngineHistoryInterface::setDefaultInterface(new WebHistoryInterface(this));
#endif
connect(this, SIGNAL(messageReceived(QString)), this, SLOT(messageReceived(QString))); connect(this, SIGNAL(messageReceived(QString)), this, SLOT(messageReceived(QString)));
connect(this, SIGNAL(aboutToQuit()), this, SLOT(saveSettings())); connect(this, SIGNAL(aboutToQuit()), this, SLOT(saveSettings()));
@ -758,7 +771,6 @@ void MainApplication::saveSettings()
} }
m_searchEnginesManager->saveSettings(); m_searchEnginesManager->saveSettings();
m_networkManager->saveSettings();
m_plugins->shutdown(); m_plugins->shutdown();
DataPaths::clearTempData(); DataPaths::clearTempData();
@ -854,6 +866,7 @@ void MainApplication::loadSettings()
loadTheme(activeTheme); loadTheme(activeTheme);
#if QTWEBENGINE_DISABLED
QWebSettings* webSettings = QWebSettings::globalSettings(); QWebSettings* webSettings = QWebSettings::globalSettings();
// Web browsing settings // Web browsing settings
@ -915,9 +928,12 @@ void MainApplication::loadSettings()
webSettings->setWebGraphic(QWebSettings::DefaultFrameIconGraphic, IconProvider::emptyWebIcon().pixmap(16, 16)); webSettings->setWebGraphic(QWebSettings::DefaultFrameIconGraphic, IconProvider::emptyWebIcon().pixmap(16, 16));
webSettings->setWebGraphic(QWebSettings::MissingImageGraphic, QPixmap()); webSettings->setWebGraphic(QWebSettings::MissingImageGraphic, QPixmap());
#endif
if (isPrivate()) { if (isPrivate()) {
#if QTWEBENGINE_DISABLED
webSettings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); webSettings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
#endif
history()->setSaving(false); history()->setSaving(false);
} }

View File

@ -28,6 +28,7 @@
class QMenu; class QMenu;
class QNetworkDiskCache; class QNetworkDiskCache;
class QNetworkAccessManager;
class History; class History;
class AutoFill; class AutoFill;
@ -39,7 +40,6 @@ class RSSManager;
class ProxyStyle; class ProxyStyle;
class PluginProxy; class PluginProxy;
class BrowserWindow; class BrowserWindow;
class NetworkManager;
class BrowsingLibrary; class BrowsingLibrary;
class DownloadManager; class DownloadManager;
class UserAgentManager; class UserAgentManager;
@ -92,7 +92,7 @@ public:
BrowsingLibrary* browsingLibrary(); BrowsingLibrary* browsingLibrary();
RSSManager* rssManager(); RSSManager* rssManager();
NetworkManager* networkManager(); QNetworkAccessManager* networkManager();
RestoreManager* restoreManager(); RestoreManager* restoreManager();
DownloadManager* downloadManager(); DownloadManager* downloadManager();
UserAgentManager* userAgentManager(); UserAgentManager* userAgentManager();
@ -157,7 +157,7 @@ private:
BrowsingLibrary* m_browsingLibrary; BrowsingLibrary* m_browsingLibrary;
RSSManager* m_rssManager; RSSManager* m_rssManager;
NetworkManager* m_networkManager; QNetworkAccessManager* m_networkManager;
RestoreManager* m_restoreManager; RestoreManager* m_restoreManager;
DownloadManager* m_downloadManager; DownloadManager* m_downloadManager;
UserAgentManager* m_userAgentManager; UserAgentManager* m_userAgentManager;

View File

@ -36,7 +36,7 @@
#include <QApplication> #include <QApplication>
#include <QMetaObject> #include <QMetaObject>
#include <QStatusBar> #include <QStatusBar>
#include <QWebPage> #include <QWebEnginePage>
#include <QMenuBar> #include <QMenuBar>
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
@ -303,11 +303,13 @@ void MainMenu::webSearch()
void MainMenu::showSiteInfo() void MainMenu::showSiteInfo()
{ {
#if QTWEBENGINE_DISABLED
if (m_window) { if (m_window) {
SiteInfo* info = new SiteInfo(m_window->weView(), m_window); SiteInfo* info = new SiteInfo(m_window->weView(), m_window);
info->setAttribute(Qt::WA_DeleteOnClose); info->setAttribute(Qt::WA_DeleteOnClose);
info->show(); info->show();
} }
#endif
} }
void MainMenu::showDownloadManager() void MainMenu::showDownloadManager()
@ -403,8 +405,10 @@ void MainMenu::aboutToShowViewMenu()
m_actions[QSL("View/FullScreen")]->setChecked(m_window->isFullScreen()); m_actions[QSL("View/FullScreen")]->setChecked(m_window->isFullScreen());
m_actions[QSL("View/PageSource")]->setEnabled(true); m_actions[QSL("View/PageSource")]->setEnabled(true);
#if QTWEBENGINE_DISABLED
#if QTWEBKIT_FROM_2_3 #if QTWEBKIT_FROM_2_3
m_actions[QSL("View/CaretBrowsing")]->setChecked(m_window->weView()->settings()->testAttribute(QWebSettings::CaretBrowsingEnabled)); m_actions[QSL("View/CaretBrowsing")]->setChecked(m_window->weView()->settings()->testAttribute(QWebEngineSettings::CaretBrowsingEnabled));
#endif
#endif #endif
} }
@ -421,12 +425,12 @@ void MainMenu::aboutToShowEditMenu()
WebView* view = m_window->weView(); WebView* view = m_window->weView();
m_actions[QSL("Edit/Undo")]->setEnabled(view->pageAction(QWebPage::Undo)->isEnabled()); m_actions[QSL("Edit/Undo")]->setEnabled(view->pageAction(QWebEnginePage::Undo)->isEnabled());
m_actions[QSL("Edit/Redo")]->setEnabled(view->pageAction(QWebPage::Redo)->isEnabled()); m_actions[QSL("Edit/Redo")]->setEnabled(view->pageAction(QWebEnginePage::Redo)->isEnabled());
m_actions[QSL("Edit/Cut")]->setEnabled(view->pageAction(QWebPage::Cut)->isEnabled()); m_actions[QSL("Edit/Cut")]->setEnabled(view->pageAction(QWebEnginePage::Cut)->isEnabled());
m_actions[QSL("Edit/Copy")]->setEnabled(view->pageAction(QWebPage::Copy)->isEnabled()); m_actions[QSL("Edit/Copy")]->setEnabled(view->pageAction(QWebEnginePage::Copy)->isEnabled());
m_actions[QSL("Edit/Paste")]->setEnabled(view->pageAction(QWebPage::Paste)->isEnabled()); m_actions[QSL("Edit/Paste")]->setEnabled(view->pageAction(QWebEnginePage::Paste)->isEnabled());
m_actions[QSL("Edit/SelectAll")]->setEnabled(view->pageAction(QWebPage::SelectAll)->isEnabled()); m_actions[QSL("Edit/SelectAll")]->setEnabled(view->pageAction(QWebEnginePage::SelectAll)->isEnabled());
m_actions[QSL("Edit/Find")]->setEnabled(true); m_actions[QSL("Edit/Find")]->setEnabled(true);
} }

View File

@ -132,14 +132,20 @@ QString ProfileManager::currentProfile() const
QString ProfileManager::startingProfile() const QString ProfileManager::startingProfile() const
{ {
#if QTWEBENGINE_DISABLED
QSettings settings(DataPaths::path(DataPaths::Profiles) + QLatin1String("/profiles.ini"), QSettings::IniFormat); QSettings settings(DataPaths::path(DataPaths::Profiles) + QLatin1String("/profiles.ini"), QSettings::IniFormat);
return settings.value(QLatin1String("Profiles/startProfile"), QLatin1String("default")).toString(); return settings.value(QLatin1String("Profiles/startProfile"), QLatin1String("default")).toString();
#else
return QString("qtwebengine");
#endif
} }
void ProfileManager::setStartingProfile(const QString &profileName) void ProfileManager::setStartingProfile(const QString &profileName)
{ {
#if QTWEBENGINE_DISABLED
QSettings settings(DataPaths::path(DataPaths::Profiles) + QLatin1String("/profiles.ini"), QSettings::IniFormat); QSettings settings(DataPaths::path(DataPaths::Profiles) + QLatin1String("/profiles.ini"), QSettings::IniFormat);
settings.setValue(QLatin1String("Profiles/startProfile"), profileName); settings.setValue(QLatin1String("Profiles/startProfile"), profileName);
#endif
} }
QStringList ProfileManager::availableProfiles() const QStringList ProfileManager::availableProfiles() const

View File

@ -146,6 +146,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qz::NewTabPositionFlags)
#define DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG true #define DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG true
#endif #endif
#if QTWEBENGINE_DISABLED
#define QTWEBKIT_FROM_2_2 \ #define QTWEBKIT_FROM_2_2 \
(QT_VERSION >= 0x050000 || (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0))) (QT_VERSION >= 0x050000 || (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0)))
@ -157,5 +158,15 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qz::NewTabPositionFlags)
#define QTWEBKIT_TO_2_3 \ #define QTWEBKIT_TO_2_3 \
(QT_VERSION < 0x050000 && (QTWEBKIT_VERSION < QTWEBKIT_VERSION_CHECK(2, 3, 0))) (QT_VERSION < 0x050000 && (QTWEBKIT_VERSION < QTWEBKIT_VERSION_CHECK(2, 3, 0)))
#else
#define QTWEBKIT_FROM_2_2 true
#define QTWEBKIT_TO_2_2 false
#define QTWEBKIT_FROM_2_3 true
#define QTWEBKIT_TO_2_3 false
#undef USE_QTWEBKIT_2_2
#undef USE_QTWEBKIT_2_3
#endif
#endif // QZCOMMON_H #endif // QZCOMMON_H

View File

@ -30,7 +30,6 @@
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QWebFrame>
#include <QNetworkRequest> #include <QNetworkRequest>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
@ -170,7 +169,7 @@ void AutoFill::removeAllEntries()
} }
// If password was filled in the page, returns all saved passwords on this page // If password was filled in the page, returns all saved passwords on this page
QVector<PasswordEntry> AutoFill::completeFrame(QWebFrame* frame) QVector<PasswordEntry> AutoFill::completeFrame(QWebEngineFrame* frame)
{ {
bool completed = false; bool completed = false;
QVector<PasswordEntry> list; QVector<PasswordEntry> list;
@ -202,12 +201,13 @@ QVector<PasswordEntry> AutoFill::completeFrame(QWebFrame* frame)
void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingData) void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingData)
{ {
#if QTWEBENGINE_DISABLED
// Don't save in private browsing // Don't save in private browsing
if (mApp->isPrivate()) { if (mApp->isPrivate()) {
return; return;
} }
QWebFrame* frame = qobject_cast<QWebFrame*>(request.originatingObject()); QWebEngineFrame* frame = qobject_cast<QWebEngineFrame*>(request.originatingObject());
if (!frame) { if (!frame) {
return; return;
} }
@ -259,6 +259,7 @@ void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingDa
AutoFillNotification* aWidget = new AutoFillNotification(frameUrl, formData, updateData); AutoFillNotification* aWidget = new AutoFillNotification(frameUrl, formData, updateData);
webView->addNotification(aWidget); webView->addNotification(aWidget);
#endif
} }
QByteArray AutoFill::exportPasswords() QByteArray AutoFill::exportPasswords()

View File

@ -23,7 +23,7 @@
#include "qzcommon.h" #include "qzcommon.h"
class QUrl; class QUrl;
class QWebFrame; class QWebEngineFrame;
class QWebElement; class QWebElement;
class QNetworkRequest; class QNetworkRequest;
@ -61,7 +61,7 @@ public:
void removeAllEntries(); void removeAllEntries();
void post(const QNetworkRequest &request, const QByteArray &outgoingData); void post(const QNetworkRequest &request, const QByteArray &outgoingData);
QVector<PasswordEntry> completeFrame(QWebFrame* frame); QVector<PasswordEntry> completeFrame(QWebEngineFrame *frame);
QByteArray exportPasswords(); QByteArray exportPasswords();
bool importPasswords(const QByteArray &data); bool importPasswords(const QByteArray &data);

View File

@ -18,9 +18,7 @@
#include "pageformcompleter.h" #include "pageformcompleter.h"
#include "qzregexp.h" #include "qzregexp.h"
#include <QWebPage> #include <QWebEnginePage>
#include <QWebFrame>
#include <QWebElement>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QUrlQuery> #include <QUrlQuery>
#endif #endif
@ -31,25 +29,25 @@ PageFormCompleter::PageFormCompleter()
{ {
} }
PageFormData PageFormCompleter::extractFormData(QWebPage* page, const QByteArray &postData) PageFormData PageFormCompleter::extractFormData(QWebEnginePage* page, const QByteArray &postData)
{ {
m_page = page; m_page = page;
return extractFormData(postData); return extractFormData(postData);
} }
PageFormData PageFormCompleter::extractFormData(QWebFrame* frame, const QByteArray &postData) PageFormData PageFormCompleter::extractFormData(QWebEngineFrame* frame, const QByteArray &postData)
{ {
m_frame = frame; m_frame = frame;
return extractFormData(postData); return extractFormData(postData);
} }
bool PageFormCompleter::completeFormData(QWebPage* page, const QByteArray &data) bool PageFormCompleter::completeFormData(QWebEnginePage* page, const QByteArray &data)
{ {
m_page = page; m_page = page;
return completeFormData(data); return completeFormData(data);
} }
bool PageFormCompleter::completeFormData(QWebFrame* frame, const QByteArray &data) bool PageFormCompleter::completeFormData(QWebEngineFrame* frame, const QByteArray &data)
{ {
m_frame = frame; m_frame = frame;
return completeFormData(data); return completeFormData(data);
@ -73,6 +71,7 @@ PageFormData PageFormCompleter::extractFormData(const QByteArray &postData) cons
return formData; return formData;
} }
#if QTWEBENGINE_DISABLED
const QWebElementCollection allForms = getAllElementsFromPage("form"); const QWebElementCollection allForms = getAllElementsFromPage("form");
// Find form that contains password value sent in data // Find form that contains password value sent in data
@ -109,6 +108,7 @@ PageFormData PageFormCompleter::extractFormData(const QByteArray &postData) cons
formData.username = usernameValue; formData.username = usernameValue;
formData.password = passwordValue; formData.password = passwordValue;
#endif
return formData; return formData;
} }
@ -123,6 +123,7 @@ bool PageFormCompleter::completeFormData(const QByteArray &data) const
QStringList inputTypes; QStringList inputTypes;
inputTypes << "text" << "password" << "email"; inputTypes << "text" << "password" << "email";
#if QTWEBENGINE_DISABLED
// Find all input elements in the page // Find all input elements in the page
const QWebElementCollection inputs = getAllElementsFromPage("input"); const QWebElementCollection inputs = getAllElementsFromPage("input");
@ -144,6 +145,7 @@ bool PageFormCompleter::completeFormData(const QByteArray &data) const
} }
} }
} }
#endif
return completed; return completed;
} }
@ -212,6 +214,7 @@ QByteArray PageFormCompleter::convertWebKitFormBoundaryIfNecessary(const QByteAr
PageFormCompleter::QueryItem PageFormCompleter::findUsername(const QWebElement &form) const PageFormCompleter::QueryItem PageFormCompleter::findUsername(const QWebElement &form) const
{ {
#if QTWEBENGINE_DISABLED
// Try to find username (or email) field in the form. // Try to find username (or email) field in the form.
QStringList selectors; QStringList selectors;
selectors << "input[type=\"text\"][name*=\"user\"]" selectors << "input[type=\"text\"][name*=\"user\"]"
@ -234,6 +237,7 @@ PageFormCompleter::QueryItem PageFormCompleter::findUsername(const QWebElement &
} }
} }
} }
#endif
return QueryItem(); return QueryItem();
} }
@ -254,6 +258,7 @@ PageFormCompleter::QueryItems PageFormCompleter::createQueryItems(QByteArray dat
return arguments; return arguments;
} }
#if QTWEBENGINE_DISABLED
QWebElementCollection PageFormCompleter::getAllElementsFromPage(const QString &selector) const QWebElementCollection PageFormCompleter::getAllElementsFromPage(const QString &selector) const
{ {
QWebElementCollection list; QWebElementCollection list;
@ -280,3 +285,5 @@ QWebElementCollection PageFormCompleter::getAllElementsFromPage(const QString &s
return list; return list;
} }
#endif

View File

@ -24,8 +24,8 @@
#include "qzcommon.h" #include "qzcommon.h"
class QWebPage; class QWebEnginePage;
class QWebFrame; class QWebEngineFrame;
class QWebElement; class QWebElement;
class QWebElementCollection; class QWebElementCollection;
@ -44,11 +44,11 @@ class QUPZILLA_EXPORT PageFormCompleter
public: public:
explicit PageFormCompleter(); explicit PageFormCompleter();
PageFormData extractFormData(QWebPage* page, const QByteArray &postData); PageFormData extractFormData(QWebEnginePage* page, const QByteArray &postData);
PageFormData extractFormData(QWebFrame* frame, const QByteArray &postData); PageFormData extractFormData(QWebEngineFrame* frame, const QByteArray &postData);
bool completeFormData(QWebPage* page, const QByteArray &data); bool completeFormData(QWebEnginePage* page, const QByteArray &data);
bool completeFormData(QWebFrame* frame, const QByteArray &data); bool completeFormData(QWebEngineFrame* frame, const QByteArray &data);
private: private:
typedef QPair<QString, QString> QueryItem; typedef QPair<QString, QString> QueryItem;
@ -62,10 +62,12 @@ private:
QByteArray convertWebKitFormBoundaryIfNecessary(const QByteArray &data) const; QByteArray convertWebKitFormBoundaryIfNecessary(const QByteArray &data) const;
QueryItem findUsername(const QWebElement &form) const; QueryItem findUsername(const QWebElement &form) const;
QueryItems createQueryItems(QByteArray data) const; QueryItems createQueryItems(QByteArray data) const;
#if QTWEBENGINE_DISABLED
QWebElementCollection getAllElementsFromPage(const QString &selector) const; QWebElementCollection getAllElementsFromPage(const QString &selector) const;
#endif
QWebPage* m_page; QWebEnginePage* m_page;
QWebFrame* m_frame; QWebEngineFrame* m_frame;
}; };
#endif // PAGEFORMCOMPLETER_H #endif // PAGEFORMCOMPLETER_H

View File

@ -40,7 +40,9 @@ BookmarksIcon::BookmarksIcon(QWidget* parent)
connect(mApp->bookmarks(), SIGNAL(bookmarkAdded(BookmarkItem*)), this, SLOT(bookmarksChanged())); connect(mApp->bookmarks(), SIGNAL(bookmarkAdded(BookmarkItem*)), this, SLOT(bookmarksChanged()));
connect(mApp->bookmarks(), SIGNAL(bookmarkRemoved(BookmarkItem*)), this, SLOT(bookmarksChanged())); connect(mApp->bookmarks(), SIGNAL(bookmarkRemoved(BookmarkItem*)), this, SLOT(bookmarksChanged()));
connect(mApp->bookmarks(), SIGNAL(bookmarkChanged(BookmarkItem*)), this, SLOT(bookmarksChanged())); connect(mApp->bookmarks(), SIGNAL(bookmarkChanged(BookmarkItem*)), this, SLOT(bookmarksChanged()));
#if QTWEBENGINE_DISABLED
connect(mApp->plugins()->speedDial(), SIGNAL(pagesChanged()), this, SLOT(speedDialChanged())); connect(mApp->plugins()->speedDial(), SIGNAL(pagesChanged()), this, SLOT(speedDialChanged()));
#endif
connect(this, SIGNAL(clicked(QPoint)), this, SLOT(iconClicked())); connect(this, SIGNAL(clicked(QPoint)), this, SLOT(iconClicked()));
} }
@ -59,7 +61,9 @@ void BookmarksIcon::checkBookmark(const QUrl &url, bool forceCheck)
QList<BookmarkItem*> items = mApp->bookmarks()->searchBookmarks(url); QList<BookmarkItem*> items = mApp->bookmarks()->searchBookmarks(url);
m_bookmark = items.isEmpty() ? 0 : items.first(); m_bookmark = items.isEmpty() ? 0 : items.first();
if (m_bookmark || !mApp->plugins()->speedDial()->pageForUrl(url).url.isEmpty()) { #if QTWEBENGINE_DISABLED
#endif
if (m_bookmark /*|| !mApp->plugins()->speedDial()->pageForUrl(url).url.isEmpty()*/) {
setBookmarkSaved(); setBookmarkSaved();
} }
else { else {

View File

@ -50,6 +50,7 @@ BookmarksWidget::~BookmarksWidget()
void BookmarksWidget::toggleSpeedDial() void BookmarksWidget::toggleSpeedDial()
{ {
#if QTWEBENGINE_DISABLED
const SpeedDial::Page page = m_speedDial->pageForUrl(m_view->url()); const SpeedDial::Page page = m_speedDial->pageForUrl(m_view->url());
if (page.url.isEmpty()) { if (page.url.isEmpty()) {
@ -61,6 +62,7 @@ void BookmarksWidget::toggleSpeedDial()
} }
closePopup(); closePopup();
#endif
} }
void BookmarksWidget::toggleBookmark() void BookmarksWidget::toggleBookmark()
@ -104,6 +106,7 @@ void BookmarksWidget::init()
// it dynamically changes and so, it's not good choice for this widget. // it dynamically changes and so, it's not good choice for this widget.
setLayoutDirection(QApplication::layoutDirection()); setLayoutDirection(QApplication::layoutDirection());
#if QTWEBENGINE_DISABLED
// Init SpeedDial button // Init SpeedDial button
const SpeedDial::Page page = m_speedDial->pageForUrl(m_view->url()); const SpeedDial::Page page = m_speedDial->pageForUrl(m_view->url());
if (page.url.isEmpty()) { if (page.url.isEmpty()) {
@ -114,6 +117,7 @@ void BookmarksWidget::init()
ui->speeddialButton->setFlat(false); ui->speeddialButton->setFlat(false);
ui->speeddialButton->setText(tr("Remove from Speed Dial")); ui->speeddialButton->setText(tr("Remove from Speed Dial"));
} }
#endif
// Init Bookmarks button // Init Bookmarks button
if (m_bookmark) { if (m_bookmark) {

View File

@ -23,7 +23,7 @@
#include "qztools.h" #include "qztools.h"
#include <QNetworkCookie> #include <QNetworkCookie>
#include <QWebSettings> #include <QWebEngineSettings>
#include <QDateTime> #include <QDateTime>
//#define COOKIE_DEBUG //#define COOKIE_DEBUG
@ -56,6 +56,7 @@ void CookieJar::loadSettings()
m_blacklist = settings.value("blacklist", QStringList()).toStringList(); m_blacklist = settings.value("blacklist", QStringList()).toStringList();
settings.endGroup(); settings.endGroup();
#if QTWEBENGINE_DISABLED
#if QTWEBKIT_FROM_2_3 #if QTWEBKIT_FROM_2_3
switch (m_allowThirdParty) { switch (m_allowThirdParty) {
case 0: case 0:
@ -71,6 +72,7 @@ void CookieJar::loadSettings()
break; break;
} }
#endif #endif
#endif
} }
void CookieJar::setAllowCookies(bool allow) void CookieJar::setAllowCookies(bool allow)

View File

@ -31,7 +31,7 @@
#include <QFileIconProvider> #include <QFileIconProvider>
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QWebHistory> #include <QWebEngineHistory>
#include <QFileDialog> #include <QFileDialog>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000

View File

@ -138,6 +138,7 @@ void DownloadItem::startDownloadingFromFtp(const QUrl &url)
return; return;
} }
#if QTWEBENGINE_DISABLED
m_ftpDownloader = new FtpDownloader(this); m_ftpDownloader = new FtpDownloader(this);
connect(m_ftpDownloader, SIGNAL(finished()), this, SLOT(finished())); connect(m_ftpDownloader, SIGNAL(finished()), this, SLOT(finished()));
connect(m_ftpDownloader, SIGNAL(dataTransferProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64))); connect(m_ftpDownloader, SIGNAL(dataTransferProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
@ -153,6 +154,7 @@ void DownloadItem::startDownloadingFromFtp(const QUrl &url)
if (m_ftpDownloader->error() != QFtp::NoError) { if (m_ftpDownloader->error() != QFtp::NoError) {
error(); error();
} }
#endif
} }
void DownloadItem::parentResized(const QSize &size) void DownloadItem::parentResized(const QSize &size)
@ -182,7 +184,7 @@ void DownloadItem::finished()
#endif #endif
m_timer.stop(); m_timer.stop();
QString host = m_reply ? m_reply->url().host() : m_ftpDownloader->url().host(); QString host = m_reply->url().host();
ui->downloadInfo->setText(tr("Done - %1 (%2)").arg(host, QDateTime::currentDateTime().toString(Qt::DefaultLocaleShortDate))); ui->downloadInfo->setText(tr("Done - %1 (%2)").arg(host, QDateTime::currentDateTime().toString(Qt::DefaultLocaleShortDate)));
ui->progressBar->hide(); ui->progressBar->hide();
ui->button->hide(); ui->button->hide();
@ -193,7 +195,9 @@ void DownloadItem::finished()
m_reply->deleteLater(); m_reply->deleteLater();
} }
else { else {
#if QTWEBENGINE_DISABLED
m_ftpDownloader->deleteLater(); m_ftpDownloader->deleteLater();
#endif
} }
m_item->setSizeHint(sizeHint()); m_item->setSizeHint(sizeHint());
@ -327,7 +331,9 @@ void DownloadItem::stop(bool askForDeleteFile)
host = m_reply->url().host(); host = m_reply->url().host();
} }
else if (m_ftpDownloader) { else if (m_ftpDownloader) {
#if QTWEBENGINE_DISABLED
host = m_ftpDownloader->url().host(); host = m_ftpDownloader->url().host();
#endif
} }
m_openAfterFinish = false; m_openAfterFinish = false;
m_timer.stop(); m_timer.stop();
@ -335,8 +341,10 @@ void DownloadItem::stop(bool askForDeleteFile)
m_reply->abort(); m_reply->abort();
} }
else if (m_ftpDownloader) { else if (m_ftpDownloader) {
#if QTWEBENGINE_DISABLED
m_ftpDownloader->abort(); m_ftpDownloader->abort();
m_ftpDownloader->close(); m_ftpDownloader->close();
#endif
} }
QString outputfile = QFileInfo(m_outputFile).absoluteFilePath(); QString outputfile = QFileInfo(m_outputFile).absoluteFilePath();
m_outputFile.close(); m_outputFile.close();
@ -455,10 +463,12 @@ void DownloadItem::error()
if (m_reply && m_reply->error() != QNetworkReply::NoError) { if (m_reply && m_reply->error() != QNetworkReply::NoError) {
ui->downloadInfo->setText(tr("Error: ") + m_reply->errorString()); ui->downloadInfo->setText(tr("Error: ") + m_reply->errorString());
} }
#if QTWEBENGINE_DISABLED
else if (m_ftpDownloader && m_ftpDownloader->error() != QFtp::NoError) { else if (m_ftpDownloader && m_ftpDownloader->error() != QFtp::NoError) {
stop(false); stop(false);
ui->downloadInfo->setText(tr("Error: ") + m_ftpDownloader->errorString()); ui->downloadInfo->setText(tr("Error: ") + m_ftpDownloader->errorString());
} }
#endif
} }
void DownloadItem::updateDownload() void DownloadItem::updateDownload()
@ -468,6 +478,7 @@ void DownloadItem::updateDownload()
#endif #endif
// after caling stop() (from readyRead()) m_reply will be a dangling pointer, // after caling stop() (from readyRead()) m_reply will be a dangling pointer,
// thus it should be checked after m_outputFile.isOpen() // thus it should be checked after m_outputFile.isOpen()
#if QTWEBENGINE_DISABLED
if (ui->progressBar->maximum() == 0 && m_outputFile.isOpen() && if (ui->progressBar->maximum() == 0 && m_outputFile.isOpen() &&
((m_reply && m_reply->isFinished()) || ((m_reply && m_reply->isFinished()) ||
(m_ftpDownloader && m_ftpDownloader->isFinished()) (m_ftpDownloader && m_ftpDownloader->isFinished())
@ -476,6 +487,13 @@ void DownloadItem::updateDownload()
downloadProgress(0, 0); downloadProgress(0, 0);
finished(); finished();
} }
#else
if (ui->progressBar->maximum() == 0 && m_outputFile.isOpen() &&
((m_reply && m_reply->isFinished()))) {
downloadProgress(0, 0);
finished();
}
#endif
} }
DownloadItem::~DownloadItem() DownloadItem::~DownloadItem()

View File

@ -221,9 +221,12 @@ void DownloadManager::download(const QNetworkRequest &request, const DownloadInf
QNetworkRequest req = request; QNetworkRequest req = request;
req.setAttribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100), 0); req.setAttribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100), 0);
#if QTWEBENGINE_DISABLED
handleUnsupportedContent(m_networkManager->get(req), info); handleUnsupportedContent(m_networkManager->get(req), info);
#endif
} }
#if QTWEBENGINE_DISABLED
void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, const DownloadInfo &info) void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, const DownloadInfo &info)
{ {
if (!info.page || reply->url().scheme() == QLatin1String("qupzilla")) { if (!info.page || reply->url().scheme() == QLatin1String("qupzilla")) {
@ -247,6 +250,7 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, const Downl
h->setListWidget(ui->list); h->setListWidget(ui->list);
h->handleUnsupportedContent(reply, info); h->handleUnsupportedContent(reply, info);
} }
#endif
void DownloadManager::itemCreated(QListWidgetItem* item, DownloadItem* downItem) void DownloadManager::itemCreated(QListWidgetItem* item, DownloadItem* downItem)
{ {
@ -349,3 +353,4 @@ DownloadManager::~DownloadManager()
{ {
delete ui; delete ui;
} }

View File

@ -30,12 +30,12 @@ class DownloadManager;
class QNetworkReply; class QNetworkReply;
class QNetworkRequest; class QNetworkRequest;
class QNetworkAccessManager;
class QListWidgetItem; class QListWidgetItem;
class QUrl; class QUrl;
class DownloadItem; class DownloadItem;
class EcWin7; class EcWin7;
class NetworkManager;
class WebPage; class WebPage;
class QUPZILLA_EXPORT DownloadManager : public QWidget class QUPZILLA_EXPORT DownloadManager : public QWidget
@ -65,7 +65,10 @@ public:
void loadSettings(); void loadSettings();
void download(const QNetworkRequest &request, const DownloadInfo &info); void download(const QNetworkRequest &request, const DownloadInfo &info);
#if QTWEBENGINE_DISABLED
void handleUnsupportedContent(QNetworkReply* reply, const DownloadInfo &info); void handleUnsupportedContent(QNetworkReply* reply, const DownloadInfo &info);
#endif
bool canClose(); bool canClose();
@ -107,7 +110,7 @@ private:
void keyPressEvent(QKeyEvent* e); void keyPressEvent(QKeyEvent* e);
Ui::DownloadManager* ui; Ui::DownloadManager* ui;
NetworkManager* m_networkManager; QNetworkAccessManager* m_networkManager;
QBasicTimer m_timer; QBasicTimer m_timer;
QString m_lastDownloadPath; QString m_lastDownloadPath;

View File

@ -27,7 +27,7 @@
#include "qzsettings.h" #include "qzsettings.h"
#include <QApplication> #include <QApplication>
#include <QWebHistory> #include <QWebEngineHistory>
#include <QSqlQuery> #include <QSqlQuery>
static QKeySequence actionShortcut(QKeySequence shortcut, QKeySequence fallback, QKeySequence shortcutRTL, QKeySequence fallbackRTL) static QKeySequence actionShortcut(QKeySequence shortcut, QKeySequence fallback, QKeySequence shortcutRTL, QKeySequence fallbackRTL)

View File

@ -19,8 +19,10 @@
#include "mainapplication.h" #include "mainapplication.h"
#include "history.h" #include "history.h"
#if QTWEBENGINE_DISABLED
WebHistoryInterface::WebHistoryInterface(QObject* parent) WebHistoryInterface::WebHistoryInterface(QObject* parent)
: QWebHistoryInterface(parent) : QWebEngineHistoryInterface(parent)
{ {
} }
@ -33,3 +35,5 @@ bool WebHistoryInterface::historyContains(const QString &url) const
{ {
return m_clickedLinks.find(url) != m_clickedLinks.end(); return m_clickedLinks.find(url) != m_clickedLinks.end();
} }
#endif

View File

@ -18,12 +18,13 @@
#ifndef WEBHISTORYINTERFACE_H #ifndef WEBHISTORYINTERFACE_H
#define WEBHISTORYINTERFACE_H #define WEBHISTORYINTERFACE_H
#include <QWebHistoryInterface>
#include <set> #include <set>
#include "qzcommon.h" #include "qzcommon.h"
class QUPZILLA_EXPORT WebHistoryInterface : public QWebHistoryInterface #if QTWEBENGINE_DISABLED
class QUPZILLA_EXPORT WebHistoryInterface : public QWebEngineHistoryInterface
{ {
public: public:
explicit WebHistoryInterface(QObject* parent = 0); explicit WebHistoryInterface(QObject* parent = 0);
@ -36,4 +37,6 @@ private:
}; };
#endif
#endif // WEBHISTORYINTERFACE_H #endif // WEBHISTORYINTERFACE_H

View File

@ -1,5 +1,5 @@
isEqual(QT_MAJOR_VERSION, 5) { isEqual(QT_MAJOR_VERSION, 5) {
QT += webkitwidgets network widgets printsupport sql script gui-private QT += webenginewidgets network widgets printsupport sql script gui-private
} else { } else {
QT += core gui webkit sql network script concurrent QT += core gui webkit sql network script concurrent
} }
@ -12,7 +12,9 @@ DEFINES *= QUPZILLA_SHAREDLIBRARY
include(../defines.pri) include(../defines.pri)
include(../../translations/translations.pri) include(../../translations/translations.pri)
include(3rdparty/qtsingleapplication/qtsingleapplication.pri) include(3rdparty/qtsingleapplication/qtsingleapplication.pri)
include(plugins/qtwebkit/qtwebkit-plugins.pri)
# QTWEBENGINE DISABLED
#include(plugins/qtwebkit/qtwebkit-plugins.pri)
CONFIG(debug, debug|release): include(../../tests/modeltest/modeltest.pri) CONFIG(debug, debug|release): include(../../tests/modeltest/modeltest.pri)

View File

@ -61,7 +61,6 @@ LocationBar::LocationBar(BrowserWindow* window)
m_bookmarkIcon = new BookmarksIcon(this); m_bookmarkIcon = new BookmarksIcon(this);
m_goIcon = new GoIcon(this); m_goIcon = new GoIcon(this);
m_rssIcon = new RssIcon(this);
m_siteIcon = new SiteIcon(m_window, this); m_siteIcon = new SiteIcon(m_window, this);
m_autofillIcon = new AutoFillIcon(this); m_autofillIcon = new AutoFillIcon(this);
DownIcon* down = new DownIcon(this); DownIcon* down = new DownIcon(this);
@ -69,7 +68,6 @@ LocationBar::LocationBar(BrowserWindow* window)
addWidget(m_siteIcon, LineEdit::LeftSide); addWidget(m_siteIcon, LineEdit::LeftSide);
addWidget(m_autofillIcon, LineEdit::RightSide); addWidget(m_autofillIcon, LineEdit::RightSide);
addWidget(m_bookmarkIcon, LineEdit::RightSide); addWidget(m_bookmarkIcon, LineEdit::RightSide);
addWidget(m_rssIcon, LineEdit::RightSide);
addWidget(m_goIcon, LineEdit::RightSide); addWidget(m_goIcon, LineEdit::RightSide);
addWidget(down, LineEdit::RightSide); addWidget(down, LineEdit::RightSide);
@ -104,7 +102,6 @@ LocationBar::LocationBar(BrowserWindow* window)
// Hide icons by default // Hide icons by default
m_goIcon->setVisible(qzSettings->alwaysShowGoIcon); m_goIcon->setVisible(qzSettings->alwaysShowGoIcon);
m_rssIcon->hide();
m_autofillIcon->hide(); m_autofillIcon->hide();
QTimer::singleShot(0, this, SLOT(updatePlaceHolderText())); QTimer::singleShot(0, this, SLOT(updatePlaceHolderText()));
@ -120,17 +117,18 @@ void LocationBar::setWebView(TabbedWebView* view)
m_webView = view; m_webView = view;
m_bookmarkIcon->setWebView(m_webView); m_bookmarkIcon->setWebView(m_webView);
m_rssIcon->setWebView(m_webView);
m_siteIcon->setWebView(m_webView); m_siteIcon->setWebView(m_webView);
m_autofillIcon->setWebView(m_webView); m_autofillIcon->setWebView(m_webView);
connect(m_webView, SIGNAL(loadStarted()), SLOT(loadStarted())); connect(m_webView, SIGNAL(loadStarted()), SLOT(loadStarted()));
connect(m_webView, SIGNAL(loadProgress(int)), SLOT(loadProgress(int))); connect(m_webView, SIGNAL(loadProgress(int)), SLOT(loadProgress(int)));
connect(m_webView, SIGNAL(loadFinished(bool)), SLOT(loadFinished())); connect(m_webView, SIGNAL(loadFinished(bool)), SLOT(loadFinished()));
connect(m_webView, SIGNAL(iconChanged()), this, SLOT(updateSiteIcon()));
connect(m_webView, SIGNAL(urlChanged(QUrl)), this, SLOT(showUrl(QUrl))); connect(m_webView, SIGNAL(urlChanged(QUrl)), this, SLOT(showUrl(QUrl)));
connect(m_webView, SIGNAL(rssChanged(bool)), this, SLOT(setRssIconVisible(bool))); connect(m_webView, SIGNAL(rssChanged(bool)), this, SLOT(setRssIconVisible(bool)));
connect(m_webView, SIGNAL(privacyChanged(bool)), this, SLOT(setPrivacyState(bool))); connect(m_webView, SIGNAL(privacyChanged(bool)), this, SLOT(setPrivacyState(bool)));
#if QTWEBENGINE_DISABLED
connect(m_webView, SIGNAL(iconChanged()), this, SLOT(updateSiteIcon()));
#endif
} }
void LocationBar::setText(const QString &text) void LocationBar::setText(const QString &text)
@ -299,11 +297,9 @@ void LocationBar::setGoIconVisible(bool state)
{ {
if (state) { if (state) {
m_bookmarkIcon->hide(); m_bookmarkIcon->hide();
m_rssIcon->hide();
m_goIcon->show(); m_goIcon->show();
} }
else { else {
m_rssIcon->setVisible(m_webView && m_webView->hasRss());
m_bookmarkIcon->show(); m_bookmarkIcon->show();
if (!qzSettings->alwaysShowGoIcon) { if (!qzSettings->alwaysShowGoIcon) {
@ -316,8 +312,6 @@ void LocationBar::setGoIconVisible(bool state)
void LocationBar::setRssIconVisible(bool state) void LocationBar::setRssIconVisible(bool state)
{ {
m_rssIcon->setVisible(state);
updateTextMargins(); updateTextMargins();
} }

View File

@ -33,7 +33,7 @@
#include <QSplitter> #include <QSplitter>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QStackedWidget> #include <QStackedWidget>
#include <QWebHistory> #include <QWebEngineHistory>
#include <QMouseEvent> #include <QMouseEvent>
#include <QStyleOption> #include <QStyleOption>
@ -212,13 +212,13 @@ void NavigationBar::aboutToShowHistoryBackMenu()
return; return;
} }
m_menuBack->clear(); m_menuBack->clear();
QWebHistory* history = m_window->weView()->history(); QWebEngineHistory* history = m_window->weView()->history();
int curindex = history->currentItemIndex(); int curindex = history->currentItemIndex();
int count = 0; int count = 0;
for (int i = curindex - 1; i >= 0; i--) { for (int i = curindex - 1; i >= 0; i--) {
QWebHistoryItem item = history->itemAt(i); QWebEngineHistoryItem item = history->itemAt(i);
if (item.isValid()) { if (item.isValid()) {
QString title = titleForUrl(item.title(), item.url()); QString title = titleForUrl(item.title(), item.url());
@ -247,12 +247,12 @@ void NavigationBar::aboutToShowHistoryNextMenu()
} }
m_menuForward->clear(); m_menuForward->clear();
QWebHistory* history = m_window->weView()->history(); QWebEngineHistory* history = m_window->weView()->history();
int curindex = history->currentItemIndex(); int curindex = history->currentItemIndex();
int count = 0; int count = 0;
for (int i = curindex + 1; i < history->count(); i++) { for (int i = curindex + 1; i < history->count(); i++) {
QWebHistoryItem item = history->itemAt(i); QWebEngineHistoryItem item = history->itemAt(i);
if (item.isValid()) { if (item.isValid()) {
QString title = titleForUrl(item.title(), item.url()); QString title = titleForUrl(item.title(), item.url());
@ -276,7 +276,7 @@ void NavigationBar::aboutToShowHistoryNextMenu()
void NavigationBar::clearHistory() void NavigationBar::clearHistory()
{ {
QWebHistory* history = m_window->weView()->page()->history(); QWebEngineHistory* history = m_window->weView()->page()->history();
history->clear(); history->clear();
refreshHistory(); refreshHistory();
} }
@ -290,7 +290,7 @@ void NavigationBar::contextMenuRequested(const QPoint &pos)
void NavigationBar::loadHistoryIndex() void NavigationBar::loadHistoryIndex()
{ {
QWebHistory* history = m_window->weView()->page()->history(); QWebEngineHistory* history = m_window->weView()->page()->history();
if (QAction* action = qobject_cast<QAction*>(sender())) { if (QAction* action = qobject_cast<QAction*>(sender())) {
loadHistoryItem(history->itemAt(action->data().toInt())); loadHistoryItem(history->itemAt(action->data().toInt()));
@ -307,7 +307,7 @@ void NavigationBar::loadHistoryIndexInNewTab(int index)
return; return;
} }
QWebHistory* history = m_window->weView()->page()->history(); QWebEngineHistory* history = m_window->weView()->page()->history();
loadHistoryItemInNewTab(history->itemAt(index)); loadHistoryItemInNewTab(history->itemAt(index));
} }
@ -317,7 +317,7 @@ void NavigationBar::refreshHistory()
return; return;
} }
QWebHistory* history = m_window->weView()->page()->history(); QWebEngineHistory* history = m_window->weView()->page()->history();
m_buttonBack->setEnabled(history->canGoBack()); m_buttonBack->setEnabled(history->canGoBack());
m_buttonForward->setEnabled(history->canGoForward()); m_buttonForward->setEnabled(history->canGoForward());
} }
@ -334,13 +334,13 @@ void NavigationBar::reload()
void NavigationBar::goBack() void NavigationBar::goBack()
{ {
QWebHistory* history = m_window->weView()->page()->history(); QWebEngineHistory* history = m_window->weView()->page()->history();
history->back(); history->back();
} }
void NavigationBar::goBackInNewTab() void NavigationBar::goBackInNewTab()
{ {
QWebHistory* history = m_window->weView()->page()->history(); QWebEngineHistory* history = m_window->weView()->page()->history();
if (!history->canGoBack()) { if (!history->canGoBack()) {
return; return;
@ -351,13 +351,13 @@ void NavigationBar::goBackInNewTab()
void NavigationBar::goForward() void NavigationBar::goForward()
{ {
QWebHistory* history = m_window->weView()->page()->history(); QWebEngineHistory* history = m_window->weView()->page()->history();
history->forward(); history->forward();
} }
void NavigationBar::goForwardInNewTab() void NavigationBar::goForwardInNewTab()
{ {
QWebHistory* history = m_window->weView()->page()->history(); QWebEngineHistory* history = m_window->weView()->page()->history();
if (!history->canGoForward()) { if (!history->canGoForward()) {
return; return;
@ -387,19 +387,19 @@ QIcon NavigationBar::iconForPage(const QUrl &url, const QIcon &sIcon)
return icon; return icon;
} }
void NavigationBar::loadHistoryItem(const QWebHistoryItem &item) void NavigationBar::loadHistoryItem(const QWebEngineHistoryItem &item)
{ {
m_window->weView()->page()->history()->goToItem(item); m_window->weView()->page()->history()->goToItem(item);
refreshHistory(); refreshHistory();
} }
void NavigationBar::loadHistoryItemInNewTab(const QWebHistoryItem &item) void NavigationBar::loadHistoryItemInNewTab(const QWebEngineHistoryItem &item)
{ {
TabWidget* tabWidget = m_window->tabWidget(); TabWidget* tabWidget = m_window->tabWidget();
int tabIndex = tabWidget->duplicateTab(tabWidget->currentIndex()); int tabIndex = tabWidget->duplicateTab(tabWidget->currentIndex());
QWebHistory* history = m_window->weView(tabIndex)->page()->history(); QWebEngineHistory* history = m_window->weView(tabIndex)->page()->history();
history->goToItem(item); history->goToItem(item);
if (qzSettings->newTabPosition == Qz::NT_SelectedTab) { if (qzSettings->newTabPosition == Qz::NT_SelectedTab) {

View File

@ -24,7 +24,7 @@
class QHBoxLayout; class QHBoxLayout;
class QSplitter; class QSplitter;
class QWebHistoryItem; class QWebEngineHistoryItem;
class ToolButton; class ToolButton;
class WebSearchBar; class WebSearchBar;
@ -90,8 +90,8 @@ private:
QString titleForUrl(QString title, const QUrl &url); QString titleForUrl(QString title, const QUrl &url);
QIcon iconForPage(const QUrl &url, const QIcon &sIcon); QIcon iconForPage(const QUrl &url, const QIcon &sIcon);
void loadHistoryItem(const QWebHistoryItem &item); void loadHistoryItem(const QWebEngineHistoryItem &item);
void loadHistoryItemInNewTab(const QWebHistoryItem &item); void loadHistoryItemInNewTab(const QWebEngineHistoryItem &item);
BrowserWindow* m_window; BrowserWindow* m_window;

View File

@ -36,7 +36,9 @@
#include <QStringListModel> #include <QStringListModel>
#include <QMenu> #include <QMenu>
#include <QTimer> #include <QTimer>
#include <QWebFrame> #if QTWEBENGINE_DISABLED
#include <QWebEngineFrame>
#endif
#include <QClipboard> #include <QClipboard>
#include <QContextMenuEvent> #include <QContextMenuEvent>
@ -217,8 +219,10 @@ void WebSearchBar::searchInNewTab()
void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu) void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu)
{ {
Q_UNUSED(menu)
#if QTWEBENGINE_DISABLED
WebView* view = m_window->weView(); WebView* view = m_window->weView();
QWebFrame* frame = view->page()->mainFrame(); QWebEngineFrame* frame = view->page()->mainFrame();
QWebElementCollection elements = frame->documentElement().findAll(QLatin1String("link[rel=search]")); QWebElementCollection elements = frame->documentElement().findAll(QLatin1String("link[rel=search]"));
foreach (const QWebElement &element, elements) { foreach (const QWebElement &element, elements) {
@ -237,6 +241,7 @@ void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu)
menu->addAction(view->icon(), tr("Add %1 ...").arg(title), this, SLOT(addEngineFromAction()))->setData(url); menu->addAction(view->icon(), tr("Add %1 ...").arg(title), this, SLOT(addEngineFromAction()))->setData(url);
} }
#endif
} }
void WebSearchBar::addEngineFromAction() void WebSearchBar::addEngineFromAction()

View File

@ -27,6 +27,8 @@
#include <QNetworkReply> #include <QNetworkReply>
#include <QFile> #include <QFile>
#if QTWEBENGINE_DISABLED
CaBundleUpdater::CaBundleUpdater(NetworkManager* manager, QObject* parent) CaBundleUpdater::CaBundleUpdater(NetworkManager* manager, QObject* parent)
: QObject(parent) : QObject(parent)
, m_manager(manager) , m_manager(manager)
@ -146,3 +148,5 @@ void CaBundleUpdater::replyFinished()
mApp->networkManager()->loadSettings(); mApp->networkManager()->loadSettings();
} }
} }
#endif

View File

@ -18,6 +18,8 @@
#ifndef CABUNDLEUPDATER_H #ifndef CABUNDLEUPDATER_H
#define CABUNDLEUPDATER_H #define CABUNDLEUPDATER_H
#if QTWEBENGINE_DISABLED
#include <QObject> #include <QObject>
#include "qzcommon.h" #include "qzcommon.h"
@ -54,4 +56,6 @@ private:
int m_latestBundleVersion; int m_latestBundleVersion;
}; };
#endif
#endif // CABUNDLEUPDATER_H #endif // CABUNDLEUPDATER_H

View File

@ -54,6 +54,8 @@
#include <QAuthenticator> #include <QAuthenticator>
#include <QDirIterator> #include <QDirIterator>
#if QTWEBENGINE_DISABLED
static QString fileNameForCert(const QSslCertificate &cert) static QString fileNameForCert(const QSslCertificate &cert)
{ {
QString certFileName = CertificateInfoWidget::certificateItemText(cert); QString certFileName = CertificateInfoWidget::certificateItemText(cert);
@ -74,8 +76,6 @@ NetworkManager::NetworkManager(QObject* parent)
, m_ignoreAllWarnings(false) , m_ignoreAllWarnings(false)
, m_disableWeakCiphers(true) , m_disableWeakCiphers(true)
{ {
connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authentication(QNetworkReply*,QAuthenticator*)));
connect(this, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this, SLOT(proxyAuthentication(QNetworkProxy,QAuthenticator*)));
connect(this, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), this, SLOT(sslError(QNetworkReply*,QList<QSslError>))); 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*)));
@ -341,7 +341,7 @@ void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth)
} }
// Try to set the originating WebTab as a current tab // Try to set the originating WebTab as a current tab
QWebFrame* frame = qobject_cast<QWebFrame*>(reply->request().originatingObject()); QWebEngineFrame* frame = qobject_cast<QWebEngineFrame*>(reply->request().originatingObject());
if (frame) { if (frame) {
WebPage* page = qobject_cast<WebPage*>(frame->page()); WebPage* page = qobject_cast<WebPage*>(frame->page());
if (page) { if (page) {
@ -462,63 +462,6 @@ void NetworkManager::ftpAuthentication(const QUrl &url, QAuthenticator* auth)
} }
} }
void NetworkManager::proxyAuthentication(const QNetworkProxy &proxy, QAuthenticator* auth)
{
QString userName;
QString password;
QVector<PasswordEntry> psws = mApp->autoFill()->getFormData(QUrl(proxy.hostName()));
if (psws.isEmpty()) {
QDialog* dialog = new QDialog();
dialog->setWindowTitle(tr("Proxy authorisation required"));
QFormLayout* formLa = new QFormLayout(dialog);
QLabel* label = new QLabel(dialog);
QLabel* userLab = new QLabel(dialog);
QLabel* passLab = new QLabel(dialog);
userLab->setText(tr("Username: "));
passLab->setText(tr("Password: "));
QLineEdit* user = new QLineEdit(dialog);
QLineEdit* pass = new QLineEdit(dialog);
pass->setEchoMode(QLineEdit::Password);
QDialogButtonBox* box = new QDialogButtonBox(dialog);
box->addButton(QDialogButtonBox::Ok);
box->addButton(QDialogButtonBox::Cancel);
connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));
QCheckBox* rememberCheck = new QCheckBox(tr("Remember username and password for this proxy."), dialog);
label->setText(tr("A username and password are being requested by proxy %1. ").arg(proxy.hostName()));
formLa->addRow(label);
formLa->addRow(userLab, user);
formLa->addRow(passLab, pass);
formLa->addRow(rememberCheck);
formLa->addWidget(box);
if (dialog->exec() != QDialog::Accepted) {
return;
}
if (rememberCheck->isChecked()) {
mApp->autoFill()->addEntry(QUrl(proxy.hostName()), user->text(), pass->text());
}
userName = user->text();
password = pass->text();
}
else {
userName = psws.at(0).username;
password = psws.at(0).password;
}
auth->setUser(userName);
auth->setPassword(password);
}
QNetworkReply* NetworkManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData) QNetworkReply* NetworkManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData)
{ {
if (op == PostOperation && outgoingData) { if (op == PostOperation && outgoingData) {
@ -775,3 +718,5 @@ void NetworkManager::loadCertificates()
new CaBundleUpdater(this, this); new CaBundleUpdater(this, this);
#endif #endif
} }
#endif

View File

@ -18,6 +18,8 @@
#ifndef NETWORKMANAGER_H #ifndef NETWORKMANAGER_H
#define NETWORKMANAGER_H #define NETWORKMANAGER_H
#if QTWEBENGINE_DISABLED
#include <QSslError> #include <QSslError>
#include <QStringList> #include <QStringList>
@ -64,9 +66,7 @@ signals:
void sslDialogClosed(); void sslDialogClosed();
private slots: private slots:
void authentication(QNetworkReply* reply, QAuthenticator* auth);
void ftpAuthentication(const QUrl &url, QAuthenticator* auth); void ftpAuthentication(const QUrl &url, QAuthenticator* auth);
void proxyAuthentication(const QNetworkProxy &proxy, QAuthenticator* auth);
void sslError(QNetworkReply* reply, QList<QSslError> errors); void sslError(QNetworkReply* reply, QList<QSslError> errors);
void setSSLConfiguration(QNetworkReply* reply); void setSSLConfiguration(QNetworkReply* reply);
@ -90,4 +90,6 @@ private:
bool m_sendReferer; bool m_sendReferer;
}; };
#endif
#endif // NETWORKMANAGER_H #endif // NETWORKMANAGER_H

View File

@ -23,6 +23,8 @@
#include <QNetworkRequest> #include <QNetworkRequest>
#if QTWEBENGINE_DISABLED
NetworkManagerProxy::NetworkManagerProxy(QObject* parent) NetworkManagerProxy::NetworkManagerProxy(QObject* parent)
: QNetworkAccessManager(parent) : QNetworkAccessManager(parent)
, m_page(0) , m_page(0)
@ -57,3 +59,5 @@ QNetworkReply* NetworkManagerProxy::createRequest(QNetworkAccessManager::Operati
return QNetworkAccessManager::createRequest(op, request, outgoingData); return QNetworkAccessManager::createRequest(op, request, outgoingData);
} }
#endif

View File

@ -18,6 +18,8 @@
#ifndef NETWORKMANAGERPROXY_H #ifndef NETWORKMANAGERPROXY_H
#define NETWORKMANAGERPROXY_H #define NETWORKMANAGERPROXY_H
#if QTWEBENGINE_DISABLED
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include "qzcommon.h" #include "qzcommon.h"
@ -40,4 +42,6 @@ private:
NetworkManager* m_manager; NetworkManager* m_manager;
}; };
#endif
#endif // NETWORKMANAGERPROXY_H #endif // NETWORKMANAGERPROXY_H

View File

@ -22,6 +22,7 @@
#include "iconprovider.h" #include "iconprovider.h"
#include "mainapplication.h" #include "mainapplication.h"
#if QTWEBENGINE_DISABLED
#include <QWebSecurityOrigin> #include <QWebSecurityOrigin>
#include <QFileIconProvider> #include <QFileIconProvider>
#include <QDateTime> #include <QDateTime>
@ -576,3 +577,5 @@ void FtpDownloader::onDone(bool err)
emit finished(); emit finished();
} }
} }
#endif

View File

@ -24,6 +24,8 @@
#include <QNetworkReply> #include <QNetworkReply>
#include <QBuffer> #include <QBuffer>
#if QTWEBENGINE_DISABLED
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include "qftp.h" #include "qftp.h"
#include "qurlinfo.h" #include "qurlinfo.h"
@ -128,4 +130,6 @@ signals:
void finished(); void finished();
void errorOccured(QFtp::Error); void errorOccured(QFtp::Error);
}; };
#endif
#endif // FTPSCHEMEHANDLER_H #endif // FTPSCHEMEHANDLER_H

View File

@ -28,6 +28,8 @@
#include "datapaths.h" #include "datapaths.h"
#include "iconprovider.h" #include "iconprovider.h"
#if QTWEBENGINE_DISABLED
#include <QTextStream> #include <QTextStream>
#include <QTimer> #include <QTimer>
#include <QSettings> #include <QSettings>
@ -36,7 +38,7 @@
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
#include "qwebkitversion.h" #include "qwebkitversion.h"
#else #else
#include <QWebPage> #include <QWebEnginePage>
#endif #endif
static QString authorString(const char* name, const QString &mail) static QString authorString(const char* name, const QString &mail)
@ -499,3 +501,5 @@ QString QupZillaSchemeReply::configPage()
return page; return page;
} }
#endif

View File

@ -21,6 +21,8 @@
#include <QNetworkReply> #include <QNetworkReply>
#include <QBuffer> #include <QBuffer>
#if QTWEBENGINE_DISABLED
#include "schemehandler.h" #include "schemehandler.h"
#include "qzcommon.h" #include "qzcommon.h"
@ -60,4 +62,6 @@ private:
QString m_pageName; QString m_pageName;
}; };
#endif
#endif // QUPZILLASCHEMEHANDLER_H #endif // QUPZILLASCHEMEHANDLER_H

View File

@ -29,7 +29,6 @@
#include <QNetworkReply> #include <QNetworkReply>
#include <QMessageBox> #include <QMessageBox>
#include <QWebElement>
#include <QSqlQuery> #include <QSqlQuery>
#include <QBuffer> #include <QBuffer>
@ -261,6 +260,7 @@ void SearchEnginesManager::addEngine(const Engine &engine)
void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView* view) void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView* view)
{ {
#if QTWEBENGINE_DISABLED
QWebElement formElement = element.parent(); QWebElement formElement = element.parent();
while (!formElement.isNull()) { while (!formElement.isNull()) {
@ -362,6 +362,7 @@ void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView
} }
addEngine(engine); addEngine(engine);
#endif
} }
void SearchEnginesManager::addEngine(OpenSearchEngine* engine) void SearchEnginesManager::addEngine(OpenSearchEngine* engine)

View File

@ -26,7 +26,7 @@
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
#include "qwebkitversion.h" #include "qwebkitversion.h"
#else #else
#include <QWebPage> #include <QWebEnginePage>
#endif #endif
AboutDialog::AboutDialog(QWidget* parent) AboutDialog::AboutDialog(QWidget* parent)
@ -75,11 +75,15 @@ void AboutDialog::showAbout()
Qz::VERSION Qz::VERSION
#endif #endif
); );
#if QTWEBENGINE_DISABLED
m_aboutHtml += tr("<b>WebKit version %1</b></p>").arg(qWebKitVersion()); m_aboutHtml += tr("<b>WebKit version %1</b></p>").arg(qWebKitVersion());
#endif
m_aboutHtml += QString("<p>&copy; %1 %2<br/>").arg(Qz::COPYRIGHT, Qz::AUTHOR); m_aboutHtml += QString("<p>&copy; %1 %2<br/>").arg(Qz::COPYRIGHT, Qz::AUTHOR);
m_aboutHtml += tr("<small>Build time: %1 </small></p>").arg(Qz::BUILDTIME); m_aboutHtml += tr("<small>Build time: %1 </small></p>").arg(Qz::BUILDTIME);
m_aboutHtml += QString("<p><a href=%1>%1</a></p>").arg(Qz::WWWADDRESS); m_aboutHtml += QString("<p><a href=%1>%1</a></p>").arg(Qz::WWWADDRESS);
#if QTWEBENGINE_DISABLED
m_aboutHtml += "<p>" + (mApp->windowCount() > 0 ? mApp->getWindow()->weView()->page()->userAgentForUrl(QUrl()) : QString()) + "</p>"; m_aboutHtml += "<p>" + (mApp->windowCount() > 0 ? mApp->getWindow()->weView()->page()->userAgentForUrl(QUrl()) : QString()) + "</p>";
#endif
m_aboutHtml += "</div></center>"; m_aboutHtml += "</div></center>";
} }
ui->textBrowser->setHtml(m_aboutHtml); ui->textBrowser->setHtml(m_aboutHtml);

View File

@ -34,7 +34,6 @@ BrowsingLibrary::BrowsingLibrary(BrowserWindow* window, QWidget* parent)
, ui(new Ui::BrowsingLibrary) , ui(new Ui::BrowsingLibrary)
, m_historyManager(new HistoryManager(window)) , m_historyManager(new HistoryManager(window))
, m_bookmarksManager(new BookmarksManager(window)) , m_bookmarksManager(new BookmarksManager(window))
, m_rssManager(mApp->rssManager())
, m_rssLoaded(false) , m_rssLoaded(false)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -49,7 +48,6 @@ BrowsingLibrary::BrowsingLibrary(BrowserWindow* window, QWidget* parent)
ui->tabs->AddTab(m_historyManager, QIcon(":/icons/other/bighistory.png"), tr("History")); ui->tabs->AddTab(m_historyManager, QIcon(":/icons/other/bighistory.png"), tr("History"));
ui->tabs->AddTab(m_bookmarksManager, QIcon(":/icons/other/bigstar.png"), tr("Bookmarks")); ui->tabs->AddTab(m_bookmarksManager, QIcon(":/icons/other/bigstar.png"), tr("Bookmarks"));
ui->tabs->AddTab(m_rssManager, QIcon(":/icons/other/feed.png"), tr("RSS"));
ui->tabs->SetMode(FancyTabWidget::Mode_LargeSidebar); ui->tabs->SetMode(FancyTabWidget::Mode_LargeSidebar);
ui->tabs->setFocus(); ui->tabs->setFocus();
@ -79,7 +77,6 @@ void BrowsingLibrary::currentIndexChanged(int index)
case 2: case 2:
if (!m_rssLoaded) { if (!m_rssLoaded) {
m_rssManager->refreshTable();
m_rssLoaded = true; m_rssLoaded = true;
} }
ui->searchLine->hide(); ui->searchLine->hide();
@ -134,6 +131,7 @@ void BrowsingLibrary::showBookmarks(BrowserWindow* window)
void BrowsingLibrary::showRSS(BrowserWindow* window) void BrowsingLibrary::showRSS(BrowserWindow* window)
{ {
#if QTWEBENGINE_DISABLED
ui->tabs->SetCurrentIndex(2); ui->tabs->SetCurrentIndex(2);
show(); show();
m_rssManager->setMainWindow(window); m_rssManager->setMainWindow(window);
@ -145,6 +143,7 @@ void BrowsingLibrary::showRSS(BrowserWindow* window)
raise(); raise();
activateWindow(); activateWindow();
#endif
} }
void BrowsingLibrary::closeEvent(QCloseEvent* e) void BrowsingLibrary::closeEvent(QCloseEvent* e)
@ -155,10 +154,6 @@ void BrowsingLibrary::closeEvent(QCloseEvent* e)
settings.setValue("historyState", m_historyManager->saveState()); settings.setValue("historyState", m_historyManager->saveState());
settings.endGroup(); settings.endGroup();
e->accept(); e->accept();
// Saves a few megabytes
m_rssManager->deleteAllTabs();
m_rssLoaded = false;
} }
void BrowsingLibrary::keyPressEvent(QKeyEvent* e) void BrowsingLibrary::keyPressEvent(QKeyEvent* e)

View File

@ -33,8 +33,10 @@
#include <QNetworkCookie> #include <QNetworkCookie>
#include <QMessageBox> #include <QMessageBox>
#if QTWEBENGINE_DISABLED
#include <QWebDatabase> #include <QWebDatabase>
#include <QWebSettings> #endif
#include <QWebEngineSettings>
#include <QNetworkDiskCache> #include <QNetworkDiskCache>
#include <QDateTime> #include <QDateTime>
#include <QSqlQuery> #include <QSqlQuery>
@ -78,21 +80,27 @@ void ClearPrivateData::clearWebDatabases()
{ {
const QString profile = DataPaths::currentProfilePath(); const QString profile = DataPaths::currentProfilePath();
#if QTWEBENGINE_DISABLED
QWebDatabase::removeAllDatabases(); QWebDatabase::removeAllDatabases();
#endif
QzTools::removeDir(profile + "/Databases"); QzTools::removeDir(profile + "/Databases");
} }
void ClearPrivateData::clearCache() void ClearPrivateData::clearCache()
{ {
mApp->networkCache()->clear(); mApp->networkCache()->clear();
QWebSettings::globalSettings()->clearMemoryCaches(); #if QTWEBENGINE_DISABLED
QWebEngineSettings::globalSettings()->clearMemoryCaches();
#endif
QFile::remove(DataPaths::currentProfilePath() + "/ApplicationCache.db"); QFile::remove(DataPaths::currentProfilePath() + "/ApplicationCache.db");
} }
void ClearPrivateData::clearIcons() void ClearPrivateData::clearIcons()
{ {
QWebSettings::globalSettings()->clearIconDatabase(); #if QTWEBENGINE_DISABLED
QWebEngineSettings::globalSettings()->clearIconDatabase();
#endif
IconProvider::instance()->clearIconsDatabase(); IconProvider::instance()->clearIconsDatabase();
} }

View File

@ -331,9 +331,9 @@ void MacMenuReceiver::quitApp()
} }
} }
void MacMenuReceiver::printPage(QWebFrame* frame) void MacMenuReceiver::printPage(QWebEngineFrame* frame)
{ {
callSlot("printPage", false, Q_ARG(QWebFrame*, frame)); callSlot("printPage", false, Q_ARG(QWebEngineFrame*, frame));
} }
void MacMenuReceiver::showBookmarksToolbar() void MacMenuReceiver::showBookmarksToolbar()
@ -341,9 +341,9 @@ void MacMenuReceiver::showBookmarksToolbar()
callSlot("showBookmarksToolbar"); callSlot("showBookmarksToolbar");
} }
void MacMenuReceiver::showSource(QWebFrame* frame, const QString &selectedHtml) void MacMenuReceiver::showSource(QWebEngineFrame* frame, const QString &selectedHtml)
{ {
callSlot("showSource", false, Q_ARG(QWebFrame*, frame), Q_ARG(const QString &, selectedHtml)); callSlot("showSource", false, Q_ARG(QWebEngineFrame*, frame), Q_ARG(const QString &, selectedHtml));
} }
void MacMenuReceiver::bookmarkPage() void MacMenuReceiver::bookmarkPage()

View File

@ -23,7 +23,7 @@
#include "qzcommon.h" #include "qzcommon.h"
class QWebFrame; class QWebEngineFrame;
class Menu; class Menu;
class QMenu; class QMenu;
class QAction; class QAction;
@ -127,9 +127,9 @@ private slots:
void closeWindow(); void closeWindow();
void quitApp(); void quitApp();
void printPage(QWebFrame* frame = 0); void printPage(QWebEngineFrame* frame = 0);
void showBookmarksToolbar(); void showBookmarksToolbar();
void showSource(QWebFrame* frame = 0, const QString &selectedHtml = QString()); void showSource(QWebEngineFrame* frame = 0, const QString &selectedHtml = QString());
void bookmarkPage(); void bookmarkPage();
void showPageInfo(); void showPageInfo();
void showWebInspector(bool toggle = true); void showWebInspector(bool toggle = true);

View File

@ -23,9 +23,11 @@
#include "browserwindow.h" #include "browserwindow.h"
#include "settings.h" #include "settings.h"
#if QTWEBENGINE_DISABLED
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include <QWebFrame> #include <QWebEngineFrame>
#include <QLabel> #include <QLabel>
#include <QTimer> #include <QTimer>
#include <QMovie> #include <QMovie>
@ -191,7 +193,7 @@ void PageScreen::saveAsDocument(const QString &format)
void PageScreen::createThumbnail() void PageScreen::createThumbnail()
{ {
QWebPage* page = m_view->page(); QWebEnginePage* page = m_view->page();
const int heightLimit = 20000; const int heightLimit = 20000;
const QPoint originalScrollPosition = page->mainFrame()->scrollPosition(); const QPoint originalScrollPosition = page->mainFrame()->scrollPosition();
@ -275,3 +277,5 @@ PageScreen::~PageScreen()
{ {
delete ui; delete ui;
} }
#endif

View File

@ -23,6 +23,8 @@
#include "qzcommon.h" #include "qzcommon.h"
#if QTWEBENGINE_DISABLED
namespace Ui namespace Ui
{ {
class PageScreen; class PageScreen;
@ -63,4 +65,6 @@ private:
QStringList m_formats; QStringList m_formats;
}; };
#endif
#endif // PAGESCREEN_H #endif // PAGESCREEN_H

View File

@ -26,11 +26,13 @@
#include "qztools.h" #include "qztools.h"
#include "iconprovider.h" #include "iconprovider.h"
#if QTWEBENGINE_DISABLED
#include <QMenu> #include <QMenu>
#include <QMessageBox> #include <QMessageBox>
#include <QFileDialog> #include <QFileDialog>
#include <QNetworkDiskCache> #include <QNetworkDiskCache>
#include <QWebFrame> #include <QWebEngineFrame>
#include <QClipboard> #include <QClipboard>
#include <QWebSecurityOrigin> #include <QWebSecurityOrigin>
#include <QWebDatabase> #include <QWebDatabase>
@ -66,7 +68,7 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent)
ui->listWidget->item(0)->setSelected(true); ui->listWidget->item(0)->setSelected(true);
WebPage* webPage = view->page(); WebPage* webPage = view->page();
QWebFrame* frame = view->page()->mainFrame(); QWebEngineFrame* frame = view->page()->mainFrame();
QString title = view->title(); QString title = view->title();
QSslCertificate cert = webPage->sslCertificate(); QSslCertificate cert = webPage->sslCertificate();
m_baseUrl = frame->baseUrl(); m_baseUrl = frame->baseUrl();
@ -103,7 +105,7 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent)
ui->treeTags->addTopLevelItem(item); ui->treeTags->addTopLevelItem(item);
} }
if (encoding.isEmpty()) { if (encoding.isEmpty()) {
encoding = QWebSettings::globalSettings()->defaultTextEncoding(); encoding = QWebEngineSettings::globalSettings()->defaultTextEncoding();
} }
ui->encodingLabel->setText(encoding.toUpper()); ui->encodingLabel->setText(encoding.toUpper());
@ -298,3 +300,5 @@ SiteInfo::~SiteInfo()
delete ui; delete ui;
delete m_certWidget; delete m_certWidget;
} }
#endif

View File

@ -23,6 +23,8 @@
#include <QDialog> #include <QDialog>
#include <QUrl> #include <QUrl>
#if QTWEBENGINE_DISABLED
namespace Ui namespace Ui
{ {
class SiteInfo; class SiteInfo;
@ -62,4 +64,6 @@ private:
QUrl m_baseUrl; QUrl m_baseUrl;
}; };
#endif
#endif // SITEINFO_H #endif // SITEINFO_H

View File

@ -29,10 +29,11 @@
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include <QInputDialog> #include <QInputDialog>
#include <QWebFrame>
#include <QTimer> #include <QTimer>
SourceViewer::SourceViewer(QWebFrame* frame, const QString &selectedHtml) #if QTWEBENGINE_DISABLED
SourceViewer::SourceViewer(QWebEngineFrame* frame, const QString &selectedHtml)
: QWidget(0) : QWidget(0)
, m_frame(frame) , m_frame(frame)
, m_selectedHtml(selectedHtml) , m_selectedHtml(selectedHtml)
@ -231,3 +232,5 @@ void SourceViewer::goToLine()
m_sourceEdit->goToLine(line); m_sourceEdit->goToLine(line);
} }
#endif

View File

@ -18,6 +18,8 @@
#ifndef SOURCEVIEWER_H #ifndef SOURCEVIEWER_H
#define SOURCEVIEWER_H #define SOURCEVIEWER_H
#if QTWEBENGINE_DISABLED
#include <QWidget> #include <QWidget>
#include <QPointer> #include <QPointer>
@ -27,13 +29,13 @@ class PlainEditWithLines;
class QBoxLayout; class QBoxLayout;
class QStatusBar; class QStatusBar;
class QWebFrame; class QWebEngineFrame;
class QUPZILLA_EXPORT SourceViewer : public QWidget class QUPZILLA_EXPORT SourceViewer : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SourceViewer(QWebFrame* frame, const QString &selectedHtml); explicit SourceViewer(QWebEngineFrame* frame, const QString &selectedHtml);
PlainEditWithLines* sourceEdit() { return m_sourceEdit; } PlainEditWithLines* sourceEdit() { return m_sourceEdit; }
private slots: private slots:
@ -54,7 +56,7 @@ private slots:
private: private:
QBoxLayout* m_layout; QBoxLayout* m_layout;
PlainEditWithLines* m_sourceEdit; PlainEditWithLines* m_sourceEdit;
QPointer<QWebFrame> m_frame; QPointer<QWebEngineFrame> m_frame;
QStatusBar* m_statusBar; QStatusBar* m_statusBar;
QString m_selectedHtml; QString m_selectedHtml;
@ -66,4 +68,6 @@ private:
QAction* m_actionPaste; QAction* m_actionPaste;
}; };
#endif
#endif // SOURCEVIEWER_H #endif // SOURCEVIEWER_H

View File

@ -24,6 +24,8 @@
#include <QShortcut> #include <QShortcut>
#include <QKeyEvent> #include <QKeyEvent>
#if QTWEBENGINE_DISABLED
SourceViewerSearch::SourceViewerSearch(SourceViewer* parent) SourceViewerSearch::SourceViewerSearch(SourceViewer* parent)
: AnimatedWidget(AnimatedWidget::Up) : AnimatedWidget(AnimatedWidget::Up)
, m_sourceViewer(parent) , m_sourceViewer(parent)
@ -132,3 +134,5 @@ bool SourceViewerSearch::eventFilter(QObject* obj, QEvent* event)
return AnimatedWidget::eventFilter(obj, event); return AnimatedWidget::eventFilter(obj, event);
} }
#endif

View File

@ -23,6 +23,8 @@
#include "qzcommon.h" #include "qzcommon.h"
#include "animatedwidget.h" #include "animatedwidget.h"
#if QTWEBENGINE_DISABLED
namespace Ui namespace Ui
{ {
class SourceViewerSearch; class SourceViewerSearch;
@ -59,4 +61,6 @@ private:
QTextDocument::FindFlags m_findFlags; QTextDocument::FindFlags m_findFlags;
}; };
#endif
#endif // SOURCEVIEWERSEARCH_H #endif // SOURCEVIEWERSEARCH_H

View File

@ -29,7 +29,6 @@
#include <QStatusBar> #include <QStatusBar>
#include <QToolTip> #include <QToolTip>
#include <QStylePainter> #include <QStylePainter>
#include <QWebFrame>
#include <QTimer> #include <QTimer>
TipLabel::TipLabel(QWidget* parent) TipLabel::TipLabel(QWidget* parent)
@ -125,18 +124,22 @@ void StatusBarMessage::showMessage(const QString &message)
else { else {
#endif #endif
WebView* view = m_window->weView(); WebView* view = m_window->weView();
QWebFrame* mainFrame = view->page()->mainFrame(); #if QTWEBENGINE_DISABLED
QWebEngineFrame* mainFrame = view->page()->mainFrame();
#endif
int horizontalScrollSize = 0; int horizontalScrollSize = 0;
int verticalScrollSize = 0; int verticalScrollSize = 0;
const int scrollbarSize = m_window->style()->pixelMetric(QStyle::PM_ScrollBarExtent); const int scrollbarSize = m_window->style()->pixelMetric(QStyle::PM_ScrollBarExtent);
#if QTWEBENGINE_DISABLED
if (mainFrame->scrollBarMaximum(Qt::Horizontal)) { if (mainFrame->scrollBarMaximum(Qt::Horizontal)) {
horizontalScrollSize = scrollbarSize; horizontalScrollSize = scrollbarSize;
} }
if (mainFrame->scrollBarMaximum(Qt::Vertical)) { if (mainFrame->scrollBarMaximum(Qt::Vertical)) {
verticalScrollSize = scrollbarSize; verticalScrollSize = scrollbarSize;
} }
#endif
m_statusBarText->setText(message); m_statusBarText->setText(message);
m_statusBarText->setMaximumWidth(view->width() - verticalScrollSize); m_statusBarText->setMaximumWidth(view->width() - verticalScrollSize);

View File

@ -20,7 +20,7 @@
#include "qztools.h" #include "qztools.h"
#include "settings.h" #include "settings.h"
#include <QWebPage> // QTWEBKIT_VERSION_CHECK macro #include <QWebEnginePage> // QTWEBKIT_VERSION_CHECK macro
UserAgentManager::UserAgentManager(QObject* parent) UserAgentManager::UserAgentManager(QObject* parent)
: QObject(parent) : QObject(parent)

View File

@ -51,8 +51,10 @@
#include <QFormLayout> #include <QFormLayout>
#include <QMenu> #include <QMenu>
#include <QTimer> #include <QTimer>
#include <QWebView> #include <QWebEngineView>
#include <QNetworkRequest> #include <QNetworkRequest>
#if QTWEBENGINE_DISABLED
#include <QWebHitTestResult> #include <QWebHitTestResult>
QUrl ClickToFlash::acceptedUrl; QUrl ClickToFlash::acceptedUrl;
@ -152,9 +154,9 @@ void ClickToFlash::findElement()
} }
QWidget* parent = parentWidget(); QWidget* parent = parentWidget();
QWebView* view = 0; QWebEngineView* view = 0;
while (parent) { while (parent) {
if (QWebView* aView = qobject_cast<QWebView*>(parent)) { if (QWebEngineView* aView = qobject_cast<QWebEngineView*>(parent)) {
view = aView; view = aView;
break; break;
} }
@ -165,7 +167,7 @@ void ClickToFlash::findElement()
} }
QPoint objectPos = view->mapFromGlobal(m_toolButton->mapToGlobal(m_toolButton->pos())); QPoint objectPos = view->mapFromGlobal(m_toolButton->mapToGlobal(m_toolButton->pos()));
QWebFrame* objectFrame = view->page()->frameAt(objectPos); QWebEngineFrame* objectFrame = view->page()->frameAt(objectPos);
QWebHitTestResult hitResult; QWebHitTestResult hitResult;
QWebElement hitElement; QWebElement hitElement;
@ -183,12 +185,12 @@ void ClickToFlash::findElement()
// HitTestResult failed, trying to find element by src // HitTestResult failed, trying to find element by src
// attribute in elements at all frames on page (less accurate) // attribute in elements at all frames on page (less accurate)
QList<QWebFrame*> frames; QList<QWebEngineFrame*> frames;
frames.append(objectFrame); frames.append(objectFrame);
frames.append(view->page()->mainFrame()); frames.append(view->page()->mainFrame());
while (!frames.isEmpty()) { while (!frames.isEmpty()) {
QWebFrame* frame = frames.takeFirst(); QWebEngineFrame* frame = frames.takeFirst();
if (!frame) { if (!frame) {
continue; continue;
} }
@ -320,3 +322,5 @@ void ClickToFlash::showInfo()
QzTools::centerWidgetToParent(widg, m_page->view()); QzTools::centerWidgetToParent(widg, m_page->view());
widg->show(); widg->show();
} }
#endif

View File

@ -42,6 +42,8 @@
#ifndef CLICKTOFLASH_H #ifndef CLICKTOFLASH_H
#define CLICKTOFLASH_H #define CLICKTOFLASH_H
#if QTWEBENGINE_DISABLED
#include "qzcommon.h" #include "qzcommon.h"
// Qt Includes // Qt Includes
@ -98,5 +100,7 @@ private:
WebPage* m_page; WebPage* m_page;
}; };
#endif
#endif // CLICKTOFLASH_H #endif // CLICKTOFLASH_H

View File

@ -21,7 +21,11 @@
#include <QPixmap> #include <QPixmap>
#include <QtPlugin> #include <QtPlugin>
#include <QNetworkRequest> #include <QNetworkRequest>
#if QTWEBENGINE_DISABLED
#include <QWebHitTestResult> #include <QWebHitTestResult>
#endif
#include <QNetworkAccessManager>
#include "qzcommon.h" #include "qzcommon.h"

View File

@ -29,7 +29,7 @@
Plugins::Plugins(QObject* parent) Plugins::Plugins(QObject* parent)
: QObject(parent) : QObject(parent)
, m_pluginsLoaded(false) , m_pluginsLoaded(false)
, m_speedDial(new SpeedDial(this)) //, m_speedDial(new SpeedDial(this))
{ {
loadSettings(); loadSettings();
} }

View File

@ -22,11 +22,13 @@
#include "qztools.h" #include "qztools.h"
#include "autosaver.h" #include "autosaver.h"
#if QTWEBENGINE_DISABLED
#include <QDir> #include <QDir>
#include <QCryptographicHash> #include <QCryptographicHash>
#include <QFileDialog> #include <QFileDialog>
#include <QWebFrame> #include <QWebEngineFrame>
#include <QWebPage> #include <QWebEnginePage>
#include <QImage> #include <QImage>
#define ENSURE_LOADED if (!m_loaded) loadSettings(); #define ENSURE_LOADED if (!m_loaded) loadSettings();
@ -124,7 +126,7 @@ QUrl SpeedDial::urlForShortcut(int key)
return QUrl::fromEncoded(m_webPages.at(key).url.toUtf8()); return QUrl::fromEncoded(m_webPages.at(key).url.toUtf8());
} }
void SpeedDial::addWebFrame(QWebFrame* frame) void SpeedDial::addWebFrame(QWebEngineFrame* frame)
{ {
if (!m_webFrames.contains(frame)) { if (!m_webFrames.contains(frame)) {
m_webFrames.append(frame); m_webFrames.append(frame);
@ -146,8 +148,8 @@ void SpeedDial::addPage(const QUrl &url, const QString &title)
m_webPages.append(page); m_webPages.append(page);
m_regenerateScript = true; m_regenerateScript = true;
foreach (QWebFrame* frame, cleanFrames()) { foreach (QWebEngineFrame* frame, cleanFrames()) {
frame->page()->triggerAction(QWebPage::Reload); frame->page()->triggerAction(QWebEnginePage::Reload);
} }
emit pagesChanged(); emit pagesChanged();
@ -165,8 +167,8 @@ void SpeedDial::removePage(const Page &page)
m_webPages.removeAll(page); m_webPages.removeAll(page);
m_regenerateScript = true; m_regenerateScript = true;
foreach (QWebFrame* frame, cleanFrames()) { foreach (QWebEngineFrame* frame, cleanFrames()) {
frame->page()->triggerAction(QWebPage::Reload); frame->page()->triggerAction(QWebEnginePage::Reload);
} }
emit pagesChanged(); emit pagesChanged();
@ -361,7 +363,7 @@ void SpeedDial::thumbnailCreated(const QPixmap &pixmap)
m_regenerateScript = true; m_regenerateScript = true;
cleanFrames(); cleanFrames();
foreach (QWebFrame* frame, cleanFrames()) { foreach (QWebEngineFrame* frame, cleanFrames()) {
frame->evaluateJavaScript(QString("setImageToUrl('%1', '%2');").arg(escapeUrl(url), escapeTitle(fileName))); frame->evaluateJavaScript(QString("setImageToUrl('%1', '%2');").arg(escapeUrl(url), escapeTitle(fileName)));
if (loadTitle) { if (loadTitle) {
frame->evaluateJavaScript(QString("setTitleToUrl('%1', '%2');").arg(escapeUrl(url), escapeTitle(title))); frame->evaluateJavaScript(QString("setTitleToUrl('%1', '%2');").arg(escapeUrl(url), escapeTitle(title)));
@ -413,3 +415,5 @@ QString SpeedDial::generateAllPages()
return allPages; return allPages;
} }
#endif

View File

@ -18,13 +18,15 @@
#ifndef SPEEDDIAL_H #ifndef SPEEDDIAL_H
#define SPEEDDIAL_H #define SPEEDDIAL_H
#if QTWEBENGINE_DISABLED
#include <QObject> #include <QObject>
#include <QPointer> #include <QPointer>
#include "qzcommon.h" #include "qzcommon.h"
class QUrl; class QUrl;
class QWebFrame; class QWebEngineFrame;
class QPixmap; class QPixmap;
class AutoSaver; class AutoSaver;
@ -52,7 +54,7 @@ public:
Page pageForUrl(const QUrl &url); Page pageForUrl(const QUrl &url);
QUrl urlForShortcut(int key); QUrl urlForShortcut(int key);
void addWebFrame(QWebFrame* frame); void addWebFrame(QWebEngineFrame* frame);
void addPage(const QUrl &url, const QString &title); void addPage(const QUrl &url, const QString &title);
void removePage(const Page &page); void removePage(const Page &page);
@ -88,7 +90,7 @@ private:
QString escapeTitle(QString string) const; QString escapeTitle(QString string) const;
QString escapeUrl(QString url) const; QString escapeUrl(QString url) const;
QList<QWebFrame*> cleanFrames(); QList<QWebEngineFrame*> cleanFrames();
QString generateAllPages(); QString generateAllPages();
QString m_initialScript; QString m_initialScript;
@ -107,4 +109,6 @@ private:
bool m_regenerateScript; bool m_regenerateScript;
}; };
#endif
#endif // SPEEDDIAL_H #endif // SPEEDDIAL_H

View File

@ -55,7 +55,6 @@ PopupLocationBar::PopupLocationBar(QWidget* parent)
m_siteIcon->setFixedSize(26, 26); m_siteIcon->setFixedSize(26, 26);
m_bookmarkIcon = new BookmarksIcon(this); m_bookmarkIcon = new BookmarksIcon(this);
m_rssIcon = new RssIcon(this);
m_autofillIcon = new AutoFillIcon(this); m_autofillIcon = new AutoFillIcon(this);
m_loadingAnimation = new QLabel(this); m_loadingAnimation = new QLabel(this);
@ -69,7 +68,6 @@ PopupLocationBar::PopupLocationBar(QWidget* parent)
addWidget(m_siteIcon, LineEdit::LeftSide); addWidget(m_siteIcon, LineEdit::LeftSide);
addWidget(m_autofillIcon, LineEdit::RightSide); addWidget(m_autofillIcon, LineEdit::RightSide);
addWidget(m_bookmarkIcon, LineEdit::RightSide); addWidget(m_bookmarkIcon, LineEdit::RightSide);
addWidget(m_rssIcon, LineEdit::RightSide);
addWidget(m_loadingAnimation, LineEdit::RightSide); addWidget(m_loadingAnimation, LineEdit::RightSide);
addWidget(rightSpacer, LineEdit::RightSide); addWidget(rightSpacer, LineEdit::RightSide);
setLeftMargin(20); setLeftMargin(20);
@ -78,7 +76,6 @@ PopupLocationBar::PopupLocationBar(QWidget* parent)
setReadOnly(true); setReadOnly(true);
// Hide icons by default // Hide icons by default
m_rssIcon->hide();
m_autofillIcon->hide(); m_autofillIcon->hide();
} }
@ -87,7 +84,6 @@ void PopupLocationBar::setView(PopupWebView* view)
m_view = view; m_view = view;
m_bookmarkIcon->setWebView(m_view); m_bookmarkIcon->setWebView(m_view);
m_rssIcon->setWebView(m_view);
m_autofillIcon->setWebView(m_view); m_autofillIcon->setWebView(m_view);
connect(m_view, SIGNAL(rssChanged(bool)), this, SLOT(showRSSIcon(bool))); connect(m_view, SIGNAL(rssChanged(bool)), this, SLOT(showRSSIcon(bool)));
@ -133,7 +129,5 @@ void PopupLocationBar::showSiteIcon()
void PopupLocationBar::showRSSIcon(bool state) void PopupLocationBar::showRSSIcon(bool state)
{ {
m_rssIcon->setVisible(state);
updateTextMargins(); updateTextMargins();
} }

View File

@ -24,7 +24,6 @@
#include <QStatusBar> #include <QStatusBar>
#include <QStyle> #include <QStyle>
#include <QWebFrame>
PopupStatusBarMessage::PopupStatusBarMessage(PopupWindow* window) PopupStatusBarMessage::PopupStatusBarMessage(PopupWindow* window)
: m_popupWindow(window) : m_popupWindow(window)
@ -43,18 +42,22 @@ void PopupStatusBarMessage::showMessage(const QString &message)
else { else {
#endif #endif
PopupWebView* view = m_popupWindow->webView(); PopupWebView* view = m_popupWindow->webView();
QWebFrame* mainFrame = view->page()->mainFrame(); #if QTWEBENGINE_DISABLED
QWebEngineFrame* mainFrame = view->page()->mainFrame();
#endif
int horizontalScrollSize = 0; int horizontalScrollSize = 0;
int verticalScrollSize = 0; int verticalScrollSize = 0;
const int scrollbarSize = m_popupWindow->style()->pixelMetric(QStyle::PM_ScrollBarExtent); const int scrollbarSize = m_popupWindow->style()->pixelMetric(QStyle::PM_ScrollBarExtent);
#if QTWEBENGINE_DISABLED
if (mainFrame->scrollBarMaximum(Qt::Horizontal)) { if (mainFrame->scrollBarMaximum(Qt::Horizontal)) {
horizontalScrollSize = scrollbarSize; horizontalScrollSize = scrollbarSize;
} }
if (mainFrame->scrollBarMaximum(Qt::Vertical)) { if (mainFrame->scrollBarMaximum(Qt::Vertical)) {
verticalScrollSize = scrollbarSize; verticalScrollSize = scrollbarSize;
} }
#endif
m_statusBarText->setText(message); m_statusBarText->setText(message);
m_statusBarText->setMaximumWidth(view->width() - verticalScrollSize); m_statusBarText->setMaximumWidth(view->width() - verticalScrollSize);

View File

@ -31,7 +31,7 @@
// //
// Got an idea how to determine it from kWebKitPart. // Got an idea how to determine it from kWebKitPart.
PopupWebPage::PopupWebPage(QWebPage::WebWindowType type, BrowserWindow* window) PopupWebPage::PopupWebPage(QWebEnginePage::WebWindowType type, BrowserWindow* window)
: WebPage() : WebPage()
, m_window(window) , m_window(window)
, m_type(type) , m_type(type)
@ -43,9 +43,11 @@ PopupWebPage::PopupWebPage(QWebPage::WebWindowType type, BrowserWindow* window)
, m_progress(0) , m_progress(0)
{ {
connect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect))); connect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect)));
#if QTWEBENGINE_DISABLED
connect(this, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(slotMenuBarVisibilityChangeRequested(bool))); connect(this, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(slotMenuBarVisibilityChangeRequested(bool)));
connect(this, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(slotToolBarVisibilityChangeRequested(bool))); connect(this, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(slotToolBarVisibilityChangeRequested(bool)));
connect(this, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(slotStatusBarVisibilityChangeRequested(bool))); connect(this, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(slotStatusBarVisibilityChangeRequested(bool)));
#endif
connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted())); connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));

View File

@ -45,7 +45,7 @@ private slots:
private: private:
BrowserWindow* m_window; BrowserWindow* m_window;
QWebPage::WebWindowType m_type; QWebEnginePage::WebWindowType m_type;
bool m_createNewWindow; bool m_createNewWindow;
bool m_menuBarVisible; bool m_menuBarVisible;

View File

@ -25,7 +25,6 @@
#include "enhancedmenu.h" #include "enhancedmenu.h"
#include "loadrequest.h" #include "loadrequest.h"
#include <QWebFrame>
#include <QContextMenuEvent> #include <QContextMenuEvent>
PopupWebView::PopupWebView(QWidget* parent) PopupWebView::PopupWebView(QWidget* parent)
@ -94,13 +93,16 @@ void PopupWebView::closeView()
void PopupWebView::inspectElement() void PopupWebView::inspectElement()
{ {
triggerPageAction(QWebPage::InspectElement); #if QTWEBENGINE_DISABLED
triggerPageAction(QWebEnginePage::InspectElement);
#endif
} }
void PopupWebView::contextMenuEvent(QContextMenuEvent* event) void PopupWebView::contextMenuEvent(QContextMenuEvent* event)
{ {
m_menu->clear(); m_menu->clear();
#if QTWEBENGINE_DISABLED
const QWebHitTestResult hitTest = page()->mainFrame()->hitTestContent(event->pos()); const QWebHitTestResult hitTest = page()->mainFrame()->hitTestContent(event->pos());
createContextMenu(m_menu, hitTest, event->pos()); createContextMenu(m_menu, hitTest, event->pos());
@ -115,6 +117,7 @@ void PopupWebView::contextMenuEvent(QContextMenuEvent* event)
m_menu->popup(p); m_menu->popup(p);
return; return;
} }
#endif
WebView::contextMenuEvent(event); WebView::contextMenuEvent(event);
} }

View File

@ -28,7 +28,6 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QStatusBar> #include <QStatusBar>
#include <QWebFrame>
#include <QCloseEvent> #include <QCloseEvent>
#include <QMenuBar> #include <QMenuBar>
@ -67,14 +66,14 @@ PopupWindow::PopupWindow(PopupWebView* view)
m_menuBar->addMenu(menuFile); m_menuBar->addMenu(menuFile);
m_menuEdit = new QMenu(tr("Edit")); m_menuEdit = new QMenu(tr("Edit"));
m_menuEdit->addAction(m_view->pageAction(QWebPage::Undo)); m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::Undo));
m_menuEdit->addAction(m_view->pageAction(QWebPage::Redo)); m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::Redo));
m_menuEdit->addSeparator(); m_menuEdit->addSeparator();
m_menuEdit->addAction(m_view->pageAction(QWebPage::Cut)); m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::Cut));
m_menuEdit->addAction(m_view->pageAction(QWebPage::Copy)); m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::Copy));
m_menuEdit->addAction(m_view->pageAction(QWebPage::Paste)); m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::Paste));
m_menuEdit->addSeparator(); m_menuEdit->addSeparator();
m_menuEdit->addAction(m_view->pageAction(QWebPage::SelectAll)); m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::SelectAll));
m_menuEdit->addAction(QIcon::fromTheme("edit-find"), tr("Find"), this, SLOT(searchOnPage()))->setShortcut(QKeySequence("Ctrl+F")); m_menuEdit->addAction(QIcon::fromTheme("edit-find"), tr("Find"), this, SLOT(searchOnPage()))->setShortcut(QKeySequence("Ctrl+F"));
m_menuBar->addMenu(m_menuEdit); m_menuBar->addMenu(m_menuEdit);
@ -125,9 +124,11 @@ PopupWindow::PopupWindow(PopupWebView* view)
titleChanged(); titleChanged();
QUrl urlToShow = m_view->url(); QUrl urlToShow = m_view->url();
#if QTWEBENGINE_DISABLED
if (urlToShow.isEmpty()) { if (urlToShow.isEmpty()) {
urlToShow = m_view->page()->mainFrame()->requestedUrl(); urlToShow = m_view->page()->mainFrame()->requestedUrl();
} }
#endif
m_locationBar->showUrl(urlToShow); m_locationBar->showUrl(urlToShow);
@ -212,8 +213,10 @@ void PopupWindow::closeEvent(QCloseEvent* event)
void PopupWindow::savePageScreen() void PopupWindow::savePageScreen()
{ {
#if QTWEBENGINE_DISABLED
PageScreen* pageScreen = new PageScreen(m_view, this); PageScreen* pageScreen = new PageScreen(m_view, this);
pageScreen->show(); pageScreen->show();
#endif
} }
void PopupWindow::searchOnPage() void PopupWindow::searchOnPage()

View File

@ -21,7 +21,7 @@
#include "mainapplication.h" #include "mainapplication.h"
#include "settings.h" #include "settings.h"
#include <QWebPage> // QTWEBKIT_VERSION_CHECK macro #include <QWebEnginePage> // QTWEBKIT_VERSION_CHECK macro
#include <QFileDialog> #include <QFileDialog>
JsOptions::JsOptions(QWidget* parent) JsOptions::JsOptions(QWidget* parent)

View File

@ -364,18 +364,19 @@ Preferences::Preferences(BrowserWindow* window, QWidget* parent)
//FONTS //FONTS
settings.beginGroup("Browser-Fonts"); settings.beginGroup("Browser-Fonts");
QWebSettings* webSettings = QWebSettings::globalSettings(); #if QTWEBENGINE_DISABLED
ui->fontStandard->setCurrentFont(QFont(settings.value("StandardFont", webSettings->fontFamily(QWebSettings::StandardFont)).toString())); QWebEngineSettings* webSettings = QWebEngineSettings::globalSettings();
ui->fontCursive->setCurrentFont(QFont(settings.value("CursiveFont", webSettings->fontFamily(QWebSettings::CursiveFont)).toString())); ui->fontStandard->setCurrentFont(QFont(settings.value("StandardFont", webSettings->fontFamily(QWebEngineSettings::StandardFont)).toString()));
ui->fontFantasy->setCurrentFont(QFont(settings.value("FantasyFont", webSettings->fontFamily(QWebSettings::FantasyFont)).toString())); ui->fontCursive->setCurrentFont(QFont(settings.value("CursiveFont", webSettings->fontFamily(QWebEngineSettings::CursiveFont)).toString()));
ui->fontFixed->setCurrentFont(QFont(settings.value("FixedFont", webSettings->fontFamily(QWebSettings::FixedFont)).toString())); ui->fontFantasy->setCurrentFont(QFont(settings.value("FantasyFont", webSettings->fontFamily(QWebEngineSettings::FantasyFont)).toString()));
ui->fontSansSerif->setCurrentFont(QFont(settings.value("SansSerifFont", webSettings->fontFamily(QWebSettings::SansSerifFont)).toString())); ui->fontFixed->setCurrentFont(QFont(settings.value("FixedFont", webSettings->fontFamily(QWebEngineSettings::FixedFont)).toString()));
ui->fontSerif->setCurrentFont(QFont(settings.value("SerifFont", webSettings->fontFamily(QWebSettings::SerifFont)).toString())); ui->fontSansSerif->setCurrentFont(QFont(settings.value("SansSerifFont", webSettings->fontFamily(QWebEngineSettings::SansSerifFont)).toString()));
ui->fontSerif->setCurrentFont(QFont(settings.value("SerifFont", webSettings->fontFamily(QWebEngineSettings::SerifFont)).toString()));
ui->sizeDefault->setValue(settings.value("DefaultFontSize", webSettings->fontSize(QWebSettings::DefaultFontSize)).toInt()); ui->sizeDefault->setValue(settings.value("DefaultFontSize", webSettings->fontSize(QWebEngineSettings::DefaultFontSize)).toInt());
ui->sizeFixed->setValue(settings.value("FixedFontSize", webSettings->fontSize(QWebSettings::DefaultFixedFontSize)).toInt()); ui->sizeFixed->setValue(settings.value("FixedFontSize", webSettings->fontSize(QWebEngineSettings::DefaultFixedFontSize)).toInt());
ui->sizeMinimum->setValue(settings.value("MinimumFontSize", webSettings->fontSize(QWebSettings::MinimumFontSize)).toInt()); ui->sizeMinimum->setValue(settings.value("MinimumFontSize", webSettings->fontSize(QWebEngineSettings::MinimumFontSize)).toInt());
ui->sizeMinimumLogical->setValue(settings.value("MinimumLogicalFontSize", webSettings->fontSize(QWebSettings::MinimumLogicalFontSize)).toInt()); ui->sizeMinimumLogical->setValue(settings.value("MinimumLogicalFontSize", webSettings->fontSize(QWebEngineSettings::MinimumLogicalFontSize)).toInt());
#endif
settings.endGroup(); settings.endGroup();
//KEYBOARD SHORTCUTS //KEYBOARD SHORTCUTS
@ -780,7 +781,9 @@ void Preferences::changeCachePathClicked()
void Preferences::reloadPacFileClicked() void Preferences::reloadPacFileClicked()
{ {
#if QTWEBENGINE_DISABLED
mApp->networkManager()->proxyFactory()->pacManager()->downloadPacFile(); mApp->networkManager()->proxyFactory()->pacManager()->downloadPacFile();
#endif
} }
void Preferences::showPassManager(bool state) void Preferences::showPassManager(bool state)
@ -1110,7 +1113,9 @@ 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(); mApp->networkManager()->loadSettings();
#endif
mApp->desktopNotifications()->loadSettings(); mApp->desktopNotifications()->loadSettings();
mApp->autoFill()->loadSettings(); mApp->autoFill()->loadSettings();
} }

View File

@ -56,8 +56,10 @@ SSLManager::SSLManager(QWidget* parent)
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()));
// Settings // Settings
#if QTWEBENGINE_DISABLED
ui->disableWeakCiphers->setChecked(mApp->networkManager()->isDisablingWeakCiphers()); ui->disableWeakCiphers->setChecked(mApp->networkManager()->isDisablingWeakCiphers());
ui->ignoreAll->setChecked(mApp->networkManager()->isIgnoringAllWarnings()); ui->ignoreAll->setChecked(mApp->networkManager()->isIgnoringAllWarnings());
#endif
} }
void SSLManager::addPath() void SSLManager::addPath()
@ -98,6 +100,7 @@ void SSLManager::refreshCAList()
void SSLManager::refreshLocalList() void SSLManager::refreshLocalList()
{ {
#if QTWEBENGINE_DISABLED
ui->localList->setUpdatesEnabled(false); ui->localList->setUpdatesEnabled(false);
ui->localList->clear(); ui->localList->clear();
m_localCerts = mApp->networkManager()->getLocalCertificates(); m_localCerts = mApp->networkManager()->getLocalCertificates();
@ -111,13 +114,16 @@ void SSLManager::refreshLocalList()
ui->localList->setCurrentRow(0); ui->localList->setCurrentRow(0);
ui->localList->setUpdatesEnabled(true); ui->localList->setUpdatesEnabled(true);
#endif
} }
void SSLManager::refreshPaths() void SSLManager::refreshPaths()
{ {
#if QTWEBENGINE_DISABLED
foreach (const QString &path, mApp->networkManager()->certificatePaths()) { foreach (const QString &path, mApp->networkManager()->certificatePaths()) {
ui->pathList->addItem(path); ui->pathList->addItem(path);
} }
#endif
} }
void SSLManager::showCaCertInfo() void SSLManager::showCaCertInfo()
@ -133,6 +139,7 @@ void SSLManager::showCaCertInfo()
void SSLManager::addLocalCertificate() void SSLManager::addLocalCertificate()
{ {
#if QTWEBENGINE_DISABLED
const QString path = QzTools::getOpenFileName("SSLManager-AddLocalCert", this, tr("Import certificate..."), QDir::homePath(), "*.crt"); const QString path = QzTools::getOpenFileName("SSLManager-AddLocalCert", this, tr("Import certificate..."), QDir::homePath(), "*.crt");
if (path.isEmpty()) { if (path.isEmpty()) {
@ -147,6 +154,7 @@ void SSLManager::addLocalCertificate()
mApp->networkManager()->addLocalCertificate(list.at(0)); mApp->networkManager()->addLocalCertificate(list.at(0));
refreshLocalList(); refreshLocalList();
#endif
} }
void SSLManager::showLocalCertInfo() void SSLManager::showLocalCertInfo()
@ -179,6 +187,7 @@ void SSLManager::showCertificateInfo(const QSslCertificate &cert)
void SSLManager::deleteCertificate() void SSLManager::deleteCertificate()
{ {
#if QTWEBENGINE_DISABLED
QListWidgetItem* item = ui->localList->currentItem(); QListWidgetItem* item = ui->localList->currentItem();
if (!item) { if (!item) {
return; return;
@ -188,20 +197,26 @@ void SSLManager::deleteCertificate()
m_localCerts.removeOne(cert); m_localCerts.removeOne(cert);
mApp->networkManager()->removeLocalCertificate(cert); mApp->networkManager()->removeLocalCertificate(cert);
refreshLocalList(); refreshLocalList();
#endif
} }
void SSLManager::ignoreAll(bool state) void SSLManager::ignoreAll(bool state)
{ {
#if QTWEBENGINE_DISABLED
mApp->networkManager()->setIgnoreAllWarnings(state); mApp->networkManager()->setIgnoreAllWarnings(state);
#endif
} }
void SSLManager::disableWeakCiphers(bool state) void SSLManager::disableWeakCiphers(bool state)
{ {
#if QTWEBENGINE_DISABLED
mApp->networkManager()->setDisableWeakCiphers(state); mApp->networkManager()->setDisableWeakCiphers(state);
#endif
} }
void SSLManager::closeEvent(QCloseEvent* e) void SSLManager::closeEvent(QCloseEvent* e)
{ {
#if QTWEBENGINE_DISABLED
QStringList paths; QStringList paths;
for (int i = 0; i < ui->pathList->count(); i++) { for (int i = 0; i < ui->pathList->count(); i++) {
QListWidgetItem* item = ui->pathList->item(i); QListWidgetItem* item = ui->pathList->item(i);
@ -214,6 +229,7 @@ void SSLManager::closeEvent(QCloseEvent* e)
mApp->networkManager()->setCertificatePaths(paths); mApp->networkManager()->setCertificatePaths(paths);
mApp->networkManager()->saveSettings(); mApp->networkManager()->saveSettings();
#endif
QWidget::closeEvent(e); QWidget::closeEvent(e);
} }

View File

@ -20,6 +20,8 @@
#include <QMouseEvent> #include <QMouseEvent>
#if QTWEBENGINE_DISABLED
RssIcon::RssIcon(QWidget* parent) RssIcon::RssIcon(QWidget* parent)
: ClickableLabel(parent) : ClickableLabel(parent)
, m_view(0) , m_view(0)
@ -60,3 +62,5 @@ void RssIcon::mousePressEvent(QMouseEvent* ev)
// Prevent propagating to LocationBar // Prevent propagating to LocationBar
ev->accept(); ev->accept();
} }
#endif

View File

@ -21,6 +21,8 @@
#include "qzcommon.h" #include "qzcommon.h"
#include "clickablelabel.h" #include "clickablelabel.h"
#if QTWEBENGINE_DISABLED
class WebView; class WebView;
class QUPZILLA_EXPORT RssIcon : public ClickableLabel class QUPZILLA_EXPORT RssIcon : public ClickableLabel
@ -41,4 +43,6 @@ private:
WebView* m_view; WebView* m_view;
}; };
#endif
#endif // RSSICON_H #endif // RSSICON_H

View File

@ -32,12 +32,14 @@
#include <QLabel> #include <QLabel>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
#include <QWebSettings> #include <QWebEngineSettings>
#include <QMessageBox> #include <QMessageBox>
#include <QNetworkReply> #include <QNetworkReply>
#include <QBuffer> #include <QBuffer>
#include <QSqlQuery> #include <QSqlQuery>
#if QTWEBENGINE_DISABLED
RSSManager::RSSManager(BrowserWindow* window, QWidget* parent) RSSManager::RSSManager(BrowserWindow* window, QWidget* parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::RSSManager) , ui(new Ui::RSSManager)
@ -423,3 +425,5 @@ RSSManager::~RSSManager()
{ {
delete ui; delete ui;
} }
#endif

View File

@ -30,6 +30,8 @@
#include <QToolButton> #include <QToolButton>
#include <QInputDialog> #include <QInputDialog>
#if QTWEBENGINE_DISABLED
namespace Ui namespace Ui
{ {
class RSSManager; class RSSManager;
@ -77,4 +79,6 @@ private:
QPointer<BrowserWindow> m_window; QPointer<BrowserWindow> m_window;
}; };
#endif
#endif // RSSMANAGER_H #endif // RSSMANAGER_H

View File

@ -30,6 +30,8 @@
#include <QClipboard> #include <QClipboard>
#include <QFile> #include <QFile>
#if QTWEBENGINE_DISABLED
RSSNotification::RSSNotification(const QString &title, const QUrl &url, WebView* parent) RSSNotification::RSSNotification(const QString &title, const QUrl &url, WebView* parent)
: AnimatedWidget(AnimatedWidget::Down, 300, parent) : AnimatedWidget(AnimatedWidget::Down, 300, parent)
, ui(new Ui::RSSNotification) , ui(new Ui::RSSNotification)
@ -185,3 +187,5 @@ RSSNotification::~RSSNotification()
{ {
delete ui; delete ui;
} }
#endif

View File

@ -25,6 +25,8 @@
#include "qzcommon.h" #include "qzcommon.h"
#include "animatedwidget.h" #include "animatedwidget.h"
#if QTWEBENGINE_DISABLED
class WebView; class WebView;
namespace Ui namespace Ui
@ -65,4 +67,6 @@ private:
QVector<RssApp> m_rssApps; QVector<RssApp> m_rssApps;
}; };
#endif
#endif // RSSNOTIFICATION_H #endif // RSSNOTIFICATION_H

View File

@ -23,9 +23,11 @@
#include "rssmanager.h" #include "rssmanager.h"
#include "rssnotification.h" #include "rssnotification.h"
#if QTWEBENGINE_DISABLED
#include <QToolTip> #include <QToolTip>
#include <QPushButton> #include <QPushButton>
#include <QWebFrame> #include <QWebEngineFrame>
#include <QSqlQuery> #include <QSqlQuery>
RSSWidget::RSSWidget(WebView* view, QWidget* parent) RSSWidget::RSSWidget(WebView* view, QWidget* parent)
@ -35,7 +37,7 @@ RSSWidget::RSSWidget(WebView* view, QWidget* parent)
{ {
ui->setupUi(this); ui->setupUi(this);
QWebFrame* frame = m_view->page()->mainFrame(); QWebEngineFrame* frame = m_view->page()->mainFrame();
QWebElementCollection links = frame->findAllElements("link[type=\"application/rss+xml\"]"); QWebElementCollection links = frame->findAllElements("link[type=\"application/rss+xml\"]");
// Make sure RSS feeds fit into a window, in case there is a lot of feeds from one page // Make sure RSS feeds fit into a window, in case there is a lot of feeds from one page
@ -133,3 +135,5 @@ RSSWidget::~RSSWidget()
{ {
delete ui; delete ui;
} }
#endif

View File

@ -18,6 +18,8 @@
#ifndef RSSWIDGET_H #ifndef RSSWIDGET_H
#define RSSWIDGET_H #define RSSWIDGET_H
#if QTWEBENGINE_DISABLED
#include <QMenu> #include <QMenu>
#include "qzcommon.h" #include "qzcommon.h"
@ -47,4 +49,6 @@ private:
WebView* m_view; WebView* m_view;
}; };
#endif
#endif // RSSWIDGET_H #endif // RSSWIDGET_H

View File

@ -50,7 +50,9 @@ void TabIcon::setWebTab(WebTab* tab)
connect(m_tab->webView(), SIGNAL(loadStarted()), this, SLOT(showLoadingAnimation())); connect(m_tab->webView(), SIGNAL(loadStarted()), this, SLOT(showLoadingAnimation()));
connect(m_tab->webView(), SIGNAL(loadFinished(bool)), this, SLOT(hideLoadingAnimation())); connect(m_tab->webView(), SIGNAL(loadFinished(bool)), this, SLOT(hideLoadingAnimation()));
#if QTWEBENGINE_DISABLED
connect(m_tab->webView(), SIGNAL(iconChanged()), this, SLOT(showIcon())); connect(m_tab->webView(), SIGNAL(iconChanged()), this, SLOT(showIcon()));
#endif
showIcon(); showIcon();
} }

View File

@ -37,8 +37,7 @@
#include <QMimeData> #include <QMimeData>
#include <QStackedWidget> #include <QStackedWidget>
#include <QMouseEvent> #include <QMouseEvent>
#include <QWebHistory> #include <QWebEngineHistory>
#include <QWebFrame>
#include <QClipboard> #include <QClipboard>
AddTabButton::AddTabButton(TabWidget* tabWidget, TabBar* tabBar) AddTabButton::AddTabButton(TabWidget* tabWidget, TabBar* tabBar)
@ -388,9 +387,10 @@ int TabWidget::addView(const LoadRequest &req, const QString &title, const Qz::N
m_window->locationBar()->setFocus(); m_window->locationBar()->setFocus();
} }
#if QTWEBENGINE_DISABLED
if (openFlags & Qz::NT_NotSelectedTab) { if (openFlags & Qz::NT_NotSelectedTab) {
WebTab* currentWebTab = weTab(); WebTab* currentWebTab = weTab();
// Workarounding invalid QWebPage::viewportSize() until QWebView is shown // Workarounding invalid QWebEnginePage::viewportSize() until QWebEngineView is shown
// Fixes invalid scrolling to anchor(#) links // Fixes invalid scrolling to anchor(#) links
if (currentWebTab && currentWebTab->webView()) { if (currentWebTab && currentWebTab->webView()) {
TabbedWebView* currentView = currentWebTab->webView(); TabbedWebView* currentView = currentWebTab->webView();
@ -398,6 +398,7 @@ int TabWidget::addView(const LoadRequest &req, const QString &title, const Qz::N
webTab->webView()->page()->setViewportSize(currentView->page()->viewportSize()); webTab->webView()->page()->setViewportSize(currentView->page()->viewportSize());
} }
} }
#endif
// Make sure user notice opening new background tabs // Make sure user notice opening new background tabs
if (!(openFlags & Qz::NT_SelectedTab)) { if (!(openFlags & Qz::NT_SelectedTab)) {

View File

@ -20,8 +20,8 @@
#include "qztools.h" #include "qztools.h"
#include "mainapplication.h" #include "mainapplication.h"
#include <QWebHistory> #include <QWebEngineHistory>
#include <QWebSettings> #include <QWebEngineSettings>
ClosedTabsManager::ClosedTabsManager() ClosedTabsManager::ClosedTabsManager()
{ {

View File

@ -20,7 +20,6 @@
#include "settings.h" #include "settings.h"
#include "webview.h" #include "webview.h"
#include <QWebFrame>
HTML5PermissionsManager::HTML5PermissionsManager(QObject* parent) HTML5PermissionsManager::HTML5PermissionsManager(QObject* parent)
: QObject(parent) : QObject(parent)
@ -28,8 +27,8 @@ HTML5PermissionsManager::HTML5PermissionsManager(QObject* parent)
loadSettings(); loadSettings();
} }
#if QTWEBKIT_FROM_2_2 #if QTWEBENGINE_DISABLED
void HTML5PermissionsManager::requestPermissions(WebPage* page, QWebFrame* frame, const QWebPage::Feature &feature) void HTML5PermissionsManager::requestPermissions(WebPage* page, QWebEngineFrame* frame, const QWebEnginePage::Feature &feature)
{ {
if (!frame || !page) { if (!frame || !page) {
return; return;
@ -39,14 +38,14 @@ void HTML5PermissionsManager::requestPermissions(WebPage* page, QWebFrame* frame
WebView* view = qobject_cast<WebView*>(page->view()); WebView* view = qobject_cast<WebView*>(page->view());
switch (feature) { switch (feature) {
case QWebPage::Notifications: case QWebEnginePage::Notifications:
if (m_notificationsGranted.contains(host)) { if (m_notificationsGranted.contains(host)) {
page->setFeaturePermission(frame, feature, QWebPage::PermissionGrantedByUser); page->setFeaturePermission(frame, feature, QWebEnginePage::PermissionGrantedByUser);
return; return;
} }
if (m_notificationsDenied.contains(host)) { if (m_notificationsDenied.contains(host)) {
page->setFeaturePermission(frame, feature, QWebPage::PermissionDeniedByUser); page->setFeaturePermission(frame, feature, QWebEnginePage::PermissionDeniedByUser);
return; return;
} }
@ -57,14 +56,14 @@ void HTML5PermissionsManager::requestPermissions(WebPage* page, QWebFrame* frame
break; break;
case QWebPage::Geolocation: case QWebEnginePage::Geolocation:
if (m_geolocationGranted.contains(host)) { if (m_geolocationGranted.contains(host)) {
page->setFeaturePermission(frame, feature, QWebPage::PermissionGrantedByUser); page->setFeaturePermission(frame, feature, QWebEnginePage::PermissionGrantedByUser);
return; return;
} }
if (m_geolocationDenied.contains(host)) { if (m_geolocationDenied.contains(host)) {
page->setFeaturePermission(frame, feature, QWebPage::PermissionDeniedByUser); page->setFeaturePermission(frame, feature, QWebEnginePage::PermissionDeniedByUser);
return; return;
} }
@ -81,16 +80,16 @@ void HTML5PermissionsManager::requestPermissions(WebPage* page, QWebFrame* frame
} }
} }
void HTML5PermissionsManager::rememberPermissions(const QString &host, const QWebPage::Feature &feature, void HTML5PermissionsManager::rememberPermissions(const QString &host, const QWebEnginePage::Feature &feature,
const QWebPage::PermissionPolicy &policy) const QWebEnginePage::PermissionPolicy &policy)
{ {
if (host.isEmpty()) { if (host.isEmpty()) {
return; return;
} }
switch (feature) { switch (feature) {
case QWebPage::Notifications: case QWebEnginePage::Notifications:
if (policy == QWebPage::PermissionGrantedByUser) { if (policy == QWebEnginePage::PermissionGrantedByUser) {
m_notificationsGranted.append(host); m_notificationsGranted.append(host);
} }
else { else {
@ -98,8 +97,8 @@ void HTML5PermissionsManager::rememberPermissions(const QString &host, const QWe
} }
break; break;
case QWebPage::Geolocation: case QWebEnginePage::Geolocation:
if (policy == QWebPage::PermissionGrantedByUser) { if (policy == QWebEnginePage::PermissionGrantedByUser) {
m_geolocationGranted.append(host); m_geolocationGranted.append(host);
} }
else { else {
@ -141,3 +140,4 @@ void HTML5PermissionsManager::saveSettings()
void HTML5PermissionsManager::showSettingsDialog() void HTML5PermissionsManager::showSettingsDialog()
{ {
} }

View File

@ -32,10 +32,10 @@ class QUPZILLA_EXPORT HTML5PermissionsManager : public QObject
public: public:
explicit HTML5PermissionsManager(QObject* parent); explicit HTML5PermissionsManager(QObject* parent);
#if QTWEBKIT_FROM_2_2 #if QTWEBENGINE_DISABLED
void requestPermissions(WebPage* page, QWebFrame* frame, const QWebPage::Feature &feature); void requestPermissions(WebPage* page, QWebEngineFrame* frame, const QWebEnginePage::Feature &feature);
void rememberPermissions(const QString &host, const QWebPage::Feature &feature, void rememberPermissions(const QString &host, const QWebEnginePage::Feature &feature,
const QWebPage::PermissionPolicy &policy); const QWebEnginePage::PermissionPolicy &policy);
#endif #endif
void loadSettings(); void loadSettings();

View File

@ -21,10 +21,11 @@
#include "mainapplication.h" #include "mainapplication.h"
#include "iconprovider.h" #include "iconprovider.h"
#include <QWebFrame> #if QTWEBENGINE_DISABLED
#include <QWebEngineFrame>
#ifdef USE_QTWEBKIT_2_2 #ifdef USE_QTWEBKIT_2_2
HTML5PermissionsNotification::HTML5PermissionsNotification(const QString &host, QWebFrame* frame, const QWebPage::Feature &feature) HTML5PermissionsNotification::HTML5PermissionsNotification(const QString &host, QWebEngineFrame* frame, const QWebEnginePage::Feature &feature)
: AnimatedWidget(AnimatedWidget::Down, 300, 0) : AnimatedWidget(AnimatedWidget::Down, 300, 0)
, ui(new Ui::HTML5PermissionsNotification) , ui(new Ui::HTML5PermissionsNotification)
, m_host(host) , m_host(host)
@ -39,11 +40,11 @@ HTML5PermissionsNotification::HTML5PermissionsNotification(const QString &host,
QString message; QString message;
QString site = m_host.isEmpty() ? tr("this site") : QString("<b>%1</b>").arg(m_host); QString site = m_host.isEmpty() ? tr("this site") : QString("<b>%1</b>").arg(m_host);
if (feature == QWebPage::Notifications) { if (feature == QWebEnginePage::Notifications) {
ui->iconLabel->setPixmap(QPixmap(":icons/other/notification.png")); ui->iconLabel->setPixmap(QPixmap(":icons/other/notification.png"));
message = tr("Allow %1 to show desktop notifications?").arg(site); message = tr("Allow %1 to show desktop notifications?").arg(site);
} }
else if (feature == QWebPage::Geolocation) { else if (feature == QWebEnginePage::Geolocation) {
ui->iconLabel->setPixmap(QPixmap(":icons/other/geolocation.png")); ui->iconLabel->setPixmap(QPixmap(":icons/other/geolocation.png"));
message = tr("Allow %1 to locate your position?").arg(site); message = tr("Allow %1 to locate your position?").arg(site);
} }
@ -63,11 +64,11 @@ void HTML5PermissionsNotification::grantPermissions()
return; return;
} }
QWebPage* page = m_frame->page(); QWebEnginePage* page = m_frame->page();
page->setFeaturePermission(m_frame, m_feature, QWebPage::PermissionGrantedByUser); page->setFeaturePermission(m_frame, m_feature, QWebEnginePage::PermissionGrantedByUser);
if (ui->remember->isChecked()) { if (ui->remember->isChecked()) {
mApp->html5PermissionsManager()->rememberPermissions(m_host, m_feature, QWebPage::PermissionGrantedByUser); mApp->html5PermissionsManager()->rememberPermissions(m_host, m_feature, QWebEnginePage::PermissionGrantedByUser);
} }
hide(); hide();
@ -79,11 +80,11 @@ void HTML5PermissionsNotification::denyPermissions()
return; return;
} }
QWebPage* page = m_frame->page(); QWebEnginePage* page = m_frame->page();
page->setFeaturePermission(m_frame, m_feature, QWebPage::PermissionDeniedByUser); page->setFeaturePermission(m_frame, m_feature, QWebEnginePage::PermissionDeniedByUser);
if (ui->remember->isChecked()) { if (ui->remember->isChecked()) {
mApp->html5PermissionsManager()->rememberPermissions(m_host, m_feature, QWebPage::PermissionDeniedByUser); mApp->html5PermissionsManager()->rememberPermissions(m_host, m_feature, QWebEnginePage::PermissionDeniedByUser);
} }
hide(); hide();
@ -94,3 +95,5 @@ HTML5PermissionsNotification::~HTML5PermissionsNotification()
delete ui; delete ui;
} }
#endif // USE_QTWEBKIT_2_2 #endif // USE_QTWEBKIT_2_2
#endif

View File

@ -34,7 +34,7 @@ class HTML5PermissionsNotification : public AnimatedWidget
#ifdef USE_QTWEBKIT_2_2 #ifdef USE_QTWEBKIT_2_2
public: public:
explicit HTML5PermissionsNotification(const QString &host, QWebFrame* frame, const QWebPage::Feature &feature); explicit HTML5PermissionsNotification(const QString &host, QWebEngineFrame* frame, const QWebEnginePage::Feature &feature);
~HTML5PermissionsNotification(); ~HTML5PermissionsNotification();
private slots: private slots:
@ -45,8 +45,8 @@ private:
Ui::HTML5PermissionsNotification* ui; Ui::HTML5PermissionsNotification* ui;
QString m_host; QString m_host;
QWebFrame* m_frame; QWebEngineFrame* m_frame;
QWebPage::Feature m_feature; QWebEnginePage::Feature m_feature;
#endif #endif
}; };

View File

@ -19,8 +19,10 @@
#include "mainapplication.h" #include "mainapplication.h"
#include "networkmanagerproxy.h" #include "networkmanagerproxy.h"
#include <QWebPage> #if QTWEBENGINE_DISABLED
#include <QWebFrame>
#include <QWebEnginePage>
#include <QWebEngineFrame>
#include <QPainter> #include <QPainter>
CleanPluginFactory::CleanPluginFactory(QObject* parent) CleanPluginFactory::CleanPluginFactory(QObject* parent)
@ -45,7 +47,7 @@ QObject* CleanPluginFactory::create(const QString &mimeType, const QUrl &url, co
PageThumbnailer::PageThumbnailer(QObject* parent) PageThumbnailer::PageThumbnailer(QObject* parent)
: QObject(parent) : QObject(parent)
, m_page(new QWebPage(this)) , m_page(new QWebEnginePage(this))
, m_size(QSize(450, 253)) , m_size(QSize(450, 253))
, m_loadTitle(false) , m_loadTitle(false)
{ {
@ -129,7 +131,7 @@ void PageThumbnailer::createThumbnail(bool status)
QPainter painter(&pixmap); QPainter painter(&pixmap);
painter.scale(scalingFactor, scalingFactor); painter.scale(scalingFactor, scalingFactor);
m_page->mainFrame()->render(&painter, QWebFrame::ContentsLayer); m_page->mainFrame()->render(&painter, QWebEngineFrame::ContentsLayer);
painter.end(); painter.end();
emit thumbnailCreated(pixmap.scaled(m_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); emit thumbnailCreated(pixmap.scaled(m_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
@ -139,3 +141,5 @@ PageThumbnailer::~PageThumbnailer()
{ {
m_page->deleteLater(); m_page->deleteLater();
} }
#endif

View File

@ -18,6 +18,8 @@
#ifndef PAGETHUMBNAILER_H #ifndef PAGETHUMBNAILER_H
#define PAGETHUMBNAILER_H #define PAGETHUMBNAILER_H
#if QTWEBENGINE_DISABLED
#include <QObject> #include <QObject>
#include <QSize> #include <QSize>
#include <QUrl> #include <QUrl>
@ -25,7 +27,7 @@
#include "qzcommon.h" #include "qzcommon.h"
class QWebPage; class QWebEnginePage;
class QPixmap; class QPixmap;
class QUPZILLA_EXPORT CleanPluginFactory : public QWebPluginFactory class QUPZILLA_EXPORT CleanPluginFactory : public QWebPluginFactory
@ -67,7 +69,7 @@ private slots:
void createThumbnail(bool status); void createThumbnail(bool status);
private: private:
QWebPage* m_page; QWebEnginePage* m_page;
QSize m_size; QSize m_size;
QUrl m_url; QUrl m_url;
@ -75,4 +77,6 @@ private:
bool m_loadTitle; bool m_loadTitle;
}; };
#endif
#endif // PAGETHUMBNAILER_H #endif // PAGETHUMBNAILER_H

View File

@ -39,7 +39,6 @@
#include <QSysInfo> #include <QSysInfo>
#include <QProcess> #include <QProcess>
#include <QMessageBox> #include <QMessageBox>
#include <QWebFrame>
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#include <QUrlQuery> #include <QUrlQuery>
@ -216,9 +215,13 @@ QString QzTools::escapeSqlString(QString urlString)
return urlString; return urlString;
} }
QUrl QzTools::frameUrl(QWebFrame* frame) QUrl QzTools::frameUrl(QWebEngineFrame* frame)
{ {
#if QTWEBENGINE_DISABLED
return frame->url().isEmpty() ? frame->baseUrl() : frame->url(); return frame->url().isEmpty() ? frame->baseUrl() : frame->url();
#else
return QUrl();
#endif
} }
QString QzTools::ensureUniqueFilename(const QString &name, const QString &appendFormat) QString QzTools::ensureUniqueFilename(const QString &name, const QString &appendFormat)

View File

@ -24,7 +24,7 @@
class QSslCertificate; class QSslCertificate;
class QFontMetrics; class QFontMetrics;
class QWebFrame; class QWebEngineFrame;
class QPixmap; class QPixmap;
class QIcon; class QIcon;
class QWidget; class QWidget;
@ -49,7 +49,7 @@ public:
static QString urlEncodeQueryString(const QUrl &url); static QString urlEncodeQueryString(const QUrl &url);
static QString fromPunycode(const QString &str); static QString fromPunycode(const QString &str);
static QString escapeSqlString(QString urlString); static QString escapeSqlString(QString urlString);
static QUrl frameUrl(QWebFrame* frame); static QUrl frameUrl(QWebEngineFrame *frame);
static QString ensureUniqueFilename(const QString &name, const QString &appendFormat = QString("(%1)")); static QString ensureUniqueFilename(const QString &name, const QString &appendFormat = QString("(%1)"));
static QString getFileNameFromUrl(const QUrl &url); static QString getFileNameFromUrl(const QUrl &url);

View File

@ -40,7 +40,11 @@ int ExternalJsObject::IsSearchProviderInstalled(const QString &engineURL)
QObject* ExternalJsObject::speedDial() const QObject* ExternalJsObject::speedDial() const
{ {
#if QTWEBENGINE_DISABLED
return m_onSpeedDial ? mApp->plugins()->speedDial() : 0; return m_onSpeedDial ? mApp->plugins()->speedDial() : 0;
#else
return 0;
#endif
} }
void ExternalJsObject::setOnSpeedDial(bool on) void ExternalJsObject::setOnSpeedDial(bool on)

View File

@ -17,7 +17,7 @@
* ============================================================ */ * ============================================================ */
#include "loadrequest.h" #include "loadrequest.h"
#include <QWebView> #include <QWebEngineView>
LoadRequest::LoadRequest() LoadRequest::LoadRequest()
: m_operation(GetOperation) : m_operation(GetOperation)

View File

@ -19,6 +19,8 @@
#include "toolbutton.h" #include "toolbutton.h"
#include "iconprovider.h" #include "iconprovider.h"
#if QTWEBENGINE_DISABLED
#include <QTimer> #include <QTimer>
WebInspector::WebInspector(QWidget* parent) WebInspector::WebInspector(QWidget* parent)
@ -68,3 +70,5 @@ void WebInspector::resizeEvent(QResizeEvent* event)
QTimer::singleShot(0, this, SLOT(updateCloseButton())); QTimer::singleShot(0, this, SLOT(updateCloseButton()));
} }
#endif

View File

@ -18,6 +18,7 @@
#ifndef WEBINSPECTORDOCKWIDGET_H #ifndef WEBINSPECTORDOCKWIDGET_H
#define WEBINSPECTORDOCKWIDGET_H #define WEBINSPECTORDOCKWIDGET_H
#if QTWEBENGINE_DISABLED
#include <QWebInspector> #include <QWebInspector>
#include "qzcommon.h" #include "qzcommon.h"
@ -42,5 +43,6 @@ private:
ToolButton* m_closeButton; ToolButton* m_closeButton;
bool m_blockHideEvent; bool m_blockHideEvent;
}; };
#endif
#endif // WEBINSPECTORDOCKWIDGET_H #endif // WEBINSPECTORDOCKWIDGET_H

View File

@ -50,16 +50,19 @@
#include <QPushButton> #include <QPushButton>
#endif #endif
#include <QAuthenticator>
#include <QDir> #include <QDir>
#include <QFormLayout>
#include <QLabel>
#include <QLineEdit>
#include <QMouseEvent> #include <QMouseEvent>
#include <QWebHistory> #include <QWebEngineHistory>
#include <QTimer> #include <QTimer>
#include <QNetworkReply> #include <QNetworkReply>
#include <QDesktopServices> #include <QDesktopServices>
#include <QMessageBox> #include <QMessageBox>
#include <QFileDialog> #include <QFileDialog>
#include <QWebFrame> #include <QCheckBox>
#include <QWebSecurityOrigin>
QString WebPage::s_lastUploadLocation = QDir::homePath(); QString WebPage::s_lastUploadLocation = QDir::homePath();
QUrl WebPage::s_lastUnsupportedUrl; QUrl WebPage::s_lastUnsupportedUrl;
@ -67,7 +70,7 @@ QTime WebPage::s_lastUnsupportedUrlTime;
QList<WebPage*> WebPage::s_livingPages; QList<WebPage*> WebPage::s_livingPages;
WebPage::WebPage(QObject* parent) WebPage::WebPage(QObject* parent)
: QWebPage(parent) : QWebEnginePage(parent)
, m_view(0) , m_view(0)
, m_fileWatcher(0) , m_fileWatcher(0)
, m_runningLoop(0) , m_runningLoop(0)
@ -76,7 +79,8 @@ WebPage::WebPage(QObject* parent)
, m_secureStatus(false) , m_secureStatus(false)
, m_adjustingScheduled(false) , m_adjustingScheduled(false)
{ {
m_javaScriptEnabled = QWebSettings::globalSettings()->testAttribute(QWebSettings::JavascriptEnabled); #if QTWEBENGINE_DISABLED
m_javaScriptEnabled = QWebEngineSettings::globalSettings()->testAttribute(QWebEngineSettings::JavascriptEnabled);
m_networkProxy = new NetworkManagerProxy(this); m_networkProxy = new NetworkManagerProxy(this);
m_networkProxy->setPrimaryNetworkAccessManager(mApp->networkManager()); m_networkProxy->setPrimaryNetworkAccessManager(mApp->networkManager());
@ -113,6 +117,8 @@ WebPage::WebPage(QObject* parent)
#elif QTWEBKIT_FROM_2_2 #elif QTWEBKIT_FROM_2_2
connect(this, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin*,quint64)), connect(this, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin*,quint64)),
this, SLOT(appCacheQuotaExceeded(QWebSecurityOrigin*,quint64))); this, SLOT(appCacheQuotaExceeded(QWebSecurityOrigin*,quint64)));
#endif
#endif #endif
s_livingPages.append(this); s_livingPages.append(this);
@ -129,14 +135,11 @@ WebPage::~WebPage()
s_livingPages.removeOne(this); s_livingPages.removeOne(this);
#if QTWEBENGINE_DISABLED
// Page's network manager will be deleted and then set to null // Page's network manager will be deleted and then set to null
// Fixes issue with network manager being used after deleted in destructor // Fixes issue with network manager being used after deleted in destructor
setNetworkAccessManager(0); setNetworkAccessManager(0);
} #endif
QUrl WebPage::url() const
{
return mainFrame()->url();
} }
void WebPage::setWebView(TabbedWebView* view) void WebPage::setWebView(TabbedWebView* view)
@ -177,7 +180,11 @@ void WebPage::scheduleAdjustPage()
bool WebPage::loadingError() const bool WebPage::loadingError() const
{ {
#if QTWEBENGINE_DISABLED
return !mainFrame()->findFirstElement("span[id=\"qupzilla-error-page\"]").isNull(); return !mainFrame()->findFirstElement("span[id=\"qupzilla-error-page\"]").isNull();
#else
return false;
#endif
} }
void WebPage::addRejectedCerts(const QList<QSslCertificate> &certs) void WebPage::addRejectedCerts(const QList<QSslCertificate> &certs)
@ -206,11 +213,13 @@ bool WebPage::containsRejectedCerts(const QList<QSslCertificate> &certs)
return matches == certs.count(); return matches == certs.count();
} }
#if QTWEBENGINE_DISABLED
QWebElement WebPage::activeElement() const QWebElement WebPage::activeElement() const
{ {
QRect activeRect = inputMethodQuery(Qt::ImMicroFocus).toRect(); QRect activeRect = inputMethodQuery(Qt::ImMicroFocus).toRect();
return mainFrame()->hitTestContent(activeRect.center()).element(); return mainFrame()->hitTestContent(activeRect.center()).element();
} }
#endif
bool WebPage::isRunningLoop() bool WebPage::isRunningLoop()
{ {
@ -224,10 +233,12 @@ bool WebPage::isLoading() const
void WebPage::urlChanged(const QUrl &url) void WebPage::urlChanged(const QUrl &url)
{ {
#if QTWEBENGINE_DISABLED
// Make sure JavaScript is enabled for qupzilla pages regardless of user settings // Make sure JavaScript is enabled for qupzilla pages regardless of user settings
if (url.scheme() == QLatin1String("qupzilla")) { if (url.scheme() == QLatin1String("qupzilla")) {
settings()->setAttribute(QWebSettings::JavascriptEnabled, true); settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
} }
#endif
if (isLoading()) { if (isLoading()) {
m_adBlockedEntries.clear(); m_adBlockedEntries.clear();
@ -253,8 +264,8 @@ void WebPage::finished()
if (m_adjustingScheduled) { if (m_adjustingScheduled) {
m_adjustingScheduled = false; m_adjustingScheduled = false;
mainFrame()->setZoomFactor(mainFrame()->zoomFactor() + 1); setZoomFactor(zoomFactor() + 1);
mainFrame()->setZoomFactor(mainFrame()->zoomFactor() - 1); setZoomFactor(zoomFactor() - 1);
} }
// File scheme watcher // File scheme watcher
@ -284,11 +295,12 @@ void WebPage::finished()
void WebPage::watchedFileChanged(const QString &file) void WebPage::watchedFileChanged(const QString &file)
{ {
if (url().toLocalFile() == file) { if (url().toLocalFile() == file) {
triggerAction(QWebPage::Reload); triggerAction(QWebEnginePage::Reload);
} }
} }
void WebPage::printFrame(QWebFrame* frame) #if QTWEBENGINE_DISABLED
void WebPage::printFrame(QWebEngineFrame* frame)
{ {
WebView* webView = qobject_cast<WebView*>(view()); WebView* webView = qobject_cast<WebView*>(view());
if (!webView) { if (!webView) {
@ -297,22 +309,25 @@ void WebPage::printFrame(QWebFrame* frame)
webView->printPage(frame); webView->printPage(frame);
} }
#endif
void WebPage::addJavaScriptObject() void WebPage::addJavaScriptObject()
{ {
#if QTWEBENGINE_DISABLED
// Make sure all other sites have JavaScript set by user preferences // Make sure all other sites have JavaScript set by user preferences
// (JavaScript is enabled in WebPage::urlChanged) // (JavaScript is enabled in WebPage::urlChanged)
if (url().scheme() != QLatin1String("qupzilla")) { if (url().scheme() != QLatin1String("qupzilla")) {
settings()->setAttribute(QWebSettings::JavascriptEnabled, m_javaScriptEnabled); settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, m_javaScriptEnabled);
} }
ExternalJsObject* jsObject = new ExternalJsObject(this); ExternalJsObject* jsObject = new ExternalJsObject(this);
mainFrame()->addToJavaScriptWindowObject("external", jsObject); addToJavaScriptWindowObject("external", jsObject);
if (url().toString() == QLatin1String("qupzilla:speeddial")) { if (url().toString() == QLatin1String("qupzilla:speeddial")) {
jsObject->setOnSpeedDial(true); jsObject->setOnSpeedDial(true);
mApp->plugins()->speedDial()->addWebFrame(mainFrame()); mApp->plugins()->speedDial()->addWebFrame(mainFrame());
} }
#endif
} }
void WebPage::handleUnsupportedContent(QNetworkReply* reply) void WebPage::handleUnsupportedContent(QNetworkReply* reply)
@ -327,6 +342,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply)
case QNetworkReply::NoError: case QNetworkReply::NoError:
if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) { if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) {
QString requestUrl = reply->request().url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery); QString requestUrl = reply->request().url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery);
#if QTWEBENGINE_DISABLED
if (requestUrl.endsWith(QLatin1String(".swf"))) { if (requestUrl.endsWith(QLatin1String(".swf"))) {
const QWebElement docElement = mainFrame()->documentElement(); const QWebElement docElement = mainFrame()->documentElement();
const QWebElement object = docElement.findFirst(QString("object[src=\"%1\"]").arg(requestUrl)); const QWebElement object = docElement.findFirst(QString("object[src=\"%1\"]").arg(requestUrl));
@ -340,6 +356,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply)
} }
DownloadManager* dManager = mApp->downloadManager(); DownloadManager* dManager = mApp->downloadManager();
dManager->handleUnsupportedContent(reply, this); dManager->handleUnsupportedContent(reply, this);
#endif
return; return;
} }
// Falling unsupported content with invalid ContentTypeHeader to be handled as UnknownProtocol // Falling unsupported content with invalid ContentTypeHeader to be handled as UnknownProtocol
@ -352,7 +369,9 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply)
if (url.scheme() == QLatin1String("ftp")) { if (url.scheme() == QLatin1String("ftp")) {
DownloadManager* dManager = mApp->downloadManager(); DownloadManager* dManager = mApp->downloadManager();
#if QTWEBENGINE_DISABLED
dManager->handleUnsupportedContent(reply, this); dManager->handleUnsupportedContent(reply, this);
#endif
return; return;
} }
@ -457,6 +476,7 @@ void WebPage::windowCloseRequested()
webView->closeView(); webView->closeView();
} }
#if QTWEBENGINE_DISABLED
void WebPage::frameCreated(QWebFrame* frame) void WebPage::frameCreated(QWebFrame* frame)
{ {
connect(frame, SIGNAL(initialLayoutCompleted()), this, SLOT(frameInitialLayoutCompleted())); connect(frame, SIGNAL(initialLayoutCompleted()), this, SLOT(frameInitialLayoutCompleted()));
@ -471,8 +491,144 @@ void WebPage::frameInitialLayoutCompleted()
// Autofill // Autofill
m_passwordEntries = mApp->autoFill()->completeFrame(frame); m_passwordEntries = mApp->autoFill()->completeFrame(frame);
} }
#endif
void WebPage::dbQuotaExceeded(QWebFrame* frame) void WebPage::authentication(const QUrl &requestUrl, QAuthenticator* auth)
{
QDialog* dialog = new QDialog();
dialog->setWindowTitle(tr("Authorisation required"));
QFormLayout* formLa = new QFormLayout(dialog);
QLabel* label = new QLabel(dialog);
QLabel* userLab = new QLabel(dialog);
QLabel* passLab = new QLabel(dialog);
userLab->setText(tr("Username: "));
passLab->setText(tr("Password: "));
QLineEdit* user = new QLineEdit(dialog);
QLineEdit* pass = new QLineEdit(dialog);
pass->setEchoMode(QLineEdit::Password);
QCheckBox* save = new QCheckBox(dialog);
save->setText(tr("Save username and password on this site"));
QDialogButtonBox* box = new QDialogButtonBox(dialog);
box->addButton(QDialogButtonBox::Ok);
box->addButton(QDialogButtonBox::Cancel);
connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));
label->setText(tr("A username and password are being requested by %1. "
"The site says: \"%2\"").arg(requestUrl.host(), QzTools::escape(auth->realm())));
formLa->addRow(label);
formLa->addRow(userLab, user);
formLa->addRow(passLab, pass);
formLa->addRow(save);
formLa->addWidget(box);
AutoFill* fill = mApp->autoFill();
QString storedUser;
QString storedPassword;
bool shouldUpdateEntry = false;
if (fill->isStored(requestUrl)) {
const QVector<PasswordEntry> &data = fill->getFormData(requestUrl);
if (!data.isEmpty()) {
save->setChecked(true);
shouldUpdateEntry = true;
storedUser = data.first().username;
storedPassword = data.first().password;
user->setText(storedUser);
pass->setText(storedPassword);
}
}
// Try to set the originating WebTab as a current tab
TabbedWebView* tabView = qobject_cast<TabbedWebView*>(view());
if (tabView) {
tabView->setAsCurrentTab();
}
// Do not save when private browsing is enabled
if (mApp->isPrivate()) {
save->setVisible(false);
}
if (dialog->exec() != QDialog::Accepted) {
return;
}
auth->setUser(user->text());
auth->setPassword(pass->text());
if (save->isChecked()) {
if (shouldUpdateEntry) {
if (storedUser != user->text() || storedPassword != pass->text()) {
fill->updateEntry(requestUrl, user->text(), pass->text());
}
}
else {
fill->addEntry(requestUrl, user->text(), pass->text());
}
}
}
void WebPage::proxyAuthentication(const QUrl &requestUrl, QAuthenticator* auth, const QString &proxyHost)
{
Q_UNUSED(requestUrl)
QVector<PasswordEntry> passwords = mApp->autoFill()->getFormData(QUrl(proxyHost));
if (!passwords.isEmpty()) {
auth->setUser(passwords.at(0).username);
auth->setPassword(passwords.at(0).password);
return;
}
QDialog* dialog = new QDialog();
dialog->setWindowTitle(tr("Proxy authorisation required"));
QFormLayout* formLa = new QFormLayout(dialog);
QLabel* label = new QLabel(dialog);
QLabel* userLab = new QLabel(dialog);
QLabel* passLab = new QLabel(dialog);
userLab->setText(tr("Username: "));
passLab->setText(tr("Password: "));
QLineEdit* user = new QLineEdit(dialog);
QLineEdit* pass = new QLineEdit(dialog);
pass->setEchoMode(QLineEdit::Password);
QCheckBox* save = new QCheckBox(dialog);
save->setText(tr("Remember username and password for this proxy."));
QDialogButtonBox* box = new QDialogButtonBox(dialog);
box->addButton(QDialogButtonBox::Ok);
box->addButton(QDialogButtonBox::Cancel);
connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));
label->setText(tr("A username and password are being requested by proxy %1. ").arg(proxyHost));
formLa->addRow(label);
formLa->addRow(userLab, user);
formLa->addRow(passLab, pass);
formLa->addRow(save);
formLa->addWidget(box);
if (dialog->exec() != QDialog::Accepted) {
return;
}
if (save->isChecked()) {
mApp->autoFill()->addEntry(QUrl(proxyHost), user->text(), pass->text());
}
auth->setUser(user->text());
auth->setPassword(pass->text());
}
#if QTWEBENGINE_DISABLED
void WebPage::dbQuotaExceeded(QWebEngineFrame* frame)
{ {
if (!frame) { if (!frame) {
return; return;
@ -483,6 +639,7 @@ void WebPage::dbQuotaExceeded(QWebFrame* frame)
frame->securityOrigin().setDatabaseQuota(oldQuota * 2); frame->securityOrigin().setDatabaseQuota(oldQuota * 2);
} }
#endif
void WebPage::doWebSearch(const QString &text) void WebPage::doWebSearch(const QString &text)
{ {
@ -504,7 +661,7 @@ void WebPage::appCacheQuotaExceeded(QWebSecurityOrigin* origin, quint64 original
origin->setApplicationCacheQuota(originalQuota * 2); origin->setApplicationCacheQuota(originalQuota * 2);
} }
void WebPage::featurePermissionRequested(QWebFrame* frame, const QWebPage::Feature &feature) void WebPage::featurePermissionRequested(QWebEngineFrame* frame, const QWebEnginePage::Feature &feature)
{ {
mApp->html5PermissionsManager()->requestPermissions(this, frame, feature); mApp->html5PermissionsManager()->requestPermissions(this, frame, feature);
} }
@ -513,7 +670,7 @@ void WebPage::featurePermissionRequested(QWebFrame* frame, const QWebPage::Featu
bool WebPage::event(QEvent* event) bool WebPage::event(QEvent* event)
{ {
if (event->type() == QEvent::Leave) { if (event->type() == QEvent::Leave) {
// QWebPagePrivate::leaveEvent(): // QWebEnginePagePrivate::leaveEvent():
// Fake a mouse move event just outside of the widget, since all // Fake a mouse move event just outside of the widget, since all
// the interesting mouse-out behavior like invalidating scrollbars // the interesting mouse-out behavior like invalidating scrollbars
// is handled by the WebKit event handler's mouseMoved function. // is handled by the WebKit event handler's mouseMoved function.
@ -548,10 +705,10 @@ bool WebPage::event(QEvent* event)
} }
QMouseEvent fakeEvent(QEvent::MouseMove, mousePos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); QMouseEvent fakeEvent(QEvent::MouseMove, mousePos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
return QWebPage::event(&fakeEvent); return QWebEnginePage::event(&fakeEvent);
} }
return QWebPage::event(event); return QWebEnginePage::event(event);
} }
void WebPage::setSSLCertificate(const QSslCertificate &cert) void WebPage::setSSLCertificate(const QSslCertificate &cert)
@ -569,12 +726,13 @@ QSslCertificate WebPage::sslCertificate()
return QSslCertificate(); return QSslCertificate();
} }
bool WebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type) #if QTWEBENGINE_DISABLED
bool WebPage::acceptNavigationRequest(QWebEngineFrame* frame, const QNetworkRequest &request, NavigationType type)
{ {
m_lastRequestType = type; m_lastRequestType = type;
m_lastRequestUrl = request.url(); m_lastRequestUrl = request.url();
if (type == QWebPage::NavigationTypeFormResubmitted) { if (type == QWebEnginePage::NavigationTypeFormResubmitted) {
// Don't show this dialog if app is still starting // Don't show this dialog if app is still starting
if (!view() || !view()->isVisible()) { if (!view() || !view()->isVisible()) {
return false; return false;
@ -588,9 +746,10 @@ bool WebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &r
} }
} }
bool accept = QWebPage::acceptNavigationRequest(frame, request, type); bool accept = QWebEnginePage::acceptNavigationRequest(frame, request, type);
return accept; return accept;
} }
#endif
void WebPage::populateNetworkRequest(QNetworkRequest &request) void WebPage::populateNetworkRequest(QNetworkRequest &request)
{ {
@ -599,15 +758,17 @@ void WebPage::populateNetworkRequest(QNetworkRequest &request)
QVariant variant = QVariant::fromValue((void*) pagePointer); QVariant variant = QVariant::fromValue((void*) pagePointer);
request.setAttribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100), variant); request.setAttribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100), variant);
#if QTWEBENGINE_DISABLED
if (m_lastRequestUrl == request.url()) { if (m_lastRequestUrl == request.url()) {
request.setAttribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 101), m_lastRequestType); request.setAttribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 101), m_lastRequestType);
if (m_lastRequestType == NavigationTypeLinkClicked) { if (m_lastRequestType == NavigationTypeLinkClicked) {
request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1")); request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1"));
} }
} }
#endif
} }
QWebPage* WebPage::createWindow(QWebPage::WebWindowType type) QWebEnginePage* WebPage::createWindow(QWebEnginePage::WebWindowType type)
{ {
if (m_view) { if (m_view) {
return new PopupWebPage(type, m_view->browserWindow()); return new PopupWebPage(type, m_view->browserWindow());
@ -631,7 +792,7 @@ QObject* WebPage::createPlugin(const QString &classid, const QUrl &url,
return new RecoveryWidget(m_view, m_view->browserWindow()); return new RecoveryWidget(m_view, m_view->browserWindow());
} }
else { else {
mainFrame()->load(QUrl("qupzilla:start")); load(QUrl("qupzilla:start"));
} }
return 0; return 0;
@ -665,6 +826,7 @@ QVector<PasswordEntry> WebPage::autoFillData() const
void WebPage::cleanBlockedObjects() void WebPage::cleanBlockedObjects()
{ {
#if QTWEBENGINE_DISABLED
AdBlockManager* manager = AdBlockManager::instance(); AdBlockManager* manager = AdBlockManager::instance();
if (!manager->isEnabled()) { if (!manager->isEnabled()) {
return; return;
@ -718,14 +880,16 @@ void WebPage::cleanBlockedObjects()
if (view() && !view()->isVisible() && !url().fragment().isEmpty()) { if (view() && !view()->isVisible() && !url().fragment().isEmpty()) {
mainFrame()->scrollToAnchor(url().fragment()); mainFrame()->scrollToAnchor(url().fragment());
} }
#endif
} }
QString WebPage::userAgentForUrl(const QUrl &url) const QString WebPage::userAgentForUrl(const QUrl &url) const
{ {
QString userAgent = mApp->userAgentManager()->userAgentForUrl(url); QString userAgent = mApp->userAgentManager()->userAgentForUrl(url);
#if QTWEBENGINE_DISABLED
if (userAgent.isEmpty()) { if (userAgent.isEmpty()) {
userAgent = QWebPage::userAgentForUrl(url); userAgent = QWebEnginePage::userAgentForUrl(url);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
#ifdef __i386__ || __x86_64__ #ifdef __i386__ || __x86_64__
userAgent.replace(QLatin1String("PPC Mac OS X"), QLatin1String("Intel Mac OS X")); userAgent.replace(QLatin1String("PPC Mac OS X"), QLatin1String("Intel Mac OS X"));
@ -733,9 +897,11 @@ QString WebPage::userAgentForUrl(const QUrl &url) const
#endif #endif
} }
#endif
return userAgent; return userAgent;
} }
#if QTWEBENGINE_DISABLED
bool WebPage::supportsExtension(Extension extension) const bool WebPage::supportsExtension(Extension extension) const
{ {
Q_UNUSED(extension) Q_UNUSED(extension)
@ -746,11 +912,11 @@ bool WebPage::supportsExtension(Extension extension) const
bool WebPage::extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output) bool WebPage::extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output)
{ {
if (extension == ChooseMultipleFilesExtension) { if (extension == ChooseMultipleFilesExtension) {
const QWebPage::ChooseMultipleFilesExtensionOption* exOption = static_cast<const QWebPage::ChooseMultipleFilesExtensionOption*>(option); const QWebEnginePage::ChooseMultipleFilesExtensionOption* exOption = static_cast<const QWebEnginePage::ChooseMultipleFilesExtensionOption*>(option);
QWebPage::ChooseMultipleFilesExtensionReturn* exReturn = static_cast<QWebPage::ChooseMultipleFilesExtensionReturn*>(output); QWebEnginePage::ChooseMultipleFilesExtensionReturn* exReturn = static_cast<QWebEnginePage::ChooseMultipleFilesExtensionReturn*>(output);
if (!exOption || !exReturn) { if (!exOption || !exReturn) {
return QWebPage::extension(extension, option, output); return QWebEnginePage::extension(extension, option, output);
} }
QString suggestedFileName; QString suggestedFileName;
@ -762,21 +928,21 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
return true; return true;
} }
const ErrorPageExtensionOption* exOption = static_cast<const QWebPage::ErrorPageExtensionOption*>(option); const ErrorPageExtensionOption* exOption = static_cast<const QWebEnginePage::ErrorPageExtensionOption*>(option);
ErrorPageExtensionReturn* exReturn = static_cast<QWebPage::ErrorPageExtensionReturn*>(output); ErrorPageExtensionReturn* exReturn = static_cast<QWebEnginePage::ErrorPageExtensionReturn*>(output);
if (!exOption || !exReturn) { if (!exOption || !exReturn) {
return QWebPage::extension(extension, option, output); return QWebEnginePage::extension(extension, option, output);
} }
WebPage* erPage = qobject_cast<WebPage*>(exOption->frame->page()); WebPage* erPage = qobject_cast<WebPage*>(exOption->frame->page());
if (!erPage) { if (!erPage) {
return QWebPage::extension(extension, option, output); return QWebEnginePage::extension(extension, option, output);
} }
QString errorString; QString errorString;
if (exOption->domain == QWebPage::QtNetwork) { if (exOption->domain == QWebEnginePage::QtNetwork) {
switch (exOption->error) { switch (exOption->error) {
case QNetworkReply::ConnectionRefusedError: case QNetworkReply::ConnectionRefusedError:
errorString = tr("Server refused the connection"); errorString = tr("Server refused the connection");
@ -881,7 +1047,7 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
return false; return false;
} }
} }
else if (exOption->domain == QWebPage::Http) { else if (exOption->domain == QWebEnginePage::Http) {
// 200 status code = OK // 200 status code = OK
// It shouldn't be reported as an error, but sometimes it is ... // It shouldn't be reported as an error, but sometimes it is ...
if (exOption->error == 200) { if (exOption->error == 200) {
@ -889,7 +1055,7 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
} }
errorString = tr("Error code %1").arg(exOption->error); errorString = tr("Error code %1").arg(exOption->error);
} }
else if (exOption->domain == QWebPage::WebKit) { else if (exOption->domain == QWebEnginePage::WebKit) {
return false; // Downloads return false; // Downloads
} }
@ -918,11 +1084,12 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
exReturn->content = QString(errString + "<span id=\"qupzilla-error-page\"></span>").toUtf8(); exReturn->content = QString(errString + "<span id=\"qupzilla-error-page\"></span>").toUtf8();
return true; return true;
} }
#endif
bool WebPage::javaScriptPrompt(QWebFrame* originatingFrame, const QString &msg, const QString &defaultValue, QString* result) bool WebPage::javaScriptPrompt(QUrl securityOrigin, const QString &msg, const QString &defaultValue, QString* result)
{ {
#ifndef NONBLOCK_JS_DIALOGS #ifndef NONBLOCK_JS_DIALOGS
return QWebPage::javaScriptPrompt(originatingFrame, msg, defaultValue, result); return QWebEnginePage::javaScriptPrompt(securityOrigin, msg, defaultValue, result);
#else #else
if (m_runningLoop) { if (m_runningLoop) {
return false; return false;
@ -963,10 +1130,10 @@ bool WebPage::javaScriptPrompt(QWebFrame* originatingFrame, const QString &msg,
#endif #endif
} }
bool WebPage::javaScriptConfirm(QWebFrame* originatingFrame, const QString &msg) bool WebPage::javaScriptConfirm(QUrl securityOrigin, const QString &msg)
{ {
#ifndef NONBLOCK_JS_DIALOGS #ifndef NONBLOCK_JS_DIALOGS
return QWebPage::javaScriptConfirm(originatingFrame, msg); return QWebEnginePage::javaScriptConfirm(securityOrigin, msg);
#else #else
if (m_runningLoop) { if (m_runningLoop) {
return false; return false;
@ -1003,9 +1170,9 @@ bool WebPage::javaScriptConfirm(QWebFrame* originatingFrame, const QString &msg)
#endif #endif
} }
void WebPage::javaScriptAlert(QWebFrame* originatingFrame, const QString &msg) void WebPage::javaScriptAlert(QUrl securityOrigin, const QString &msg)
{ {
Q_UNUSED(originatingFrame) Q_UNUSED(securityOrigin)
if (m_blockAlerts || m_runningLoop) { if (m_blockAlerts || m_runningLoop) {
return; return;
@ -1058,11 +1225,14 @@ void WebPage::javaScriptAlert(QWebFrame* originatingFrame, const QString &msg)
void WebPage::setJavaScriptEnabled(bool enabled) void WebPage::setJavaScriptEnabled(bool enabled)
{ {
settings()->setAttribute(QWebSettings::JavascriptEnabled, enabled); #if QTWEBENGINE_DISABLED
settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, enabled);
m_javaScriptEnabled = enabled; m_javaScriptEnabled = enabled;
#endif
} }
QString WebPage::chooseFile(QWebFrame* originatingFrame, const QString &oldFile) #if QTWEBENGINE_DISABLED
QString WebPage::chooseFile(QWebEngineFrame* originatingFrame, const QString &oldFile)
{ {
QString suggFileName; QString suggFileName;
@ -1073,7 +1243,7 @@ QString WebPage::chooseFile(QWebFrame* originatingFrame, const QString &oldFile)
suggFileName = oldFile; suggFileName = oldFile;
} }
const QString fileName = QzTools::getOpenFileName("WebPage-ChooseFile", originatingFrame->page()->view(), tr("Choose file..."), suggFileName); const QString fileName = QzTools::getOpenFileName("WebPage-ChooseFile", view(), tr("Choose file..."), suggFileName);
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
s_lastUploadLocation = fileName; s_lastUploadLocation = fileName;
@ -1089,6 +1259,7 @@ QString WebPage::chooseFile(QWebFrame* originatingFrame, const QString &oldFile)
return fileName; return fileName;
} }
#endif
bool WebPage::isPointerSafeToUse(WebPage* page) bool WebPage::isPointerSafeToUse(WebPage* page)
{ {

View File

@ -18,7 +18,7 @@
#ifndef WEBPAGE_H #ifndef WEBPAGE_H
#define WEBPAGE_H #define WEBPAGE_H
#include <QWebPage> #include <QWebEnginePage>
#include <QSslCertificate> #include <QSslCertificate>
#include <QVector> #include <QVector>
@ -35,7 +35,7 @@ class SpeedDial;
class NetworkManagerProxy; class NetworkManagerProxy;
class DelayedFileWatcher; class DelayedFileWatcher;
class QUPZILLA_EXPORT WebPage : public QWebPage class QUPZILLA_EXPORT WebPage : public QWebEnginePage
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -51,17 +51,15 @@ public:
WebPage(QObject* parent = 0); WebPage(QObject* parent = 0);
~WebPage(); ~WebPage();
QUrl url() const;
void setWebView(TabbedWebView* view); void setWebView(TabbedWebView* view);
void populateNetworkRequest(QNetworkRequest &request); void populateNetworkRequest(QNetworkRequest &request);
void setSSLCertificate(const QSslCertificate &cert); void setSSLCertificate(const QSslCertificate &cert);
QSslCertificate sslCertificate(); QSslCertificate sslCertificate();
bool javaScriptPrompt(QWebFrame* originatingFrame, const QString &msg, const QString &defaultValue, QString* result); bool javaScriptPrompt(QUrl securityOrigin, const QString &msg, const QString &defaultValue, QString* result);
bool javaScriptConfirm(QWebFrame* originatingFrame, const QString &msg); bool javaScriptConfirm(QUrl securityOrigin, const QString &msg);
void javaScriptAlert(QWebFrame* originatingFrame, const QString &msg); void javaScriptAlert(QUrl securityOrigin, const QString &msg);
void setJavaScriptEnabled(bool enabled); void setJavaScriptEnabled(bool enabled);
@ -80,7 +78,9 @@ public:
void addRejectedCerts(const QList<QSslCertificate> &certs); void addRejectedCerts(const QList<QSslCertificate> &certs);
bool containsRejectedCerts(const QList<QSslCertificate> &certs); bool containsRejectedCerts(const QList<QSslCertificate> &certs);
#if QTWEBENGINE_DISABLED
QWebElement activeElement() const; QWebElement activeElement() const;
#endif
QString userAgentForUrl(const QUrl &url) const; QString userAgentForUrl(const QUrl &url) const;
static bool isPointerSafeToUse(WebPage* page); static bool isPointerSafeToUse(WebPage* page);
@ -100,14 +100,18 @@ private slots:
void addJavaScriptObject(); void addJavaScriptObject();
void watchedFileChanged(const QString &file); void watchedFileChanged(const QString &file);
void printFrame(QWebFrame* frame);
void downloadRequested(const QNetworkRequest &request); void downloadRequested(const QNetworkRequest &request);
void windowCloseRequested(); void windowCloseRequested();
void authentication(const QUrl &requestUrl, QAuthenticator* auth);
void proxyAuthentication(const QUrl &requestUrl, QAuthenticator* auth, const QString &proxyHost);
#if QTWEBENGINE_DISABLED
void frameCreated(QWebFrame* frame); void frameCreated(QWebFrame* frame);
void frameInitialLayoutCompleted(); void frameInitialLayoutCompleted();
void dbQuotaExceeded(QWebEngineFrame* frame);
void printFrame(QWebEngineFrame* frame);
#endif
void dbQuotaExceeded(QWebFrame* frame);
void doWebSearch(const QString &text); void doWebSearch(const QString &text);
#ifdef USE_QTWEBKIT_2_2 #ifdef USE_QTWEBKIT_2_2
@ -117,14 +121,16 @@ private slots:
protected: protected:
bool event(QEvent* event); bool event(QEvent* event);
QWebPage* createWindow(QWebPage::WebWindowType type); QWebEnginePage* createWindow(QWebEnginePage::WebWindowType type);
QObject* createPlugin(const QString &classid, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues); QObject* createPlugin(const QString &classid, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues);
private: private:
#if QTWEBENGINE_DISABLED
bool supportsExtension(Extension extension) const; bool supportsExtension(Extension extension) const;
bool extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output = 0); bool extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output = 0);
bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type); bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type);
QString chooseFile(QWebFrame* originatingFrame, const QString &oldFile); QString chooseFile(QWebFrame* originatingFrame, const QString &oldFile);
#endif
void handleUnknownProtocol(const QUrl &url); void handleUnknownProtocol(const QUrl &url);
void desktopServicesOpen(const QUrl &url); void desktopServicesOpen(const QUrl &url);
@ -144,7 +150,6 @@ private:
QVector<AdBlockedEntry> m_adBlockedEntries; QVector<AdBlockedEntry> m_adBlockedEntries;
QVector<PasswordEntry> m_passwordEntries; QVector<PasswordEntry> m_passwordEntries;
QWebPage::NavigationType m_lastRequestType;
QUrl m_lastRequestUrl; QUrl m_lastRequestUrl;
int m_loadProgress; int m_loadProgress;

View File

@ -22,6 +22,7 @@
#include "adblockmanager.h" #include "adblockmanager.h"
#include "webpage.h" #include "webpage.h"
#if QTWEBENGINE_DISABLED
#include <QNetworkRequest> #include <QNetworkRequest>
WebPluginFactory::WebPluginFactory(WebPage* page) WebPluginFactory::WebPluginFactory(WebPage* page)
@ -97,3 +98,5 @@ QList<QWebPluginFactory::Plugin> WebPluginFactory::plugins() const
// plugins.append(plugin); // plugins.append(plugin);
// return plugins; // return plugins;
} }
#endif

View File

@ -18,6 +18,7 @@
#ifndef WEB_PLUGIN_FACTORY_H #ifndef WEB_PLUGIN_FACTORY_H
#define WEB_PLUGIN_FACTORY_H #define WEB_PLUGIN_FACTORY_H
#if QTWEBENGINE_DISABLED
#include <QWebPluginFactory> #include <QWebPluginFactory>
#include "qzcommon.h" #include "qzcommon.h"
@ -35,4 +36,5 @@ public:
private: private:
WebPage* m_page; WebPage* m_page;
}; };
#endif
#endif // WEB_PLUGIN_FACTORY_H #endif // WEB_PLUGIN_FACTORY_H

View File

@ -45,8 +45,7 @@
#include <QTimer> #include <QTimer>
#include <QDesktopServices> #include <QDesktopServices>
#include <QNetworkRequest> #include <QNetworkRequest>
#include <QWebHistory> #include <QWebEngineHistory>
#include <QWebFrame>
#include <QClipboard> #include <QClipboard>
#include <QTouchEvent> #include <QTouchEvent>
#include <QPrintPreviewDialog> #include <QPrintPreviewDialog>
@ -54,10 +53,12 @@
bool WebView::s_forceContextMenuOnMouseRelease = false; bool WebView::s_forceContextMenuOnMouseRelease = false;
WebView::WebView(QWidget* parent) WebView::WebView(QWidget* parent)
: QWebView(parent) : QWebEngineView(parent)
, m_isLoading(false) , m_isLoading(false)
, m_progress(0) , m_progress(0)
#if QTWEBENGINE_DISABLED
, m_clickedFrame(0) , m_clickedFrame(0)
#endif
, m_page(0) , m_page(0)
, m_disableTouchMocking(false) , m_disableTouchMocking(false)
, m_isReloading(false) , m_isReloading(false)
@ -67,8 +68,10 @@ WebView::WebView(QWidget* parent)
connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted())); connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished())); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));
connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl))); connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl)));
#if QTWEBENGINE_DISABLED
connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));
#endif
m_zoomLevels = zoomLevels(); m_zoomLevels = zoomLevels();
m_currentZoomLevel = m_zoomLevels.indexOf(100); m_currentZoomLevel = m_zoomLevels.indexOf(100);
@ -82,7 +85,7 @@ WebView::WebView(QWidget* parent)
WebView::~WebView() WebView::~WebView()
{ {
delete m_page; //delete m_page;
} }
QIcon WebView::icon() const QIcon WebView::icon() const
@ -99,9 +102,11 @@ QIcon WebView::icon() const
return IconProvider::standardIcon(QStyle::SP_ComputerIcon); return IconProvider::standardIcon(QStyle::SP_ComputerIcon);
} }
if (!QWebView::icon().isNull()) { #if QTWEBENGINE_DISABLED
return QWebView::icon(); if (!QWebEngineView::icon().isNull()) {
return QWebEngineView::icon();
} }
#endif
if (!m_siteIcon.isNull() && m_siteIconUrl.host() == url().host()) { if (!m_siteIcon.isNull() && m_siteIconUrl.host() == url().host()) {
return m_siteIcon; return m_siteIcon;
@ -112,7 +117,7 @@ QIcon WebView::icon() const
QString WebView::title() const QString WebView::title() const
{ {
QString title = QWebView::title(); QString title = QWebEngineView::title();
if (title.isEmpty()) { if (title.isEmpty()) {
title = url().toString(QUrl::RemoveFragment); title = url().toString(QUrl::RemoveFragment);
@ -127,7 +132,7 @@ QString WebView::title() const
bool WebView::isTitleEmpty() const bool WebView::isTitleEmpty() const
{ {
return QWebView::title().isEmpty(); return QWebEngineView::title().isEmpty();
} }
QUrl WebView::url() const QUrl WebView::url() const
@ -146,16 +151,18 @@ WebPage* WebView::page() const
return m_page; return m_page;
} }
void WebView::setPage(QWebPage* page) void WebView::setPage(QWebEnginePage* page)
{ {
if (m_page == page) { if (m_page == page) {
return; return;
} }
QWebView::setPage(page); QWebEngineView::setPage(page);
m_page = qobject_cast<WebPage*>(page); m_page = qobject_cast<WebPage*>(page);
connect(m_page, SIGNAL(saveFrameStateRequested(QWebFrame*,QWebHistoryItem*)), this, SLOT(frameStateChanged())); #if QTWEBENGINE_DISABLED
connect(m_page, SIGNAL(saveFrameStateRequested(QWebEngineFrame*,QWebHistoryItem*)), this, SLOT(frameStateChanged()));
#endif
connect(m_page, SIGNAL(privacyChanged(bool)), this, SIGNAL(privacyChanged(bool))); connect(m_page, SIGNAL(privacyChanged(bool)), this, SIGNAL(privacyChanged(bool)));
// Set default zoom level // Set default zoom level
@ -166,11 +173,13 @@ void WebView::setPage(QWebPage* page)
mApp->plugins()->emitWebPageCreated(m_page); mApp->plugins()->emitWebPageCreated(m_page);
#if QTWEBENGINE_DISABLED
// Set white background by default. // Set white background by default.
// Fixes issue with dark themes. See #602 // Fixes issue with dark themes. See #602
QPalette pal = palette(); QPalette pal = palette();
pal.setBrush(QPalette::Base, Qt::white); pal.setBrush(QPalette::Base, Qt::white);
page->setPalette(pal); page->setPalette(pal);
#endif
} }
void WebView::load(const LoadRequest &request) void WebView::load(const LoadRequest &request)
@ -182,9 +191,9 @@ void WebView::load(const LoadRequest &request)
// Is the javascript source percent encoded or not? // Is the javascript source percent encoded or not?
// Looking for % character in source should work in most cases // Looking for % character in source should work in most cases
if (scriptSource.contains(QL1C('%'))) if (scriptSource.contains(QL1C('%')))
page()->mainFrame()->evaluateJavaScript(QUrl::fromPercentEncoding(scriptSource.toUtf8())); page()->runJavaScript(QUrl::fromPercentEncoding(scriptSource.toUtf8()));
else else
page()->mainFrame()->evaluateJavaScript(scriptSource); page()->runJavaScript(scriptSource);
return; return;
} }
@ -235,11 +244,13 @@ bool WebView::hasRss() const
return m_hasRss; return m_hasRss;
} }
#if QTWEBENGINE_DISABLED
QWebElement WebView::activeElement() const QWebElement WebView::activeElement() const
{ {
QRect activeRect = inputMethodQuery(Qt::ImMicroFocus).toRect(); QRect activeRect = inputMethodQuery(Qt::ImMicroFocus).toRect();
return page()->mainFrame()->hitTestContent(activeRect.center()).element(); return page()->mainFrame()->hitTestContent(activeRect.center()).element();
} }
#endif
int WebView::zoomLevel() const int WebView::zoomLevel() const
{ {
@ -254,11 +265,13 @@ void WebView::setZoomLevel(int level)
bool WebView::onBeforeUnload() bool WebView::onBeforeUnload()
{ {
#if QTWEBENGINE_DISABLED
const QString res = page()->mainFrame()->evaluateJavaScript("window.onbeforeunload(new Event(\"beforeunload\"))").toString(); const QString res = page()->mainFrame()->evaluateJavaScript("window.onbeforeunload(new Event(\"beforeunload\"))").toString();
if (!res.isEmpty()) { if (!res.isEmpty()) {
return page()->javaScriptConfirm(page()->mainFrame(), res); return page()->javaScriptConfirm(page()->mainFrame(), res);
} }
#endif
return true; return true;
} }
@ -364,32 +377,32 @@ void WebView::zoomReset()
void WebView::editUndo() void WebView::editUndo()
{ {
triggerPageAction(QWebPage::Undo); triggerPageAction(QWebEnginePage::Undo);
} }
void WebView::editRedo() void WebView::editRedo()
{ {
triggerPageAction(QWebPage::Redo); triggerPageAction(QWebEnginePage::Redo);
} }
void WebView::editCut() void WebView::editCut()
{ {
triggerPageAction(QWebPage::Cut); triggerPageAction(QWebEnginePage::Cut);
} }
void WebView::editCopy() void WebView::editCopy()
{ {
triggerPageAction(QWebPage::Copy); triggerPageAction(QWebEnginePage::Copy);
} }
void WebView::editPaste() void WebView::editPaste()
{ {
triggerPageAction(QWebPage::Paste); triggerPageAction(QWebEnginePage::Paste);
} }
void WebView::editSelectAll() void WebView::editSelectAll()
{ {
triggerPageAction(QWebPage::SelectAll); triggerPageAction(QWebEnginePage::SelectAll);
} }
void WebView::editDelete() void WebView::editDelete()
@ -402,40 +415,44 @@ void WebView::reload()
{ {
m_isReloading = true; m_isReloading = true;
if (LocationBar::convertUrlToText(QWebView::url()).isEmpty() && !m_aboutToLoadUrl.isEmpty()) { if (LocationBar::convertUrlToText(QWebEngineView::url()).isEmpty() && !m_aboutToLoadUrl.isEmpty()) {
load(m_aboutToLoadUrl); load(m_aboutToLoadUrl);
return; return;
} }
QWebView::reload(); QWebEngineView::reload();
} }
void WebView::reloadBypassCache() void WebView::reloadBypassCache()
{ {
triggerPageAction(QWebPage::ReloadAndBypassCache); triggerPageAction(QWebEnginePage::ReloadAndBypassCache);
} }
void WebView::back() void WebView::back()
{ {
QWebHistory* history = page()->history(); QWebEngineHistory* history = page()->history();
if (history->canGoBack()) { if (history->canGoBack()) {
history->back(); history->back();
emit urlChanged(url()); emit urlChanged(url());
#if QTWEBENGINE_DISABLED
emit iconChanged(); emit iconChanged();
#endif
} }
} }
void WebView::forward() void WebView::forward()
{ {
QWebHistory* history = page()->history(); QWebEngineHistory* history = page()->history();
if (history->canGoForward()) { if (history->canGoForward()) {
history->forward(); history->forward();
emit urlChanged(url()); emit urlChanged(url());
#if QTWEBENGINE_DISABLED
emit iconChanged(); emit iconChanged();
#endif
} }
} }
@ -472,7 +489,7 @@ void WebView::slotLoadFinished()
void WebView::frameStateChanged() void WebView::frameStateChanged()
{ {
// QWebFrame::baseUrl() is not updated yet, so we are invoking 0 second timer // QWebEngineFrame::baseUrl() is not updated yet, so we are invoking 0 second timer
QTimer::singleShot(0, this, SLOT(emitChangedUrl())); QTimer::singleShot(0, this, SLOT(emitChangedUrl()));
} }
@ -483,16 +500,18 @@ void WebView::emitChangedUrl()
void WebView::checkRss() void WebView::checkRss()
{ {
#if QTWEBENGINE_DISABLED
if (m_rssChecked) { if (m_rssChecked) {
return; return;
} }
m_rssChecked = true; m_rssChecked = true;
QWebFrame* frame = page()->mainFrame(); QWebEngineFrame* frame = page()->mainFrame();
const QWebElementCollection links = frame->findAllElements("link[type=\"application/rss+xml\"]"); const QWebElementCollection links = frame->findAllElements("link[type=\"application/rss+xml\"]");
m_hasRss = links.count() != 0; m_hasRss = links.count() != 0;
emit rssChanged(m_hasRss); emit rssChanged(m_hasRss);
#endif
} }
void WebView::slotIconChanged() void WebView::slotIconChanged()
@ -599,7 +618,9 @@ void WebView::downloadUrlToDisk()
void WebView::copyImageToClipboard() void WebView::copyImageToClipboard()
{ {
triggerPageAction(QWebPage::CopyImageToClipboard); #if QTWEBENGINE_DISABLED
triggerPageAction(QWebEnginePage::CopyImageToClipboard);
#endif
} }
void WebView::openActionUrl() void WebView::openActionUrl()
@ -609,7 +630,8 @@ void WebView::openActionUrl()
} }
} }
void WebView::showSource(QWebFrame* frame, const QString &selectedHtml) #if QTWEBENGINE_DISABLED
void WebView::showSource(QWebEngineFrame* frame, const QString &selectedHtml)
{ {
if (!frame) { if (!frame) {
frame = page()->mainFrame(); frame = page()->mainFrame();
@ -619,11 +641,14 @@ void WebView::showSource(QWebFrame* frame, const QString &selectedHtml)
QzTools::centerWidgetToParent(source, this); QzTools::centerWidgetToParent(source, this);
source->show(); source->show();
} }
#endif
void WebView::showSiteInfo() void WebView::showSiteInfo()
{ {
#if QTWEBENGINE_DISABLED
SiteInfo* s = new SiteInfo(this, this); SiteInfo* s = new SiteInfo(this, this);
s->show(); s->show();
#endif
} }
void WebView::searchSelectedText() void WebView::searchSelectedText()
@ -733,22 +758,26 @@ void WebView::userDefinedOpenUrlInBgTab(const QUrl &url)
void WebView::loadClickedFrame() void WebView::loadClickedFrame()
{ {
#if QTWEBENGINE_DISABLED
QUrl frameUrl = m_clickedFrame->baseUrl(); QUrl frameUrl = m_clickedFrame->baseUrl();
if (frameUrl.isEmpty()) { if (frameUrl.isEmpty()) {
frameUrl = m_clickedFrame->requestedUrl(); frameUrl = m_clickedFrame->requestedUrl();
} }
load(frameUrl); load(frameUrl);
#endif
} }
void WebView::loadClickedFrameInNewTab(bool invert) void WebView::loadClickedFrameInNewTab(bool invert)
{ {
#if QTWEBENGINE_DISABLED
QUrl frameUrl = m_clickedFrame->baseUrl(); QUrl frameUrl = m_clickedFrame->baseUrl();
if (frameUrl.isEmpty()) { if (frameUrl.isEmpty()) {
frameUrl = m_clickedFrame->requestedUrl(); frameUrl = m_clickedFrame->requestedUrl();
} }
userDefinedOpenUrlInNewTab(frameUrl, invert); userDefinedOpenUrlInNewTab(frameUrl, invert);
#endif
} }
void WebView::loadClickedFrameInBgTab() void WebView::loadClickedFrameInBgTab()
@ -758,50 +787,63 @@ void WebView::loadClickedFrameInBgTab()
void WebView::reloadClickedFrame() void WebView::reloadClickedFrame()
{ {
#if QTWEBENGINE_DISABLED
QUrl frameUrl = m_clickedFrame->baseUrl(); QUrl frameUrl = m_clickedFrame->baseUrl();
if (frameUrl.isEmpty()) { if (frameUrl.isEmpty()) {
frameUrl = m_clickedFrame->requestedUrl(); frameUrl = m_clickedFrame->requestedUrl();
} }
m_clickedFrame->load(frameUrl); m_clickedFrame->load(frameUrl);
#endif
} }
void WebView::printClickedFrame() void WebView::printClickedFrame()
{ {
#if QTWEBENGINE_DISABLED
printPage(m_clickedFrame); printPage(m_clickedFrame);
#endif
} }
void WebView::clickedFrameZoomIn() void WebView::clickedFrameZoomIn()
{ {
#if QTWEBENGINE_DISABLED
qreal zFactor = m_clickedFrame->zoomFactor() + 0.1; qreal zFactor = m_clickedFrame->zoomFactor() + 0.1;
if (zFactor > 2.5) { if (zFactor > 2.5) {
zFactor = 2.5; zFactor = 2.5;
} }
m_clickedFrame->setZoomFactor(zFactor); m_clickedFrame->setZoomFactor(zFactor);
#endif
} }
void WebView::clickedFrameZoomOut() void WebView::clickedFrameZoomOut()
{ {
#if QTWEBENGINE_DISABLED
qreal zFactor = m_clickedFrame->zoomFactor() - 0.1; qreal zFactor = m_clickedFrame->zoomFactor() - 0.1;
if (zFactor < 0.5) { if (zFactor < 0.5) {
zFactor = 0.5; zFactor = 0.5;
} }
m_clickedFrame->setZoomFactor(zFactor); m_clickedFrame->setZoomFactor(zFactor);
#endif
} }
void WebView::clickedFrameZoomReset() void WebView::clickedFrameZoomReset()
{ {
#if QTWEBENGINE_DISABLED
m_clickedFrame->setZoomFactor(zoomFactor()); m_clickedFrame->setZoomFactor(zoomFactor());
#endif
} }
void WebView::showClickedFrameSource() void WebView::showClickedFrameSource()
{ {
#if QTWEBENGINE_DISABLED
showSource(m_clickedFrame); showSource(m_clickedFrame);
#endif
} }
void WebView::printPage(QWebFrame* frame) #if QTWEBENGINE_DISABLED
void WebView::printPage(QWebEngineFrame* frame)
{ {
QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this); QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setAttribute(Qt::WA_DeleteOnClose);
@ -816,12 +858,14 @@ void WebView::printPage(QWebFrame* frame)
dialog->open(); dialog->open();
} }
#endif
QUrl WebView::lastUrl() QUrl WebView::lastUrl()
{ {
return m_lastUrl; return m_lastUrl;
} }
#if QTWEBENGINE_DISABLED
bool WebView::isMediaElement(const QWebElement &element) bool WebView::isMediaElement(const QWebElement &element)
{ {
return (element.tagName().toLower() == QLatin1String("video") return (element.tagName().toLower() == QLatin1String("video")
@ -921,7 +965,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
++i; ++i;
} }
if (menu->actions().last() == pageAction(QWebPage::InspectElement)) { if (menu->actions().last() == pageAction(QWebEnginePage::InspectElement)) {
// We have own Inspect Element action // We have own Inspect Element action
menu->actions().last()->setVisible(false); menu->actions().last()->setVisible(false);
} }
@ -953,7 +997,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos) void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos)
{ {
QWebFrame* frameAtPos = page()->frameAt(pos); QWebEngineFrame* frameAtPos = page()->frameAt(pos);
QAction* action = menu->addAction(tr("&Back"), this, SLOT(back())); QAction* action = menu->addAction(tr("&Back"), this, SLOT(back()));
action->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowBack)); action->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowBack));
@ -1045,8 +1089,8 @@ void WebView::createLinkContextMenu(QMenu* menu, const QWebHitTestResult &hitTes
menu->addSeparator(); menu->addSeparator();
if (!selectedText().isEmpty()) { if (!selectedText().isEmpty()) {
pageAction(QWebPage::Copy)->setIcon(QIcon::fromTheme("edit-copy")); pageAction(QWebEnginePage::Copy)->setIcon(QIcon::fromTheme("edit-copy"));
menu->addAction(pageAction(QWebPage::Copy)); menu->addAction(pageAction(QWebEnginePage::Copy));
} }
} }
@ -1066,8 +1110,8 @@ void WebView::createImageContextMenu(QMenu* menu, const QWebHitTestResult &hitTe
menu->addSeparator(); menu->addSeparator();
if (!selectedText().isEmpty()) { if (!selectedText().isEmpty()) {
pageAction(QWebPage::Copy)->setIcon(QIcon::fromTheme("edit-copy")); pageAction(QWebEnginePage::Copy)->setIcon(QIcon::fromTheme("edit-copy"));
menu->addAction(pageAction(QWebPage::Copy)); menu->addAction(pageAction(QWebEnginePage::Copy));
} }
} }
@ -1078,8 +1122,8 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult
QString selectedText = page()->selectedText(); QString selectedText = page()->selectedText();
menu->addSeparator(); menu->addSeparator();
if (!menu->actions().contains(pageAction(QWebPage::Copy))) { if (!menu->actions().contains(pageAction(QWebEnginePage::Copy))) {
menu->addAction(pageAction(QWebPage::Copy)); menu->addAction(pageAction(QWebEnginePage::Copy));
} }
menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send text..."), this, SLOT(sendLinkByMail()))->setData(selectedText); menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send text..."), this, SLOT(sendLinkByMail()))->setData(selectedText);
menu->addSeparator(); menu->addSeparator();
@ -1186,74 +1230,77 @@ void WebView::muteMedia()
m_clickedElement.evaluateJavaScript("this.muted = true"); m_clickedElement.evaluateJavaScript("this.muted = true");
} }
} }
#endif
void WebView::addSpeedDial() void WebView::addSpeedDial()
{ {
page()->mainFrame()->evaluateJavaScript("addSpeedDial()"); page()->runJavaScript("addSpeedDial()");
} }
void WebView::configureSpeedDial() void WebView::configureSpeedDial()
{ {
page()->mainFrame()->evaluateJavaScript("configureSpeedDial()"); page()->runJavaScript("configureSpeedDial()");
} }
void WebView::reloadAllSpeedDials() void WebView::reloadAllSpeedDials()
{ {
page()->mainFrame()->evaluateJavaScript("reloadAll()"); page()->runJavaScript("reloadAll()");
} }
void WebView::initializeActions() void WebView::initializeActions()
{ {
QAction* undoAction = pageAction(QWebPage::Undo); QAction* undoAction = pageAction(QWebEnginePage::Undo);
undoAction->setText(tr("&Undo")); undoAction->setText(tr("&Undo"));
undoAction->setShortcut(QKeySequence("Ctrl+Z")); undoAction->setShortcut(QKeySequence("Ctrl+Z"));
undoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); undoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
undoAction->setIcon(QIcon::fromTheme(QSL("edit-undo"))); undoAction->setIcon(QIcon::fromTheme(QSL("edit-undo")));
QAction* redoAction = pageAction(QWebPage::Redo); QAction* redoAction = pageAction(QWebEnginePage::Redo);
redoAction->setText(tr("&Redo")); redoAction->setText(tr("&Redo"));
redoAction->setShortcut(QKeySequence("Ctrl+Shift+Z")); redoAction->setShortcut(QKeySequence("Ctrl+Shift+Z"));
redoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); redoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
redoAction->setIcon(QIcon::fromTheme(QSL("edit-redo"))); redoAction->setIcon(QIcon::fromTheme(QSL("edit-redo")));
QAction* cutAction = pageAction(QWebPage::Cut); QAction* cutAction = pageAction(QWebEnginePage::Cut);
cutAction->setText(tr("&Cut")); cutAction->setText(tr("&Cut"));
cutAction->setShortcut(QKeySequence("Ctrl+X")); cutAction->setShortcut(QKeySequence("Ctrl+X"));
cutAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); cutAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
cutAction->setIcon(QIcon::fromTheme(QSL("edit-cut"))); cutAction->setIcon(QIcon::fromTheme(QSL("edit-cut")));
QAction* copyAction = pageAction(QWebPage::Copy); QAction* copyAction = pageAction(QWebEnginePage::Copy);
copyAction->setText(tr("&Copy")); copyAction->setText(tr("&Copy"));
copyAction->setShortcut(QKeySequence("Ctrl+C")); copyAction->setShortcut(QKeySequence("Ctrl+C"));
copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
copyAction->setIcon(QIcon::fromTheme(QSL("edit-copy"))); copyAction->setIcon(QIcon::fromTheme(QSL("edit-copy")));
QAction* pasteAction = pageAction(QWebPage::Paste); QAction* pasteAction = pageAction(QWebEnginePage::Paste);
pasteAction->setText(tr("&Paste")); pasteAction->setText(tr("&Paste"));
pasteAction->setShortcut(QKeySequence("Ctrl+V")); pasteAction->setShortcut(QKeySequence("Ctrl+V"));
pasteAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); pasteAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
pasteAction->setIcon(QIcon::fromTheme(QSL("edit-paste"))); pasteAction->setIcon(QIcon::fromTheme(QSL("edit-paste")));
QAction* selectAllAction = pageAction(QWebPage::SelectAll); QAction* selectAllAction = pageAction(QWebEnginePage::SelectAll);
selectAllAction->setText(tr("Select All")); selectAllAction->setText(tr("Select All"));
selectAllAction->setShortcut(QKeySequence("Ctrl+A")); selectAllAction->setShortcut(QKeySequence("Ctrl+A"));
selectAllAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); selectAllAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
selectAllAction->setIcon(QIcon::fromTheme(QSL("edit-select-all"))); selectAllAction->setIcon(QIcon::fromTheme(QSL("edit-select-all")));
QAction* reloadAction = pageAction(QWebPage::Reload); QAction* reloadAction = pageAction(QWebEnginePage::Reload);
reloadAction->setText(tr("&Reload")); reloadAction->setText(tr("&Reload"));
reloadAction->setIcon(QIcon::fromTheme(QSL("view-refresh"))); reloadAction->setIcon(QIcon::fromTheme(QSL("view-refresh")));
QAction* stopAction = pageAction(QWebPage::Stop); QAction* stopAction = pageAction(QWebEnginePage::Stop);
stopAction->setText(tr("S&top")); stopAction->setText(tr("S&top"));
stopAction->setIcon(QIcon::fromTheme(QSL("process-stop"))); stopAction->setIcon(QIcon::fromTheme(QSL("process-stop")));
pageAction(QWebPage::SetTextDirectionDefault)->setText(tr("Default")); #if QTWEBENGINE_DISABLED
pageAction(QWebPage::SetTextDirectionLeftToRight)->setText(tr("Left to Right")); pageAction(QWebEnginePage::SetTextDirectionDefault)->setText(tr("Default"));
pageAction(QWebPage::SetTextDirectionRightToLeft)->setText(tr("Right to Left")); pageAction(QWebEnginePage::SetTextDirectionLeftToRight)->setText(tr("Left to Right"));
pageAction(QWebPage::ToggleBold)->setText(tr("Bold")); pageAction(QWebEnginePage::SetTextDirectionRightToLeft)->setText(tr("Right to Left"));
pageAction(QWebPage::ToggleItalic)->setText(tr("Italic")); pageAction(QWebEnginePage::ToggleBold)->setText(tr("Bold"));
pageAction(QWebPage::ToggleUnderline)->setText(tr("Underline")); pageAction(QWebEnginePage::ToggleItalic)->setText(tr("Italic"));
pageAction(QWebEnginePage::ToggleUnderline)->setText(tr("Underline"));
#endif
// Make action shortcuts available for webview // Make action shortcuts available for webview
addAction(undoAction); addAction(undoAction);
@ -1277,7 +1324,7 @@ void WebView::wheelEvent(QWheelEvent* event)
return; return;
} }
QWebView::wheelEvent(event); QWebEngineView::wheelEvent(event);
} }
void WebView::mousePressEvent(QMouseEvent* event) void WebView::mousePressEvent(QMouseEvent* event)
@ -1298,19 +1345,22 @@ void WebView::mousePressEvent(QMouseEvent* event)
break; break;
case Qt::MiddleButton: { case Qt::MiddleButton: {
QWebFrame* frame = page()->frameAt(event->pos()); #if QTWEBENGINE_DISABLED
QWebEngineFrame* frame = page()->frameAt(event->pos());
if (frame) { if (frame) {
m_clickedUrl = frame->hitTestContent(event->pos()).linkUrl(); m_clickedUrl = frame->hitTestContent(event->pos()).linkUrl();
if (!m_clickedUrl.isEmpty()) { if (!m_clickedUrl.isEmpty()) {
return; return;
} }
} }
#endif
break; break;
} }
case Qt::LeftButton: { case Qt::LeftButton: {
QWebFrame* frame = page()->frameAt(event->pos()); #if QTWEBENGINE_DISABLED
QWebEngineFrame* frame = page()->frameAt(event->pos());
if (frame) { if (frame) {
const QUrl link = frame->hitTestContent(event->pos()).linkUrl(); const QUrl link = frame->hitTestContent(event->pos()).linkUrl();
if (event->modifiers() & Qt::ControlModifier && isUrlValid(link)) { if (event->modifiers() & Qt::ControlModifier && isUrlValid(link)) {
@ -1319,13 +1369,14 @@ void WebView::mousePressEvent(QMouseEvent* event)
return; return;
} }
} }
#endif
} }
default: default:
break; break;
} }
QWebView::mousePressEvent(event); QWebEngineView::mousePressEvent(event);
} }
void WebView::mouseReleaseEvent(QMouseEvent* event) void WebView::mouseReleaseEvent(QMouseEvent* event)
@ -1336,7 +1387,8 @@ void WebView::mouseReleaseEvent(QMouseEvent* event)
switch (event->button()) { switch (event->button()) {
case Qt::MiddleButton: { case Qt::MiddleButton: {
QWebFrame* frame = page()->frameAt(event->pos()); #if QTWEBENGINE_DISABLED
QWebEngineFrame* frame = page()->frameAt(event->pos());
if (frame) { if (frame) {
const QUrl link = frame->hitTestContent(event->pos()).linkUrl(); const QUrl link = frame->hitTestContent(event->pos()).linkUrl();
if (m_clickedUrl == link && isUrlValid(link)) { if (m_clickedUrl == link && isUrlValid(link)) {
@ -1345,6 +1397,7 @@ void WebView::mouseReleaseEvent(QMouseEvent* event)
return; return;
} }
} }
#endif
break; break;
} }
@ -1359,7 +1412,7 @@ void WebView::mouseReleaseEvent(QMouseEvent* event)
break; break;
} }
QWebView::mouseReleaseEvent(event); QWebEngineView::mouseReleaseEvent(event);
} }
void WebView::mouseMoveEvent(QMouseEvent* event) void WebView::mouseMoveEvent(QMouseEvent* event)
@ -1368,7 +1421,7 @@ void WebView::mouseMoveEvent(QMouseEvent* event)
return; return;
} }
QWebView::mouseMoveEvent(event); QWebEngineView::mouseMoveEvent(event);
} }
void WebView::keyPressEvent(QKeyEvent* event) void WebView::keyPressEvent(QKeyEvent* event)
@ -1386,6 +1439,7 @@ void WebView::keyPressEvent(QKeyEvent* event)
// event->spontaneous() check guards recursive calling of keyPressEvent // event->spontaneous() check guards recursive calling of keyPressEvent
// Events created from app have spontaneous() == false // Events created from app have spontaneous() == false
#if QTWEBENGINE_DISABLED
if (event->spontaneous() && (eventKey == Qt::Key_Left || eventKey == Qt::Key_Right)) { if (event->spontaneous() && (eventKey == Qt::Key_Left || eventKey == Qt::Key_Right)) {
const QWebElement elementHasCursor = activeElement(); const QWebElement elementHasCursor = activeElement();
if (!elementHasCursor.isNull()) { if (!elementHasCursor.isNull()) {
@ -1455,7 +1509,7 @@ void WebView::keyPressEvent(QKeyEvent* event)
case Qt::Key_Down: case Qt::Key_Down:
if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() & Qt::ShiftModifier) {
triggerPageAction(QWebPage::SelectNextLine); triggerPageAction(QWebEnginePage::SelectNextLine);
event->accept(); event->accept();
return; return;
} }
@ -1464,10 +1518,10 @@ void WebView::keyPressEvent(QKeyEvent* event)
case Qt::Key_Left: case Qt::Key_Left:
if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() & Qt::ShiftModifier) {
if (event->modifiers() == Qt::ShiftModifier) { if (event->modifiers() == Qt::ShiftModifier) {
triggerPageAction(QWebPage::SelectPreviousChar); triggerPageAction(QWebEnginePage::SelectPreviousChar);
} }
else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
triggerPageAction(QWebPage::SelectPreviousWord); triggerPageAction(QWebEnginePage::SelectPreviousWord);
} }
event->accept(); event->accept();
return; return;
@ -1477,10 +1531,10 @@ void WebView::keyPressEvent(QKeyEvent* event)
case Qt::Key_Right: case Qt::Key_Right:
if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() & Qt::ShiftModifier) {
if (event->modifiers() == Qt::ShiftModifier) { if (event->modifiers() == Qt::ShiftModifier) {
triggerPageAction(QWebPage::SelectNextChar); triggerPageAction(QWebEnginePage::SelectNextChar);
} }
else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
triggerPageAction(QWebPage::SelectNextWord); triggerPageAction(QWebEnginePage::SelectNextWord);
} }
event->accept(); event->accept();
return; return;
@ -1490,10 +1544,10 @@ void WebView::keyPressEvent(QKeyEvent* event)
case Qt::Key_Home: case Qt::Key_Home:
if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() & Qt::ShiftModifier) {
if (event->modifiers() == Qt::ShiftModifier) { if (event->modifiers() == Qt::ShiftModifier) {
triggerPageAction(QWebPage::SelectStartOfLine); triggerPageAction(QWebEnginePage::SelectStartOfLine);
} }
else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
triggerPageAction(QWebPage::SelectStartOfDocument); triggerPageAction(QWebEnginePage::SelectStartOfDocument);
} }
event->accept(); event->accept();
return; return;
@ -1503,10 +1557,10 @@ void WebView::keyPressEvent(QKeyEvent* event)
case Qt::Key_End: case Qt::Key_End:
if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() & Qt::ShiftModifier) {
if (event->modifiers() == Qt::ShiftModifier) { if (event->modifiers() == Qt::ShiftModifier) {
triggerPageAction(QWebPage::SelectEndOfLine); triggerPageAction(QWebEnginePage::SelectEndOfLine);
} }
else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
triggerPageAction(QWebPage::SelectEndOfDocument); triggerPageAction(QWebEnginePage::SelectEndOfDocument);
} }
event->accept(); event->accept();
return; return;
@ -1515,12 +1569,12 @@ void WebView::keyPressEvent(QKeyEvent* event)
case Qt::Key_Insert: case Qt::Key_Insert:
if (event->modifiers() == Qt::ControlModifier) { if (event->modifiers() == Qt::ControlModifier) {
triggerPageAction(QWebPage::Copy); triggerPageAction(QWebEnginePage::Copy);
event->accept(); event->accept();
return; return;
} }
if (event->modifiers() == Qt::ShiftModifier) { if (event->modifiers() == Qt::ShiftModifier) {
triggerPageAction(QWebPage::Paste); triggerPageAction(QWebEnginePage::Paste);
event->accept(); event->accept();
return; return;
} }
@ -1529,8 +1583,9 @@ void WebView::keyPressEvent(QKeyEvent* event)
default: default:
break; break;
} }
#endif
QWebView::keyPressEvent(event); QWebEngineView::keyPressEvent(event);
} }
void WebView::keyReleaseEvent(QKeyEvent* event) void WebView::keyReleaseEvent(QKeyEvent* event)
@ -1539,23 +1594,29 @@ void WebView::keyReleaseEvent(QKeyEvent* event)
return; return;
} }
QWebView::keyReleaseEvent(event); QWebEngineView::keyReleaseEvent(event);
} }
void WebView::resizeEvent(QResizeEvent* event) void WebView::resizeEvent(QResizeEvent* event)
{ {
QWebView::resizeEvent(event); QWebEngineView::resizeEvent(event);
#if QTWEBENGINE_DISABLED
emit viewportResized(page()->viewportSize()); emit viewportResized(page()->viewportSize());
#endif
} }
void WebView::loadRequest(const LoadRequest &req) void WebView::loadRequest(const LoadRequest &req)
{ {
m_aboutToLoadUrl = req.url(); m_aboutToLoadUrl = req.url();
#if QTWEBENGINE_DISABLED
if (req.operation() == LoadRequest::GetOperation) if (req.operation() == LoadRequest::GetOperation)
QWebView::load(req.networkRequest()); QWebEngineView::load(req.networkRequest());
else else
QWebView::load(req.networkRequest(), QNetworkAccessManager::PostOperation, req.data()); QWebEngineView::load(req.networkRequest(), QNetworkAccessManager::PostOperation, req.data());
#else
QWebEngineView::load(req.url());
#endif
} }
bool WebView::eventFilter(QObject* obj, QEvent* event) bool WebView::eventFilter(QObject* obj, QEvent* event)
@ -1568,6 +1629,7 @@ bool WebView::eventFilter(QObject* obj, QEvent* event)
} }
} }
#if QTWEBENGINE_DISABLED
// This hack is no longer needed with QtWebKit 2.3 (bundled in Qt 5) // This hack is no longer needed with QtWebKit 2.3 (bundled in Qt 5)
#if QTWEBKIT_TO_2_3 #if QTWEBKIT_TO_2_3
// This function was taken and modified from QTestBrowser to fix bug #33 with flightradar24.com // This function was taken and modified from QTestBrowser to fix bug #33 with flightradar24.com
@ -1588,6 +1650,7 @@ bool WebView::eventFilter(QObject* obj, QEvent* event)
if (ev->type() == QEvent::MouseMove && !(ev->buttons() & Qt::LeftButton)) { if (ev->type() == QEvent::MouseMove && !(ev->buttons() & Qt::LeftButton)) {
return false; return false;
} }
#endif
if (ev->type() == QEvent::MouseButtonPress && !(ev->buttons() & Qt::LeftButton)) { if (ev->type() == QEvent::MouseButtonPress && !(ev->buttons() & Qt::LeftButton)) {
return false; return false;
@ -1634,5 +1697,5 @@ bool WebView::eventFilter(QObject* obj, QEvent* event)
return false; return false;
} }
#endif #endif
return QWebView::eventFilter(obj, event); return QWebEngineView::eventFilter(obj, event);
} }

View File

@ -18,8 +18,11 @@
#ifndef WEBVIEW_H #ifndef WEBVIEW_H
#define WEBVIEW_H #define WEBVIEW_H
#include <QWebView> #include <QIcon>
#include <QWebEngineView>
#if QTWEBENGINE_DISABLED
#include <QWebElement> #include <QWebElement>
#endif
#include "qzcommon.h" #include "qzcommon.h"
#include "loadrequest.h" #include "loadrequest.h"
@ -27,7 +30,7 @@
class WebPage; class WebPage;
class LoadRequest; class LoadRequest;
class QUPZILLA_EXPORT WebView : public QWebView class QUPZILLA_EXPORT WebView : public QWebEngineView
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -41,7 +44,7 @@ public:
bool isTitleEmpty() const; bool isTitleEmpty() const;
WebPage* page() const; WebPage* page() const;
void setPage(QWebPage* page); void setPage(QWebEnginePage* page);
void load(const LoadRequest &request); void load(const LoadRequest &request);
bool loadingError() const; bool loadingError() const;
@ -51,7 +54,9 @@ public:
void fakeLoadingProgress(int progress); void fakeLoadingProgress(int progress);
bool hasRss() const; bool hasRss() const;
#if QTWEBENGINE_DISABLED
QWebElement activeElement() const; QWebElement activeElement() const;
#endif
// Set zoom level (0 - 17) // Set zoom level (0 - 17)
int zoomLevel() const; int zoomLevel() const;
@ -100,7 +105,9 @@ public slots:
void back(); void back();
void forward(); void forward();
void printPage(QWebFrame* frame = 0); #if QTWEBENGINE_DISABLED
void printPage(QWebEngineFrame* frame = 0);
#endif
void sendPageByMail(); void sendPageByMail();
void savePageAs(); void savePageAs();
@ -124,7 +131,9 @@ protected slots:
void downloadUrlToDisk(); void downloadUrlToDisk();
void copyImageToClipboard(); void copyImageToClipboard();
void openActionUrl(); void openActionUrl();
void showSource(QWebFrame* frame = 0, const QString &selectedHtml = QString()); #if QTWEBENGINE_DISABLED
void showSource(QWebEngineFrame* frame = 0, const QString &selectedHtml = QString());
#endif
void showSiteInfo(); void showSiteInfo();
void searchSelectedText(); void searchSelectedText();
void searchSelectedTextInBackgroundTab(); void searchSelectedTextInBackgroundTab();
@ -136,7 +145,9 @@ protected slots:
void userDefinedOpenUrlInNewTab(const QUrl &url = QUrl(), bool invert = false); void userDefinedOpenUrlInNewTab(const QUrl &url = QUrl(), bool invert = false);
void userDefinedOpenUrlInBgTab(const QUrl &url = QUrl()); void userDefinedOpenUrlInBgTab(const QUrl &url = QUrl());
#if QTWEBENGINE_DISABLED
void createSearchEngine(); void createSearchEngine();
#endif
// Clicked frame actions // Clicked frame actions
void loadClickedFrame(); void loadClickedFrame();
@ -162,6 +173,7 @@ protected:
void applyZoom(); void applyZoom();
QUrl lastUrl(); QUrl lastUrl();
#if QTWEBENGINE_DISABLED
bool isMediaElement(const QWebElement &element); bool isMediaElement(const QWebElement &element);
void checkForForm(QMenu* menu, const QWebElement &element); void checkForForm(QMenu* menu, const QWebElement &element);
@ -171,10 +183,13 @@ protected:
void createImageContextMenu(QMenu* menu, const QWebHitTestResult &hitTest); void createImageContextMenu(QMenu* menu, const QWebHitTestResult &hitTest);
void createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult &hitTest); void createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult &hitTest);
void createMediaContextMenu(QMenu* menu, const QWebHitTestResult &hitTest); void createMediaContextMenu(QMenu* menu, const QWebHitTestResult &hitTest);
#endif
private slots: private slots:
#if QTWEBENGINE_DISABLED
void pauseMedia(); void pauseMedia();
void muteMedia(); void muteMedia();
#endif
void frameStateChanged(); void frameStateChanged();
void emitChangedUrl(); void emitChangedUrl();
void checkRss(); void checkRss();
@ -196,8 +211,10 @@ private:
QUrl m_aboutToLoadUrl; QUrl m_aboutToLoadUrl;
QUrl m_lastUrl; QUrl m_lastUrl;
#if QTWEBENGINE_DISABLED
QWebElement m_clickedElement; QWebElement m_clickedElement;
QWebFrame* m_clickedFrame; QWebEngineFrame* m_clickedFrame;
#endif
QUrl m_clickedUrl; QUrl m_clickedUrl;
WebPage* m_page; WebPage* m_page;

Some files were not shown because too many files have changed in this diff Show More