diff --git a/.gitignore b/.gitignore index ec4c2e1cc..68c3042d2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ DEBIAN *.autosave *~ *.a -*.orig *.qm *.o !qt_*.qm diff --git a/QupZilla.pro b/QupZilla.pro index e1e2969ca..8c3cebe74 100644 --- a/QupZilla.pro +++ b/QupZilla.pro @@ -24,4 +24,4 @@ src_main.depends = sub-src-lib src_plugins.subdir = src/plugins src_plugins.depends = sub-src-lib -SUBDIRS += src_lib src_main src_plugins +SUBDIRS += src_lib src_main diff --git a/README.md b/README.md index 458a5553c..3f6f0ef71 100644 --- a/README.md +++ b/README.md @@ -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) Blog: [http://blog.qupzilla.com](http://blog.qupzilla.com) IRC: `#qupzilla` at `irc.freenode.net` 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 -available through all major platforms. This project has been originally started only -for educational purposes. But from its start, QupZilla has grown into a feature-rich browser. - -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) +Master branch is now for QtWebEngine. It is still in very early development state, so except +a lot of features found in QtWebKit branch not working here. Thanks for understanding! + +For QtWebKit, please use [v1.8](https://github.com/QupZilla/qupzilla/tree/v1.8) \ No newline at end of file diff --git a/src/lib/adblock/adblockrule.cpp b/src/lib/adblock/adblockrule.cpp index d1c88f688..24a224f63 100644 --- a/src/lib/adblock/adblockrule.cpp +++ b/src/lib/adblock/adblockrule.cpp @@ -53,8 +53,7 @@ #include #include #include -#include -#include +#include // Version for Qt < 4.8 has one issue, it will wrongly // 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 { - QWebFrame* originatingFrame = static_cast(request.originatingObject()); +#if QTWEBENGINE_DISABLED + QWebEngineFrame* originatingFrame = static_cast(request.originatingObject()); if (!originatingFrame) { return false; } - QWebPage* page = originatingFrame->page(); + QWebEnginePage* page = originatingFrame->page(); if (!page) { return false; } @@ -365,6 +365,9 @@ bool AdBlockRule::matchSubdocument(const QNetworkRequest &request) const bool match = !(originatingFrame == page->mainFrame()); return hasException(SubdocumentOption) ? !match : match; +#else + return false; +#endif } bool AdBlockRule::matchXmlHttpRequest(const QNetworkRequest &request) const diff --git a/src/lib/app/browserwindow.cpp b/src/lib/app/browserwindow.cpp index 2b3106ea9..5ec50d63d 100644 --- a/src/lib/app/browserwindow.cpp +++ b/src/lib/app/browserwindow.cpp @@ -82,8 +82,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -105,7 +104,11 @@ #endif #endif /* Q_OS_WIN */ +#if QTWEBENGINE_DISABLED 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()) { @@ -197,6 +200,7 @@ void BrowserWindow::postLaunch() switch (m_windowType) { case Qz::BW_FirstAppWindow: +#if QTWEBENGINE_DISABLED if (mApp->isStartingAfterCrash()) { addTab = true; startUrl = QUrl("qupzilla:restore"); @@ -204,6 +208,11 @@ void BrowserWindow::postLaunch() else if (afterLaunch == 3 && mApp->restoreManager()) { addTab = !mApp->restoreSession(this, mApp->restoreManager()->restoreData()); } +#else + if (afterLaunch == 3 && mApp->restoreManager()) { + addTab = !mApp->restoreSession(this, mApp->restoreManager()->restoreData()); + } +#endif else { // Pinned tabs are restored in MainApplication::restoreStateSlot // 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()); QMenu* subMenu = new QMenu(name, menu); +#if QTWEBENGINE_DISABLED const QString activeCodecName = QWebSettings::globalSettings()->defaultTextEncoding(); +#else + const QString activeCodecName = QL1S("UTF-8"); +#endif foreach (const QString &codecName, codecNames) { subMenu->addAction(createEncodingAction(codecName, activeCodecName, subMenu)); @@ -668,7 +681,9 @@ void BrowserWindow::changeEncoding() { if (QAction* action = qobject_cast(sender())) { const QString encoding = action->data().toString(); - QWebSettings::globalSettings()->setDefaultTextEncoding(encoding); +#if QTWEBENGINE_DISABLED + QWebEngineSettings::globalSettings()->setDefaultTextEncoding(encoding); +#endif Settings settings; settings.setValue("Web-Browser-Settings/DefaultEncoding", encoding); @@ -742,8 +757,9 @@ void BrowserWindow::showHistoryManager() 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) { frame = weView()->page()->mainFrame(); } @@ -751,6 +767,7 @@ void BrowserWindow::showSource(QWebFrame* frame, const QString &selectedHtml) SourceViewer* source = new SourceViewer(frame, selectedHtml); QzTools::centerWidgetToParent(source, this); source->show(); +#endif } SideBar* BrowserWindow::addSideBar() @@ -863,12 +880,14 @@ void BrowserWindow::toggleTabsOnTop(bool enable) void BrowserWindow::toggleCaretBrowsing() { +#if QTWEBENGINE_DISABLED #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); - QWebSettings::globalSettings()->setAttribute(QWebSettings::CaretBrowsingEnabled, enable); + QWebEngineSettings::globalSettings()->setAttribute(QWebEngineSettings::CaretBrowsingEnabled, enable); +#endif #endif } @@ -1000,7 +1019,11 @@ void BrowserWindow::createSidebarsMenu(QMenu* menu) void BrowserWindow::createEncodingMenu(QMenu* menu) { +#if QTWEBENGINE_DISABLED const QString activeCodecName = QWebSettings::globalSettings()->defaultTextEncoding(); +#else + const QString activeCodecName = QL1S("UTF-8"); +#endif QStringList isoCodecs, utfCodecs, windowsCodecs, isciiCodecs, otherCodecs; @@ -1193,7 +1216,7 @@ bool BrowserWindow::event(QEvent* event) return QMainWindow::event(event); } -void BrowserWindow::printPage(QWebFrame* frame) +void BrowserWindow::printPage(QWebEngineFrame* frame) { QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this); dialog->setAttribute(Qt::WA_DeleteOnClose); @@ -1206,9 +1229,11 @@ void BrowserWindow::printPage(QWebFrame* frame) connect(dialog, SIGNAL(paintRequested(QPrinter*)), weView(), SLOT(print(QPrinter*))); } else { +#if QTWEBENGINE_DISABLED dialog->printer()->setDocName(QzTools::getFileNameFromUrl(QzTools::frameUrl(frame))); connect(dialog, SIGNAL(paintRequested(QPrinter*)), frame, SLOT(print(QPrinter*))); +#endif } dialog->open(); @@ -1216,8 +1241,10 @@ void BrowserWindow::printPage(QWebFrame* frame) void BrowserWindow::savePageScreen() { +#if QTWEBENGINE_DISABLED PageScreen* dialog = new PageScreen(weView(), this); dialog->show(); +#endif } void BrowserWindow::resizeEvent(QResizeEvent* event) @@ -1409,6 +1436,7 @@ void BrowserWindow::keyPressEvent(QKeyEvent* event) m_tabWidget->setCurrentIndex(number - 1); return; } +#if QTWEBENGINE_DISABLED if (event->modifiers() & Qt::ControlModifier && m_useSpeedDialNumberShortcuts) { const QUrl url = mApp->plugins()->speedDial()->urlForShortcut(number - 1); if (url.isValid()) { @@ -1422,6 +1450,7 @@ void BrowserWindow::keyPressEvent(QKeyEvent* event) if (number == 2) m_tabWidget->nextTab(); } +#endif } QMainWindow::keyPressEvent(event); diff --git a/src/lib/app/browserwindow.h b/src/lib/app/browserwindow.h index abccdfe2b..8301d2caa 100644 --- a/src/lib/app/browserwindow.h +++ b/src/lib/app/browserwindow.h @@ -28,7 +28,7 @@ class QLabel; class QVBoxLayout; class QSplitter; -class QWebFrame; +class QWebEngineFrame; class QTimer; class Menu; @@ -142,8 +142,8 @@ public slots: void bookmarkPage(); void bookmarkAllTabs(); void loadAddress(const QUrl &url); - void showSource(QWebFrame* frame = 0, const QString &selectedHtml = QString()); - void printPage(QWebFrame* frame = 0); + void showSource(QWebEngineFrame* frame = 0, const QString &selectedHtml = QString()); + void printPage(QWebEngineFrame* frame = 0); private slots: void addTab(); diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index f3e67d73d..0d1ebac7b 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -209,6 +209,9 @@ MainApplication::MainApplication(int &argc, char** argv) appId.append(QLatin1String("Portable")); } + // QtWebEngine + appId.append(QL1S("-QtWebEngine")); + // TODO: This should generate some random string for appId if (newInstance) { if (startProfile.isEmpty() || startProfile == QLatin1String("default")) { @@ -516,7 +519,11 @@ QNetworkDiskCache* MainApplication::networkCache() Settings settings; const QString defaultBasePath = QString("%1/networkcache/").arg(DataPaths::currentProfilePath()); 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()); +#else + const QString cachePath = QString("%1/QtWebEngine/").arg(basePath); +#endif m_networkCache = new QNetworkDiskCache(this); m_networkCache->setCacheDirectory(cachePath); @@ -533,6 +540,7 @@ BrowsingLibrary* MainApplication::browsingLibrary() return m_browsingLibrary; } +#if QTWEBENGINE_DISABLED RSSManager* MainApplication::rssManager() { if (!m_rssManager) { @@ -540,11 +548,12 @@ RSSManager* MainApplication::rssManager() } return m_rssManager; } +#endif -NetworkManager* MainApplication::networkManager() +QNetworkAccessManager* MainApplication::networkManager() { if (!m_networkManager) { - m_networkManager = new NetworkManager(this); + m_networkManager = new QNetworkAccessManager(this); } return m_networkManager; } @@ -636,8 +645,10 @@ void MainApplication::startPrivateBrowsing(const QUrl &startUrl) void MainApplication::reloadUserStyleSheet() { +#if QTWEBENGINE_DISABLED const QUrl userCss = userStyleSheet(Settings().value("Web-Browser-Settings/userStyleSheet", QString()).toString()); - QWebSettings::globalSettings()->setUserStyleSheetUrl(userCss); + QWebEngineSettings::globalSettings()->setUserStyleSheetUrl(userCss); +#endif } void MainApplication::restoreOverrideCursor() @@ -690,7 +701,9 @@ void MainApplication::postLaunch() } 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(aboutToQuit()), this, SLOT(saveSettings())); @@ -758,7 +771,6 @@ void MainApplication::saveSettings() } m_searchEnginesManager->saveSettings(); - m_networkManager->saveSettings(); m_plugins->shutdown(); DataPaths::clearTempData(); @@ -854,6 +866,7 @@ void MainApplication::loadSettings() loadTheme(activeTheme); +#if QTWEBENGINE_DISABLED QWebSettings* webSettings = QWebSettings::globalSettings(); // Web browsing settings @@ -915,9 +928,12 @@ void MainApplication::loadSettings() webSettings->setWebGraphic(QWebSettings::DefaultFrameIconGraphic, IconProvider::emptyWebIcon().pixmap(16, 16)); webSettings->setWebGraphic(QWebSettings::MissingImageGraphic, QPixmap()); +#endif if (isPrivate()) { +#if QTWEBENGINE_DISABLED webSettings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); +#endif history()->setSaving(false); } diff --git a/src/lib/app/mainapplication.h b/src/lib/app/mainapplication.h index 23a76dca8..9ace42b86 100644 --- a/src/lib/app/mainapplication.h +++ b/src/lib/app/mainapplication.h @@ -28,6 +28,7 @@ class QMenu; class QNetworkDiskCache; +class QNetworkAccessManager; class History; class AutoFill; @@ -39,7 +40,6 @@ class RSSManager; class ProxyStyle; class PluginProxy; class BrowserWindow; -class NetworkManager; class BrowsingLibrary; class DownloadManager; class UserAgentManager; @@ -92,7 +92,7 @@ public: BrowsingLibrary* browsingLibrary(); RSSManager* rssManager(); - NetworkManager* networkManager(); + QNetworkAccessManager* networkManager(); RestoreManager* restoreManager(); DownloadManager* downloadManager(); UserAgentManager* userAgentManager(); @@ -157,7 +157,7 @@ private: BrowsingLibrary* m_browsingLibrary; RSSManager* m_rssManager; - NetworkManager* m_networkManager; + QNetworkAccessManager* m_networkManager; RestoreManager* m_restoreManager; DownloadManager* m_downloadManager; UserAgentManager* m_userAgentManager; diff --git a/src/lib/app/mainmenu.cpp b/src/lib/app/mainmenu.cpp index 9f2bec06a..fa575015b 100644 --- a/src/lib/app/mainmenu.cpp +++ b/src/lib/app/mainmenu.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #ifdef Q_OS_MAC @@ -303,11 +303,13 @@ void MainMenu::webSearch() void MainMenu::showSiteInfo() { +#if QTWEBENGINE_DISABLED if (m_window) { SiteInfo* info = new SiteInfo(m_window->weView(), m_window); info->setAttribute(Qt::WA_DeleteOnClose); info->show(); } +#endif } void MainMenu::showDownloadManager() @@ -403,8 +405,10 @@ void MainMenu::aboutToShowViewMenu() m_actions[QSL("View/FullScreen")]->setChecked(m_window->isFullScreen()); m_actions[QSL("View/PageSource")]->setEnabled(true); +#if QTWEBENGINE_DISABLED #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 } @@ -421,12 +425,12 @@ void MainMenu::aboutToShowEditMenu() WebView* view = m_window->weView(); - m_actions[QSL("Edit/Undo")]->setEnabled(view->pageAction(QWebPage::Undo)->isEnabled()); - m_actions[QSL("Edit/Redo")]->setEnabled(view->pageAction(QWebPage::Redo)->isEnabled()); - m_actions[QSL("Edit/Cut")]->setEnabled(view->pageAction(QWebPage::Cut)->isEnabled()); - m_actions[QSL("Edit/Copy")]->setEnabled(view->pageAction(QWebPage::Copy)->isEnabled()); - m_actions[QSL("Edit/Paste")]->setEnabled(view->pageAction(QWebPage::Paste)->isEnabled()); - m_actions[QSL("Edit/SelectAll")]->setEnabled(view->pageAction(QWebPage::SelectAll)->isEnabled()); + m_actions[QSL("Edit/Undo")]->setEnabled(view->pageAction(QWebEnginePage::Undo)->isEnabled()); + m_actions[QSL("Edit/Redo")]->setEnabled(view->pageAction(QWebEnginePage::Redo)->isEnabled()); + m_actions[QSL("Edit/Cut")]->setEnabled(view->pageAction(QWebEnginePage::Cut)->isEnabled()); + m_actions[QSL("Edit/Copy")]->setEnabled(view->pageAction(QWebEnginePage::Copy)->isEnabled()); + m_actions[QSL("Edit/Paste")]->setEnabled(view->pageAction(QWebEnginePage::Paste)->isEnabled()); + m_actions[QSL("Edit/SelectAll")]->setEnabled(view->pageAction(QWebEnginePage::SelectAll)->isEnabled()); m_actions[QSL("Edit/Find")]->setEnabled(true); } diff --git a/src/lib/app/profilemanager.cpp b/src/lib/app/profilemanager.cpp index a6441477b..4262bb5cc 100644 --- a/src/lib/app/profilemanager.cpp +++ b/src/lib/app/profilemanager.cpp @@ -132,14 +132,20 @@ QString ProfileManager::currentProfile() const QString ProfileManager::startingProfile() const { +#if QTWEBENGINE_DISABLED QSettings settings(DataPaths::path(DataPaths::Profiles) + QLatin1String("/profiles.ini"), QSettings::IniFormat); return settings.value(QLatin1String("Profiles/startProfile"), QLatin1String("default")).toString(); +#else + return QString("qtwebengine"); +#endif } void ProfileManager::setStartingProfile(const QString &profileName) { +#if QTWEBENGINE_DISABLED QSettings settings(DataPaths::path(DataPaths::Profiles) + QLatin1String("/profiles.ini"), QSettings::IniFormat); settings.setValue(QLatin1String("Profiles/startProfile"), profileName); +#endif } QStringList ProfileManager::availableProfiles() const diff --git a/src/lib/app/qzcommon.h b/src/lib/app/qzcommon.h index 73f861542..8c77dfcc3 100644 --- a/src/lib/app/qzcommon.h +++ b/src/lib/app/qzcommon.h @@ -146,6 +146,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qz::NewTabPositionFlags) #define DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG true #endif +#if QTWEBENGINE_DISABLED #define QTWEBKIT_FROM_2_2 \ (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 \ (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 diff --git a/src/lib/autofill/autofill.cpp b/src/lib/autofill/autofill.cpp index d064e8e7e..efc7aca72 100644 --- a/src/lib/autofill/autofill.cpp +++ b/src/lib/autofill/autofill.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #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 -QVector AutoFill::completeFrame(QWebFrame* frame) +QVector AutoFill::completeFrame(QWebEngineFrame* frame) { bool completed = false; QVector list; @@ -202,12 +201,13 @@ QVector AutoFill::completeFrame(QWebFrame* frame) void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingData) { +#if QTWEBENGINE_DISABLED // Don't save in private browsing if (mApp->isPrivate()) { return; } - QWebFrame* frame = qobject_cast(request.originatingObject()); + QWebEngineFrame* frame = qobject_cast(request.originatingObject()); if (!frame) { return; } @@ -259,6 +259,7 @@ void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingDa AutoFillNotification* aWidget = new AutoFillNotification(frameUrl, formData, updateData); webView->addNotification(aWidget); +#endif } QByteArray AutoFill::exportPasswords() diff --git a/src/lib/autofill/autofill.h b/src/lib/autofill/autofill.h index 42e37a7ab..e45991da8 100644 --- a/src/lib/autofill/autofill.h +++ b/src/lib/autofill/autofill.h @@ -23,7 +23,7 @@ #include "qzcommon.h" class QUrl; -class QWebFrame; +class QWebEngineFrame; class QWebElement; class QNetworkRequest; @@ -61,7 +61,7 @@ public: void removeAllEntries(); void post(const QNetworkRequest &request, const QByteArray &outgoingData); - QVector completeFrame(QWebFrame* frame); + QVector completeFrame(QWebEngineFrame *frame); QByteArray exportPasswords(); bool importPasswords(const QByteArray &data); diff --git a/src/lib/autofill/pageformcompleter.cpp b/src/lib/autofill/pageformcompleter.cpp index 46aa93b1a..fac0127c6 100644 --- a/src/lib/autofill/pageformcompleter.cpp +++ b/src/lib/autofill/pageformcompleter.cpp @@ -18,9 +18,7 @@ #include "pageformcompleter.h" #include "qzregexp.h" -#include -#include -#include +#include #if QT_VERSION >= 0x050000 #include #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; return extractFormData(postData); } -PageFormData PageFormCompleter::extractFormData(QWebFrame* frame, const QByteArray &postData) +PageFormData PageFormCompleter::extractFormData(QWebEngineFrame* frame, const QByteArray &postData) { m_frame = frame; return extractFormData(postData); } -bool PageFormCompleter::completeFormData(QWebPage* page, const QByteArray &data) +bool PageFormCompleter::completeFormData(QWebEnginePage* page, const QByteArray &data) { m_page = page; return completeFormData(data); } -bool PageFormCompleter::completeFormData(QWebFrame* frame, const QByteArray &data) +bool PageFormCompleter::completeFormData(QWebEngineFrame* frame, const QByteArray &data) { m_frame = frame; return completeFormData(data); @@ -73,6 +71,7 @@ PageFormData PageFormCompleter::extractFormData(const QByteArray &postData) cons return formData; } +#if QTWEBENGINE_DISABLED const QWebElementCollection allForms = getAllElementsFromPage("form"); // Find form that contains password value sent in data @@ -109,6 +108,7 @@ PageFormData PageFormCompleter::extractFormData(const QByteArray &postData) cons formData.username = usernameValue; formData.password = passwordValue; +#endif return formData; } @@ -123,6 +123,7 @@ bool PageFormCompleter::completeFormData(const QByteArray &data) const QStringList inputTypes; inputTypes << "text" << "password" << "email"; +#if QTWEBENGINE_DISABLED // Find all input elements in the page const QWebElementCollection inputs = getAllElementsFromPage("input"); @@ -144,6 +145,7 @@ bool PageFormCompleter::completeFormData(const QByteArray &data) const } } } +#endif return completed; } @@ -212,6 +214,7 @@ QByteArray PageFormCompleter::convertWebKitFormBoundaryIfNecessary(const QByteAr PageFormCompleter::QueryItem PageFormCompleter::findUsername(const QWebElement &form) const { +#if QTWEBENGINE_DISABLED // Try to find username (or email) field in the form. QStringList selectors; selectors << "input[type=\"text\"][name*=\"user\"]" @@ -234,6 +237,7 @@ PageFormCompleter::QueryItem PageFormCompleter::findUsername(const QWebElement & } } } +#endif return QueryItem(); } @@ -254,6 +258,7 @@ PageFormCompleter::QueryItems PageFormCompleter::createQueryItems(QByteArray dat return arguments; } +#if QTWEBENGINE_DISABLED QWebElementCollection PageFormCompleter::getAllElementsFromPage(const QString &selector) const { QWebElementCollection list; @@ -280,3 +285,5 @@ QWebElementCollection PageFormCompleter::getAllElementsFromPage(const QString &s return list; } + +#endif diff --git a/src/lib/autofill/pageformcompleter.h b/src/lib/autofill/pageformcompleter.h index 6fafdc538..da28fa3ba 100644 --- a/src/lib/autofill/pageformcompleter.h +++ b/src/lib/autofill/pageformcompleter.h @@ -24,8 +24,8 @@ #include "qzcommon.h" -class QWebPage; -class QWebFrame; +class QWebEnginePage; +class QWebEngineFrame; class QWebElement; class QWebElementCollection; @@ -44,11 +44,11 @@ class QUPZILLA_EXPORT PageFormCompleter public: explicit PageFormCompleter(); - PageFormData extractFormData(QWebPage* page, const QByteArray &postData); - PageFormData extractFormData(QWebFrame* frame, const QByteArray &postData); + PageFormData extractFormData(QWebEnginePage* page, const QByteArray &postData); + PageFormData extractFormData(QWebEngineFrame* frame, const QByteArray &postData); - bool completeFormData(QWebPage* page, const QByteArray &data); - bool completeFormData(QWebFrame* frame, const QByteArray &data); + bool completeFormData(QWebEnginePage* page, const QByteArray &data); + bool completeFormData(QWebEngineFrame* frame, const QByteArray &data); private: typedef QPair QueryItem; @@ -62,10 +62,12 @@ private: QByteArray convertWebKitFormBoundaryIfNecessary(const QByteArray &data) const; QueryItem findUsername(const QWebElement &form) const; QueryItems createQueryItems(QByteArray data) const; +#if QTWEBENGINE_DISABLED QWebElementCollection getAllElementsFromPage(const QString &selector) const; +#endif - QWebPage* m_page; - QWebFrame* m_frame; + QWebEnginePage* m_page; + QWebEngineFrame* m_frame; }; #endif // PAGEFORMCOMPLETER_H diff --git a/src/lib/bookmarks/bookmarksicon.cpp b/src/lib/bookmarks/bookmarksicon.cpp index e5b420052..ee92c43ba 100644 --- a/src/lib/bookmarks/bookmarksicon.cpp +++ b/src/lib/bookmarks/bookmarksicon.cpp @@ -40,7 +40,9 @@ BookmarksIcon::BookmarksIcon(QWidget* parent) connect(mApp->bookmarks(), SIGNAL(bookmarkAdded(BookmarkItem*)), this, SLOT(bookmarksChanged())); connect(mApp->bookmarks(), SIGNAL(bookmarkRemoved(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())); +#endif connect(this, SIGNAL(clicked(QPoint)), this, SLOT(iconClicked())); } @@ -59,7 +61,9 @@ void BookmarksIcon::checkBookmark(const QUrl &url, bool forceCheck) QList items = mApp->bookmarks()->searchBookmarks(url); 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(); } else { diff --git a/src/lib/bookmarks/bookmarkswidget.cpp b/src/lib/bookmarks/bookmarkswidget.cpp index 384f2a825..ced0fbac9 100644 --- a/src/lib/bookmarks/bookmarkswidget.cpp +++ b/src/lib/bookmarks/bookmarkswidget.cpp @@ -50,6 +50,7 @@ BookmarksWidget::~BookmarksWidget() void BookmarksWidget::toggleSpeedDial() { +#if QTWEBENGINE_DISABLED const SpeedDial::Page page = m_speedDial->pageForUrl(m_view->url()); if (page.url.isEmpty()) { @@ -61,6 +62,7 @@ void BookmarksWidget::toggleSpeedDial() } closePopup(); +#endif } void BookmarksWidget::toggleBookmark() @@ -104,6 +106,7 @@ void BookmarksWidget::init() // it dynamically changes and so, it's not good choice for this widget. setLayoutDirection(QApplication::layoutDirection()); +#if QTWEBENGINE_DISABLED // Init SpeedDial button const SpeedDial::Page page = m_speedDial->pageForUrl(m_view->url()); if (page.url.isEmpty()) { @@ -114,6 +117,7 @@ void BookmarksWidget::init() ui->speeddialButton->setFlat(false); ui->speeddialButton->setText(tr("Remove from Speed Dial")); } +#endif // Init Bookmarks button if (m_bookmark) { diff --git a/src/lib/cookies/cookiejar.cpp b/src/lib/cookies/cookiejar.cpp index eefef89c1..012682470 100644 --- a/src/lib/cookies/cookiejar.cpp +++ b/src/lib/cookies/cookiejar.cpp @@ -23,7 +23,7 @@ #include "qztools.h" #include -#include +#include #include //#define COOKIE_DEBUG @@ -56,6 +56,7 @@ void CookieJar::loadSettings() m_blacklist = settings.value("blacklist", QStringList()).toStringList(); settings.endGroup(); +#if QTWEBENGINE_DISABLED #if QTWEBKIT_FROM_2_3 switch (m_allowThirdParty) { case 0: @@ -71,6 +72,7 @@ void CookieJar::loadSettings() break; } #endif +#endif } void CookieJar::setAllowCookies(bool allow) diff --git a/src/lib/downloads/downloadfilehelper.cpp b/src/lib/downloads/downloadfilehelper.cpp index 42a154a7f..446a21daa 100644 --- a/src/lib/downloads/downloadfilehelper.cpp +++ b/src/lib/downloads/downloadfilehelper.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #if QT_VERSION >= 0x050000 diff --git a/src/lib/downloads/downloaditem.cpp b/src/lib/downloads/downloaditem.cpp index 99e2059c3..ae352f21a 100644 --- a/src/lib/downloads/downloaditem.cpp +++ b/src/lib/downloads/downloaditem.cpp @@ -138,6 +138,7 @@ void DownloadItem::startDownloadingFromFtp(const QUrl &url) return; } +#if QTWEBENGINE_DISABLED m_ftpDownloader = new FtpDownloader(this); connect(m_ftpDownloader, SIGNAL(finished()), this, SLOT(finished())); 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) { error(); } +#endif } void DownloadItem::parentResized(const QSize &size) @@ -182,7 +184,7 @@ void DownloadItem::finished() #endif 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->progressBar->hide(); ui->button->hide(); @@ -193,7 +195,9 @@ void DownloadItem::finished() m_reply->deleteLater(); } else { +#if QTWEBENGINE_DISABLED m_ftpDownloader->deleteLater(); +#endif } m_item->setSizeHint(sizeHint()); @@ -327,7 +331,9 @@ void DownloadItem::stop(bool askForDeleteFile) host = m_reply->url().host(); } else if (m_ftpDownloader) { +#if QTWEBENGINE_DISABLED host = m_ftpDownloader->url().host(); +#endif } m_openAfterFinish = false; m_timer.stop(); @@ -335,8 +341,10 @@ void DownloadItem::stop(bool askForDeleteFile) m_reply->abort(); } else if (m_ftpDownloader) { +#if QTWEBENGINE_DISABLED m_ftpDownloader->abort(); m_ftpDownloader->close(); +#endif } QString outputfile = QFileInfo(m_outputFile).absoluteFilePath(); m_outputFile.close(); @@ -455,10 +463,12 @@ void DownloadItem::error() if (m_reply && m_reply->error() != QNetworkReply::NoError) { ui->downloadInfo->setText(tr("Error: ") + m_reply->errorString()); } +#if QTWEBENGINE_DISABLED else if (m_ftpDownloader && m_ftpDownloader->error() != QFtp::NoError) { stop(false); ui->downloadInfo->setText(tr("Error: ") + m_ftpDownloader->errorString()); } +#endif } void DownloadItem::updateDownload() @@ -468,6 +478,7 @@ void DownloadItem::updateDownload() #endif // after caling stop() (from readyRead()) m_reply will be a dangling pointer, // thus it should be checked after m_outputFile.isOpen() +#if QTWEBENGINE_DISABLED if (ui->progressBar->maximum() == 0 && m_outputFile.isOpen() && ((m_reply && m_reply->isFinished()) || (m_ftpDownloader && m_ftpDownloader->isFinished()) @@ -476,6 +487,13 @@ void DownloadItem::updateDownload() downloadProgress(0, 0); finished(); } +#else + if (ui->progressBar->maximum() == 0 && m_outputFile.isOpen() && + ((m_reply && m_reply->isFinished()))) { + downloadProgress(0, 0); + finished(); + } +#endif } DownloadItem::~DownloadItem() diff --git a/src/lib/downloads/downloadmanager.cpp b/src/lib/downloads/downloadmanager.cpp index e6bfbe051..9d00529d1 100644 --- a/src/lib/downloads/downloadmanager.cpp +++ b/src/lib/downloads/downloadmanager.cpp @@ -221,9 +221,12 @@ void DownloadManager::download(const QNetworkRequest &request, const DownloadInf QNetworkRequest req = request; req.setAttribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100), 0); +#if QTWEBENGINE_DISABLED handleUnsupportedContent(m_networkManager->get(req), info); +#endif } +#if QTWEBENGINE_DISABLED void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, const DownloadInfo &info) { if (!info.page || reply->url().scheme() == QLatin1String("qupzilla")) { @@ -247,6 +250,7 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply* reply, const Downl h->setListWidget(ui->list); h->handleUnsupportedContent(reply, info); } +#endif void DownloadManager::itemCreated(QListWidgetItem* item, DownloadItem* downItem) { @@ -349,3 +353,4 @@ DownloadManager::~DownloadManager() { delete ui; } + diff --git a/src/lib/downloads/downloadmanager.h b/src/lib/downloads/downloadmanager.h index bf5de298b..a3f570d4c 100644 --- a/src/lib/downloads/downloadmanager.h +++ b/src/lib/downloads/downloadmanager.h @@ -30,12 +30,12 @@ class DownloadManager; class QNetworkReply; class QNetworkRequest; +class QNetworkAccessManager; class QListWidgetItem; class QUrl; class DownloadItem; class EcWin7; -class NetworkManager; class WebPage; class QUPZILLA_EXPORT DownloadManager : public QWidget @@ -65,7 +65,10 @@ public: void loadSettings(); void download(const QNetworkRequest &request, const DownloadInfo &info); + +#if QTWEBENGINE_DISABLED void handleUnsupportedContent(QNetworkReply* reply, const DownloadInfo &info); +#endif bool canClose(); @@ -107,7 +110,7 @@ private: void keyPressEvent(QKeyEvent* e); Ui::DownloadManager* ui; - NetworkManager* m_networkManager; + QNetworkAccessManager* m_networkManager; QBasicTimer m_timer; QString m_lastDownloadPath; diff --git a/src/lib/history/historymenu.cpp b/src/lib/history/historymenu.cpp index 6ac6b7b2d..bc5de035f 100644 --- a/src/lib/history/historymenu.cpp +++ b/src/lib/history/historymenu.cpp @@ -27,7 +27,7 @@ #include "qzsettings.h" #include -#include +#include #include static QKeySequence actionShortcut(QKeySequence shortcut, QKeySequence fallback, QKeySequence shortcutRTL, QKeySequence fallbackRTL) diff --git a/src/lib/history/webhistoryinterface.cpp b/src/lib/history/webhistoryinterface.cpp index 8ad7818e1..c1540cf4a 100644 --- a/src/lib/history/webhistoryinterface.cpp +++ b/src/lib/history/webhistoryinterface.cpp @@ -19,8 +19,10 @@ #include "mainapplication.h" #include "history.h" +#if QTWEBENGINE_DISABLED + 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(); } + +#endif diff --git a/src/lib/history/webhistoryinterface.h b/src/lib/history/webhistoryinterface.h index 374a257a5..0e305c9aa 100644 --- a/src/lib/history/webhistoryinterface.h +++ b/src/lib/history/webhistoryinterface.h @@ -18,12 +18,13 @@ #ifndef WEBHISTORYINTERFACE_H #define WEBHISTORYINTERFACE_H -#include #include #include "qzcommon.h" -class QUPZILLA_EXPORT WebHistoryInterface : public QWebHistoryInterface +#if QTWEBENGINE_DISABLED + +class QUPZILLA_EXPORT WebHistoryInterface : public QWebEngineHistoryInterface { public: explicit WebHistoryInterface(QObject* parent = 0); @@ -36,4 +37,6 @@ private: }; +#endif + #endif // WEBHISTORYINTERFACE_H diff --git a/src/lib/lib.pro b/src/lib/lib.pro index feefcf6c9..37421098b 100644 --- a/src/lib/lib.pro +++ b/src/lib/lib.pro @@ -1,5 +1,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 { QT += core gui webkit sql network script concurrent } @@ -12,7 +12,9 @@ DEFINES *= QUPZILLA_SHAREDLIBRARY include(../defines.pri) include(../../translations/translations.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) diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index 939445591..d9c8e6987 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -61,7 +61,6 @@ LocationBar::LocationBar(BrowserWindow* window) m_bookmarkIcon = new BookmarksIcon(this); m_goIcon = new GoIcon(this); - m_rssIcon = new RssIcon(this); m_siteIcon = new SiteIcon(m_window, this); m_autofillIcon = new AutoFillIcon(this); DownIcon* down = new DownIcon(this); @@ -69,7 +68,6 @@ LocationBar::LocationBar(BrowserWindow* window) addWidget(m_siteIcon, LineEdit::LeftSide); addWidget(m_autofillIcon, LineEdit::RightSide); addWidget(m_bookmarkIcon, LineEdit::RightSide); - addWidget(m_rssIcon, LineEdit::RightSide); addWidget(m_goIcon, LineEdit::RightSide); addWidget(down, LineEdit::RightSide); @@ -104,7 +102,6 @@ LocationBar::LocationBar(BrowserWindow* window) // Hide icons by default m_goIcon->setVisible(qzSettings->alwaysShowGoIcon); - m_rssIcon->hide(); m_autofillIcon->hide(); QTimer::singleShot(0, this, SLOT(updatePlaceHolderText())); @@ -120,17 +117,18 @@ void LocationBar::setWebView(TabbedWebView* view) m_webView = view; m_bookmarkIcon->setWebView(m_webView); - m_rssIcon->setWebView(m_webView); m_siteIcon->setWebView(m_webView); m_autofillIcon->setWebView(m_webView); connect(m_webView, SIGNAL(loadStarted()), SLOT(loadStarted())); connect(m_webView, SIGNAL(loadProgress(int)), SLOT(loadProgress(int))); 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(rssChanged(bool)), this, SLOT(setRssIconVisible(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) @@ -299,11 +297,9 @@ void LocationBar::setGoIconVisible(bool state) { if (state) { m_bookmarkIcon->hide(); - m_rssIcon->hide(); m_goIcon->show(); } else { - m_rssIcon->setVisible(m_webView && m_webView->hasRss()); m_bookmarkIcon->show(); if (!qzSettings->alwaysShowGoIcon) { @@ -316,8 +312,6 @@ void LocationBar::setGoIconVisible(bool state) void LocationBar::setRssIconVisible(bool state) { - m_rssIcon->setVisible(state); - updateTextMargins(); } diff --git a/src/lib/navigation/navigationbar.cpp b/src/lib/navigation/navigationbar.cpp index 9e6c0a892..7eedf2889 100644 --- a/src/lib/navigation/navigationbar.cpp +++ b/src/lib/navigation/navigationbar.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include @@ -212,13 +212,13 @@ void NavigationBar::aboutToShowHistoryBackMenu() return; } m_menuBack->clear(); - QWebHistory* history = m_window->weView()->history(); + QWebEngineHistory* history = m_window->weView()->history(); int curindex = history->currentItemIndex(); int count = 0; for (int i = curindex - 1; i >= 0; i--) { - QWebHistoryItem item = history->itemAt(i); + QWebEngineHistoryItem item = history->itemAt(i); if (item.isValid()) { QString title = titleForUrl(item.title(), item.url()); @@ -247,12 +247,12 @@ void NavigationBar::aboutToShowHistoryNextMenu() } m_menuForward->clear(); - QWebHistory* history = m_window->weView()->history(); + QWebEngineHistory* history = m_window->weView()->history(); int curindex = history->currentItemIndex(); int count = 0; for (int i = curindex + 1; i < history->count(); i++) { - QWebHistoryItem item = history->itemAt(i); + QWebEngineHistoryItem item = history->itemAt(i); if (item.isValid()) { QString title = titleForUrl(item.title(), item.url()); @@ -276,7 +276,7 @@ void NavigationBar::aboutToShowHistoryNextMenu() void NavigationBar::clearHistory() { - QWebHistory* history = m_window->weView()->page()->history(); + QWebEngineHistory* history = m_window->weView()->page()->history(); history->clear(); refreshHistory(); } @@ -290,7 +290,7 @@ void NavigationBar::contextMenuRequested(const QPoint &pos) void NavigationBar::loadHistoryIndex() { - QWebHistory* history = m_window->weView()->page()->history(); + QWebEngineHistory* history = m_window->weView()->page()->history(); if (QAction* action = qobject_cast(sender())) { loadHistoryItem(history->itemAt(action->data().toInt())); @@ -307,7 +307,7 @@ void NavigationBar::loadHistoryIndexInNewTab(int index) return; } - QWebHistory* history = m_window->weView()->page()->history(); + QWebEngineHistory* history = m_window->weView()->page()->history(); loadHistoryItemInNewTab(history->itemAt(index)); } @@ -317,7 +317,7 @@ void NavigationBar::refreshHistory() return; } - QWebHistory* history = m_window->weView()->page()->history(); + QWebEngineHistory* history = m_window->weView()->page()->history(); m_buttonBack->setEnabled(history->canGoBack()); m_buttonForward->setEnabled(history->canGoForward()); } @@ -334,13 +334,13 @@ void NavigationBar::reload() void NavigationBar::goBack() { - QWebHistory* history = m_window->weView()->page()->history(); + QWebEngineHistory* history = m_window->weView()->page()->history(); history->back(); } void NavigationBar::goBackInNewTab() { - QWebHistory* history = m_window->weView()->page()->history(); + QWebEngineHistory* history = m_window->weView()->page()->history(); if (!history->canGoBack()) { return; @@ -351,13 +351,13 @@ void NavigationBar::goBackInNewTab() void NavigationBar::goForward() { - QWebHistory* history = m_window->weView()->page()->history(); + QWebEngineHistory* history = m_window->weView()->page()->history(); history->forward(); } void NavigationBar::goForwardInNewTab() { - QWebHistory* history = m_window->weView()->page()->history(); + QWebEngineHistory* history = m_window->weView()->page()->history(); if (!history->canGoForward()) { return; @@ -387,19 +387,19 @@ QIcon NavigationBar::iconForPage(const QUrl &url, const QIcon &sIcon) return icon; } -void NavigationBar::loadHistoryItem(const QWebHistoryItem &item) +void NavigationBar::loadHistoryItem(const QWebEngineHistoryItem &item) { m_window->weView()->page()->history()->goToItem(item); refreshHistory(); } -void NavigationBar::loadHistoryItemInNewTab(const QWebHistoryItem &item) +void NavigationBar::loadHistoryItemInNewTab(const QWebEngineHistoryItem &item) { TabWidget* tabWidget = m_window->tabWidget(); 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); if (qzSettings->newTabPosition == Qz::NT_SelectedTab) { diff --git a/src/lib/navigation/navigationbar.h b/src/lib/navigation/navigationbar.h index ba3c171e0..ec6b4f3ae 100644 --- a/src/lib/navigation/navigationbar.h +++ b/src/lib/navigation/navigationbar.h @@ -24,7 +24,7 @@ class QHBoxLayout; class QSplitter; -class QWebHistoryItem; +class QWebEngineHistoryItem; class ToolButton; class WebSearchBar; @@ -90,8 +90,8 @@ private: QString titleForUrl(QString title, const QUrl &url); QIcon iconForPage(const QUrl &url, const QIcon &sIcon); - void loadHistoryItem(const QWebHistoryItem &item); - void loadHistoryItemInNewTab(const QWebHistoryItem &item); + void loadHistoryItem(const QWebEngineHistoryItem &item); + void loadHistoryItemInNewTab(const QWebEngineHistoryItem &item); BrowserWindow* m_window; diff --git a/src/lib/navigation/websearchbar.cpp b/src/lib/navigation/websearchbar.cpp index 9680ac2de..45c2e6a7f 100644 --- a/src/lib/navigation/websearchbar.cpp +++ b/src/lib/navigation/websearchbar.cpp @@ -36,7 +36,9 @@ #include #include #include -#include +#if QTWEBENGINE_DISABLED +#include +#endif #include #include @@ -217,8 +219,10 @@ void WebSearchBar::searchInNewTab() void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu) { + Q_UNUSED(menu) +#if QTWEBENGINE_DISABLED WebView* view = m_window->weView(); - QWebFrame* frame = view->page()->mainFrame(); + QWebEngineFrame* frame = view->page()->mainFrame(); QWebElementCollection elements = frame->documentElement().findAll(QLatin1String("link[rel=search]")); 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); } +#endif } void WebSearchBar::addEngineFromAction() diff --git a/src/lib/network/cabundleupdater.cpp b/src/lib/network/cabundleupdater.cpp index e8dcc707b..12469e354 100644 --- a/src/lib/network/cabundleupdater.cpp +++ b/src/lib/network/cabundleupdater.cpp @@ -27,6 +27,8 @@ #include #include +#if QTWEBENGINE_DISABLED + CaBundleUpdater::CaBundleUpdater(NetworkManager* manager, QObject* parent) : QObject(parent) , m_manager(manager) @@ -146,3 +148,5 @@ void CaBundleUpdater::replyFinished() mApp->networkManager()->loadSettings(); } } + +#endif diff --git a/src/lib/network/cabundleupdater.h b/src/lib/network/cabundleupdater.h index 4d6295da5..d40c59233 100644 --- a/src/lib/network/cabundleupdater.h +++ b/src/lib/network/cabundleupdater.h @@ -18,6 +18,8 @@ #ifndef CABUNDLEUPDATER_H #define CABUNDLEUPDATER_H +#if QTWEBENGINE_DISABLED + #include #include "qzcommon.h" @@ -54,4 +56,6 @@ private: int m_latestBundleVersion; }; +#endif + #endif // CABUNDLEUPDATER_H diff --git a/src/lib/network/networkmanager.cpp b/src/lib/network/networkmanager.cpp index 649728917..a5e69ef16 100644 --- a/src/lib/network/networkmanager.cpp +++ b/src/lib/network/networkmanager.cpp @@ -54,6 +54,8 @@ #include #include +#if QTWEBENGINE_DISABLED + static QString fileNameForCert(const QSslCertificate &cert) { QString certFileName = CertificateInfoWidget::certificateItemText(cert); @@ -74,8 +76,6 @@ NetworkManager::NetworkManager(QObject* parent) , m_ignoreAllWarnings(false) , 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)), this, SLOT(sslError(QNetworkReply*,QList))); 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 - QWebFrame* frame = qobject_cast(reply->request().originatingObject()); + QWebEngineFrame* frame = qobject_cast(reply->request().originatingObject()); if (frame) { WebPage* page = qobject_cast(frame->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 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) { if (op == PostOperation && outgoingData) { @@ -775,3 +718,5 @@ void NetworkManager::loadCertificates() new CaBundleUpdater(this, this); #endif } + +#endif diff --git a/src/lib/network/networkmanager.h b/src/lib/network/networkmanager.h index d84add6cb..3881a27cc 100644 --- a/src/lib/network/networkmanager.h +++ b/src/lib/network/networkmanager.h @@ -18,6 +18,8 @@ #ifndef NETWORKMANAGER_H #define NETWORKMANAGER_H +#if QTWEBENGINE_DISABLED + #include #include @@ -64,9 +66,7 @@ signals: void sslDialogClosed(); private slots: - void authentication(QNetworkReply* reply, QAuthenticator* auth); void ftpAuthentication(const QUrl &url, QAuthenticator* auth); - void proxyAuthentication(const QNetworkProxy &proxy, QAuthenticator* auth); void sslError(QNetworkReply* reply, QList errors); void setSSLConfiguration(QNetworkReply* reply); @@ -90,4 +90,6 @@ private: bool m_sendReferer; }; +#endif + #endif // NETWORKMANAGER_H diff --git a/src/lib/network/networkmanagerproxy.cpp b/src/lib/network/networkmanagerproxy.cpp index 5bcab6f86..dfeeafbf8 100644 --- a/src/lib/network/networkmanagerproxy.cpp +++ b/src/lib/network/networkmanagerproxy.cpp @@ -23,6 +23,8 @@ #include +#if QTWEBENGINE_DISABLED + NetworkManagerProxy::NetworkManagerProxy(QObject* parent) : QNetworkAccessManager(parent) , m_page(0) @@ -57,3 +59,5 @@ QNetworkReply* NetworkManagerProxy::createRequest(QNetworkAccessManager::Operati return QNetworkAccessManager::createRequest(op, request, outgoingData); } + +#endif diff --git a/src/lib/network/networkmanagerproxy.h b/src/lib/network/networkmanagerproxy.h index b7c543733..a23085ca3 100644 --- a/src/lib/network/networkmanagerproxy.h +++ b/src/lib/network/networkmanagerproxy.h @@ -18,6 +18,8 @@ #ifndef NETWORKMANAGERPROXY_H #define NETWORKMANAGERPROXY_H +#if QTWEBENGINE_DISABLED + #include #include "qzcommon.h" @@ -40,4 +42,6 @@ private: NetworkManager* m_manager; }; +#endif + #endif // NETWORKMANAGERPROXY_H diff --git a/src/lib/network/schemehandlers/ftpschemehandler.cpp b/src/lib/network/schemehandlers/ftpschemehandler.cpp index 0f6b6ee82..07a51f65a 100644 --- a/src/lib/network/schemehandlers/ftpschemehandler.cpp +++ b/src/lib/network/schemehandlers/ftpschemehandler.cpp @@ -22,6 +22,7 @@ #include "iconprovider.h" #include "mainapplication.h" +#if QTWEBENGINE_DISABLED #include #include #include @@ -576,3 +577,5 @@ void FtpDownloader::onDone(bool err) emit finished(); } } + +#endif diff --git a/src/lib/network/schemehandlers/ftpschemehandler.h b/src/lib/network/schemehandlers/ftpschemehandler.h index 61df777a6..d953fb6e5 100644 --- a/src/lib/network/schemehandlers/ftpschemehandler.h +++ b/src/lib/network/schemehandlers/ftpschemehandler.h @@ -24,6 +24,8 @@ #include #include +#if QTWEBENGINE_DISABLED + #if QT_VERSION >= 0x050000 #include "qftp.h" #include "qurlinfo.h" @@ -128,4 +130,6 @@ signals: void finished(); void errorOccured(QFtp::Error); }; +#endif + #endif // FTPSCHEMEHANDLER_H diff --git a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp index c66fede23..7ddb372d2 100644 --- a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp +++ b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp @@ -28,6 +28,8 @@ #include "datapaths.h" #include "iconprovider.h" +#if QTWEBENGINE_DISABLED + #include #include #include @@ -36,7 +38,7 @@ #if QT_VERSION < 0x050000 #include "qwebkitversion.h" #else -#include +#include #endif static QString authorString(const char* name, const QString &mail) @@ -499,3 +501,5 @@ QString QupZillaSchemeReply::configPage() return page; } + +#endif diff --git a/src/lib/network/schemehandlers/qupzillaschemehandler.h b/src/lib/network/schemehandlers/qupzillaschemehandler.h index d78b26588..be847d6a2 100644 --- a/src/lib/network/schemehandlers/qupzillaschemehandler.h +++ b/src/lib/network/schemehandlers/qupzillaschemehandler.h @@ -21,6 +21,8 @@ #include #include +#if QTWEBENGINE_DISABLED + #include "schemehandler.h" #include "qzcommon.h" @@ -60,4 +62,6 @@ private: QString m_pageName; }; +#endif + #endif // QUPZILLASCHEMEHANDLER_H diff --git a/src/lib/opensearch/searchenginesmanager.cpp b/src/lib/opensearch/searchenginesmanager.cpp index 8f9281ce7..7725cba1e 100644 --- a/src/lib/opensearch/searchenginesmanager.cpp +++ b/src/lib/opensearch/searchenginesmanager.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -261,6 +260,7 @@ void SearchEnginesManager::addEngine(const Engine &engine) void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView* view) { +#if QTWEBENGINE_DISABLED QWebElement formElement = element.parent(); while (!formElement.isNull()) { @@ -362,6 +362,7 @@ void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView } addEngine(engine); +#endif } void SearchEnginesManager::addEngine(OpenSearchEngine* engine) diff --git a/src/lib/other/aboutdialog.cpp b/src/lib/other/aboutdialog.cpp index 8bdc1a2fa..8864b7198 100644 --- a/src/lib/other/aboutdialog.cpp +++ b/src/lib/other/aboutdialog.cpp @@ -26,7 +26,7 @@ #if QT_VERSION < 0x050000 #include "qwebkitversion.h" #else -#include +#include #endif AboutDialog::AboutDialog(QWidget* parent) @@ -75,11 +75,15 @@ void AboutDialog::showAbout() Qz::VERSION #endif ); +#if QTWEBENGINE_DISABLED m_aboutHtml += tr("WebKit version %1

").arg(qWebKitVersion()); +#endif m_aboutHtml += QString("

© %1 %2
").arg(Qz::COPYRIGHT, Qz::AUTHOR); m_aboutHtml += tr("Build time: %1

").arg(Qz::BUILDTIME); m_aboutHtml += QString("

%1

").arg(Qz::WWWADDRESS); +#if QTWEBENGINE_DISABLED m_aboutHtml += "

" + (mApp->windowCount() > 0 ? mApp->getWindow()->weView()->page()->userAgentForUrl(QUrl()) : QString()) + "

"; +#endif m_aboutHtml += ""; } ui->textBrowser->setHtml(m_aboutHtml); diff --git a/src/lib/other/browsinglibrary.cpp b/src/lib/other/browsinglibrary.cpp index 0dd3e9cbd..b069b9d4a 100644 --- a/src/lib/other/browsinglibrary.cpp +++ b/src/lib/other/browsinglibrary.cpp @@ -34,7 +34,6 @@ BrowsingLibrary::BrowsingLibrary(BrowserWindow* window, QWidget* parent) , ui(new Ui::BrowsingLibrary) , m_historyManager(new HistoryManager(window)) , m_bookmarksManager(new BookmarksManager(window)) - , m_rssManager(mApp->rssManager()) , m_rssLoaded(false) { 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_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->setFocus(); @@ -79,7 +77,6 @@ void BrowsingLibrary::currentIndexChanged(int index) case 2: if (!m_rssLoaded) { - m_rssManager->refreshTable(); m_rssLoaded = true; } ui->searchLine->hide(); @@ -134,6 +131,7 @@ void BrowsingLibrary::showBookmarks(BrowserWindow* window) void BrowsingLibrary::showRSS(BrowserWindow* window) { +#if QTWEBENGINE_DISABLED ui->tabs->SetCurrentIndex(2); show(); m_rssManager->setMainWindow(window); @@ -145,6 +143,7 @@ void BrowsingLibrary::showRSS(BrowserWindow* window) raise(); activateWindow(); +#endif } void BrowsingLibrary::closeEvent(QCloseEvent* e) @@ -155,10 +154,6 @@ void BrowsingLibrary::closeEvent(QCloseEvent* e) settings.setValue("historyState", m_historyManager->saveState()); settings.endGroup(); e->accept(); - - // Saves a few megabytes - m_rssManager->deleteAllTabs(); - m_rssLoaded = false; } void BrowsingLibrary::keyPressEvent(QKeyEvent* e) diff --git a/src/lib/other/clearprivatedata.cpp b/src/lib/other/clearprivatedata.cpp index e4b562d6c..85709242d 100644 --- a/src/lib/other/clearprivatedata.cpp +++ b/src/lib/other/clearprivatedata.cpp @@ -33,8 +33,10 @@ #include #include +#if QTWEBENGINE_DISABLED #include -#include +#endif +#include #include #include #include @@ -78,21 +80,27 @@ void ClearPrivateData::clearWebDatabases() { const QString profile = DataPaths::currentProfilePath(); +#if QTWEBENGINE_DISABLED QWebDatabase::removeAllDatabases(); +#endif QzTools::removeDir(profile + "/Databases"); } void ClearPrivateData::clearCache() { mApp->networkCache()->clear(); - QWebSettings::globalSettings()->clearMemoryCaches(); +#if QTWEBENGINE_DISABLED + QWebEngineSettings::globalSettings()->clearMemoryCaches(); +#endif QFile::remove(DataPaths::currentProfilePath() + "/ApplicationCache.db"); } void ClearPrivateData::clearIcons() { - QWebSettings::globalSettings()->clearIconDatabase(); +#if QTWEBENGINE_DISABLED + QWebEngineSettings::globalSettings()->clearIconDatabase(); +#endif IconProvider::instance()->clearIconsDatabase(); } diff --git a/src/lib/other/macmenureceiver.cpp b/src/lib/other/macmenureceiver.cpp index 7cec754c9..feeb14389 100644 --- a/src/lib/other/macmenureceiver.cpp +++ b/src/lib/other/macmenureceiver.cpp @@ -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() @@ -341,9 +341,9 @@ void MacMenuReceiver::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() diff --git a/src/lib/other/macmenureceiver.h b/src/lib/other/macmenureceiver.h index 219639fe5..12c5f9837 100644 --- a/src/lib/other/macmenureceiver.h +++ b/src/lib/other/macmenureceiver.h @@ -23,7 +23,7 @@ #include "qzcommon.h" -class QWebFrame; +class QWebEngineFrame; class Menu; class QMenu; class QAction; @@ -127,9 +127,9 @@ private slots: void closeWindow(); void quitApp(); - void printPage(QWebFrame* frame = 0); + void printPage(QWebEngineFrame* frame = 0); void showBookmarksToolbar(); - void showSource(QWebFrame* frame = 0, const QString &selectedHtml = QString()); + void showSource(QWebEngineFrame* frame = 0, const QString &selectedHtml = QString()); void bookmarkPage(); void showPageInfo(); void showWebInspector(bool toggle = true); diff --git a/src/lib/other/pagescreen.cpp b/src/lib/other/pagescreen.cpp index ee2480cd4..f833f6e48 100644 --- a/src/lib/other/pagescreen.cpp +++ b/src/lib/other/pagescreen.cpp @@ -23,9 +23,11 @@ #include "browserwindow.h" #include "settings.h" +#if QTWEBENGINE_DISABLED + #include #include -#include +#include #include #include #include @@ -191,7 +193,7 @@ void PageScreen::saveAsDocument(const QString &format) void PageScreen::createThumbnail() { - QWebPage* page = m_view->page(); + QWebEnginePage* page = m_view->page(); const int heightLimit = 20000; const QPoint originalScrollPosition = page->mainFrame()->scrollPosition(); @@ -275,3 +277,5 @@ PageScreen::~PageScreen() { delete ui; } + +#endif diff --git a/src/lib/other/pagescreen.h b/src/lib/other/pagescreen.h index 11a8c8b03..6c2b17ef2 100644 --- a/src/lib/other/pagescreen.h +++ b/src/lib/other/pagescreen.h @@ -23,6 +23,8 @@ #include "qzcommon.h" +#if QTWEBENGINE_DISABLED + namespace Ui { class PageScreen; @@ -63,4 +65,6 @@ private: QStringList m_formats; }; +#endif + #endif // PAGESCREEN_H diff --git a/src/lib/other/siteinfo.cpp b/src/lib/other/siteinfo.cpp index 3555d977c..06c19e345 100644 --- a/src/lib/other/siteinfo.cpp +++ b/src/lib/other/siteinfo.cpp @@ -26,11 +26,13 @@ #include "qztools.h" #include "iconprovider.h" +#if QTWEBENGINE_DISABLED + #include #include #include #include -#include +#include #include #include #include @@ -66,7 +68,7 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent) ui->listWidget->item(0)->setSelected(true); WebPage* webPage = view->page(); - QWebFrame* frame = view->page()->mainFrame(); + QWebEngineFrame* frame = view->page()->mainFrame(); QString title = view->title(); QSslCertificate cert = webPage->sslCertificate(); m_baseUrl = frame->baseUrl(); @@ -103,7 +105,7 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent) ui->treeTags->addTopLevelItem(item); } if (encoding.isEmpty()) { - encoding = QWebSettings::globalSettings()->defaultTextEncoding(); + encoding = QWebEngineSettings::globalSettings()->defaultTextEncoding(); } ui->encodingLabel->setText(encoding.toUpper()); @@ -298,3 +300,5 @@ SiteInfo::~SiteInfo() delete ui; delete m_certWidget; } + +#endif diff --git a/src/lib/other/siteinfo.h b/src/lib/other/siteinfo.h index 95e88c8e9..f1b862674 100644 --- a/src/lib/other/siteinfo.h +++ b/src/lib/other/siteinfo.h @@ -23,6 +23,8 @@ #include #include +#if QTWEBENGINE_DISABLED + namespace Ui { class SiteInfo; @@ -62,4 +64,6 @@ private: QUrl m_baseUrl; }; +#endif + #endif // SITEINFO_H diff --git a/src/lib/other/sourceviewer.cpp b/src/lib/other/sourceviewer.cpp index 2a305267a..c1da8e848 100644 --- a/src/lib/other/sourceviewer.cpp +++ b/src/lib/other/sourceviewer.cpp @@ -29,10 +29,11 @@ #include #include #include -#include #include -SourceViewer::SourceViewer(QWebFrame* frame, const QString &selectedHtml) +#if QTWEBENGINE_DISABLED + +SourceViewer::SourceViewer(QWebEngineFrame* frame, const QString &selectedHtml) : QWidget(0) , m_frame(frame) , m_selectedHtml(selectedHtml) @@ -231,3 +232,5 @@ void SourceViewer::goToLine() m_sourceEdit->goToLine(line); } + +#endif diff --git a/src/lib/other/sourceviewer.h b/src/lib/other/sourceviewer.h index 903b33505..a0c38687d 100644 --- a/src/lib/other/sourceviewer.h +++ b/src/lib/other/sourceviewer.h @@ -18,6 +18,8 @@ #ifndef SOURCEVIEWER_H #define SOURCEVIEWER_H +#if QTWEBENGINE_DISABLED + #include #include @@ -27,13 +29,13 @@ class PlainEditWithLines; class QBoxLayout; class QStatusBar; -class QWebFrame; +class QWebEngineFrame; class QUPZILLA_EXPORT SourceViewer : public QWidget { Q_OBJECT public: - explicit SourceViewer(QWebFrame* frame, const QString &selectedHtml); + explicit SourceViewer(QWebEngineFrame* frame, const QString &selectedHtml); PlainEditWithLines* sourceEdit() { return m_sourceEdit; } private slots: @@ -54,7 +56,7 @@ private slots: private: QBoxLayout* m_layout; PlainEditWithLines* m_sourceEdit; - QPointer m_frame; + QPointer m_frame; QStatusBar* m_statusBar; QString m_selectedHtml; @@ -66,4 +68,6 @@ private: QAction* m_actionPaste; }; +#endif + #endif // SOURCEVIEWER_H diff --git a/src/lib/other/sourceviewersearch.cpp b/src/lib/other/sourceviewersearch.cpp index ec3d96eb8..a6c3d54fe 100644 --- a/src/lib/other/sourceviewersearch.cpp +++ b/src/lib/other/sourceviewersearch.cpp @@ -24,6 +24,8 @@ #include #include +#if QTWEBENGINE_DISABLED + SourceViewerSearch::SourceViewerSearch(SourceViewer* parent) : AnimatedWidget(AnimatedWidget::Up) , m_sourceViewer(parent) @@ -132,3 +134,5 @@ bool SourceViewerSearch::eventFilter(QObject* obj, QEvent* event) return AnimatedWidget::eventFilter(obj, event); } + +#endif diff --git a/src/lib/other/sourceviewersearch.h b/src/lib/other/sourceviewersearch.h index 818c7fec2..b5e489ebc 100644 --- a/src/lib/other/sourceviewersearch.h +++ b/src/lib/other/sourceviewersearch.h @@ -23,6 +23,8 @@ #include "qzcommon.h" #include "animatedwidget.h" +#if QTWEBENGINE_DISABLED + namespace Ui { class SourceViewerSearch; @@ -59,4 +61,6 @@ private: QTextDocument::FindFlags m_findFlags; }; +#endif + #endif // SOURCEVIEWERSEARCH_H diff --git a/src/lib/other/statusbarmessage.cpp b/src/lib/other/statusbarmessage.cpp index 9e93c35b0..4e217f731 100644 --- a/src/lib/other/statusbarmessage.cpp +++ b/src/lib/other/statusbarmessage.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include TipLabel::TipLabel(QWidget* parent) @@ -125,18 +124,22 @@ void StatusBarMessage::showMessage(const QString &message) else { #endif WebView* view = m_window->weView(); - QWebFrame* mainFrame = view->page()->mainFrame(); +#if QTWEBENGINE_DISABLED + QWebEngineFrame* mainFrame = view->page()->mainFrame(); +#endif int horizontalScrollSize = 0; int verticalScrollSize = 0; const int scrollbarSize = m_window->style()->pixelMetric(QStyle::PM_ScrollBarExtent); +#if QTWEBENGINE_DISABLED if (mainFrame->scrollBarMaximum(Qt::Horizontal)) { horizontalScrollSize = scrollbarSize; } if (mainFrame->scrollBarMaximum(Qt::Vertical)) { verticalScrollSize = scrollbarSize; } +#endif m_statusBarText->setText(message); m_statusBarText->setMaximumWidth(view->width() - verticalScrollSize); diff --git a/src/lib/other/useragentmanager.cpp b/src/lib/other/useragentmanager.cpp index 97b243f81..2143855a1 100644 --- a/src/lib/other/useragentmanager.cpp +++ b/src/lib/other/useragentmanager.cpp @@ -20,7 +20,7 @@ #include "qztools.h" #include "settings.h" -#include // QTWEBKIT_VERSION_CHECK macro +#include // QTWEBKIT_VERSION_CHECK macro UserAgentManager::UserAgentManager(QObject* parent) : QObject(parent) diff --git a/src/lib/plugins/clicktoflash.cpp b/src/lib/plugins/clicktoflash.cpp index 9b957a7d9..2a3b5db0c 100644 --- a/src/lib/plugins/clicktoflash.cpp +++ b/src/lib/plugins/clicktoflash.cpp @@ -51,8 +51,10 @@ #include #include #include -#include +#include #include + +#if QTWEBENGINE_DISABLED #include QUrl ClickToFlash::acceptedUrl; @@ -152,9 +154,9 @@ void ClickToFlash::findElement() } QWidget* parent = parentWidget(); - QWebView* view = 0; + QWebEngineView* view = 0; while (parent) { - if (QWebView* aView = qobject_cast(parent)) { + if (QWebEngineView* aView = qobject_cast(parent)) { view = aView; break; } @@ -165,7 +167,7 @@ void ClickToFlash::findElement() } QPoint objectPos = view->mapFromGlobal(m_toolButton->mapToGlobal(m_toolButton->pos())); - QWebFrame* objectFrame = view->page()->frameAt(objectPos); + QWebEngineFrame* objectFrame = view->page()->frameAt(objectPos); QWebHitTestResult hitResult; QWebElement hitElement; @@ -183,12 +185,12 @@ void ClickToFlash::findElement() // HitTestResult failed, trying to find element by src // attribute in elements at all frames on page (less accurate) - QList frames; + QList frames; frames.append(objectFrame); frames.append(view->page()->mainFrame()); while (!frames.isEmpty()) { - QWebFrame* frame = frames.takeFirst(); + QWebEngineFrame* frame = frames.takeFirst(); if (!frame) { continue; } @@ -320,3 +322,5 @@ void ClickToFlash::showInfo() QzTools::centerWidgetToParent(widg, m_page->view()); widg->show(); } + +#endif diff --git a/src/lib/plugins/clicktoflash.h b/src/lib/plugins/clicktoflash.h index ea5a7b79d..93af13ba9 100644 --- a/src/lib/plugins/clicktoflash.h +++ b/src/lib/plugins/clicktoflash.h @@ -42,6 +42,8 @@ #ifndef CLICKTOFLASH_H #define CLICKTOFLASH_H +#if QTWEBENGINE_DISABLED + #include "qzcommon.h" // Qt Includes @@ -98,5 +100,7 @@ private: WebPage* m_page; }; +#endif + #endif // CLICKTOFLASH_H diff --git a/src/lib/plugins/plugininterface.h b/src/lib/plugins/plugininterface.h index 4e3beb85f..3aeb76433 100644 --- a/src/lib/plugins/plugininterface.h +++ b/src/lib/plugins/plugininterface.h @@ -21,7 +21,11 @@ #include #include #include +#if QTWEBENGINE_DISABLED #include +#endif + +#include #include "qzcommon.h" diff --git a/src/lib/plugins/plugins.cpp b/src/lib/plugins/plugins.cpp index 7aaaa6345..f32ac5e87 100644 --- a/src/lib/plugins/plugins.cpp +++ b/src/lib/plugins/plugins.cpp @@ -29,7 +29,7 @@ Plugins::Plugins(QObject* parent) : QObject(parent) , m_pluginsLoaded(false) - , m_speedDial(new SpeedDial(this)) + //, m_speedDial(new SpeedDial(this)) { loadSettings(); } diff --git a/src/lib/plugins/speeddial.cpp b/src/lib/plugins/speeddial.cpp index 9dd9035f8..e0cbaac99 100644 --- a/src/lib/plugins/speeddial.cpp +++ b/src/lib/plugins/speeddial.cpp @@ -22,11 +22,13 @@ #include "qztools.h" #include "autosaver.h" +#if QTWEBENGINE_DISABLED + #include #include #include -#include -#include +#include +#include #include #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()); } -void SpeedDial::addWebFrame(QWebFrame* frame) +void SpeedDial::addWebFrame(QWebEngineFrame* frame) { if (!m_webFrames.contains(frame)) { m_webFrames.append(frame); @@ -146,8 +148,8 @@ void SpeedDial::addPage(const QUrl &url, const QString &title) m_webPages.append(page); m_regenerateScript = true; - foreach (QWebFrame* frame, cleanFrames()) { - frame->page()->triggerAction(QWebPage::Reload); + foreach (QWebEngineFrame* frame, cleanFrames()) { + frame->page()->triggerAction(QWebEnginePage::Reload); } emit pagesChanged(); @@ -165,8 +167,8 @@ void SpeedDial::removePage(const Page &page) m_webPages.removeAll(page); m_regenerateScript = true; - foreach (QWebFrame* frame, cleanFrames()) { - frame->page()->triggerAction(QWebPage::Reload); + foreach (QWebEngineFrame* frame, cleanFrames()) { + frame->page()->triggerAction(QWebEnginePage::Reload); } emit pagesChanged(); @@ -361,7 +363,7 @@ void SpeedDial::thumbnailCreated(const QPixmap &pixmap) m_regenerateScript = true; cleanFrames(); - foreach (QWebFrame* frame, cleanFrames()) { + foreach (QWebEngineFrame* frame, cleanFrames()) { frame->evaluateJavaScript(QString("setImageToUrl('%1', '%2');").arg(escapeUrl(url), escapeTitle(fileName))); if (loadTitle) { frame->evaluateJavaScript(QString("setTitleToUrl('%1', '%2');").arg(escapeUrl(url), escapeTitle(title))); @@ -413,3 +415,5 @@ QString SpeedDial::generateAllPages() return allPages; } + +#endif diff --git a/src/lib/plugins/speeddial.h b/src/lib/plugins/speeddial.h index e641cb43e..5ff258c14 100644 --- a/src/lib/plugins/speeddial.h +++ b/src/lib/plugins/speeddial.h @@ -18,13 +18,15 @@ #ifndef SPEEDDIAL_H #define SPEEDDIAL_H +#if QTWEBENGINE_DISABLED + #include #include #include "qzcommon.h" class QUrl; -class QWebFrame; +class QWebEngineFrame; class QPixmap; class AutoSaver; @@ -52,7 +54,7 @@ public: Page pageForUrl(const QUrl &url); QUrl urlForShortcut(int key); - void addWebFrame(QWebFrame* frame); + void addWebFrame(QWebEngineFrame* frame); void addPage(const QUrl &url, const QString &title); void removePage(const Page &page); @@ -88,7 +90,7 @@ private: QString escapeTitle(QString string) const; QString escapeUrl(QString url) const; - QList cleanFrames(); + QList cleanFrames(); QString generateAllPages(); QString m_initialScript; @@ -107,4 +109,6 @@ private: bool m_regenerateScript; }; +#endif + #endif // SPEEDDIAL_H diff --git a/src/lib/popupwindow/popuplocationbar.cpp b/src/lib/popupwindow/popuplocationbar.cpp index 5a4286c90..c16db2853 100644 --- a/src/lib/popupwindow/popuplocationbar.cpp +++ b/src/lib/popupwindow/popuplocationbar.cpp @@ -55,7 +55,6 @@ PopupLocationBar::PopupLocationBar(QWidget* parent) m_siteIcon->setFixedSize(26, 26); m_bookmarkIcon = new BookmarksIcon(this); - m_rssIcon = new RssIcon(this); m_autofillIcon = new AutoFillIcon(this); m_loadingAnimation = new QLabel(this); @@ -69,7 +68,6 @@ PopupLocationBar::PopupLocationBar(QWidget* parent) addWidget(m_siteIcon, LineEdit::LeftSide); addWidget(m_autofillIcon, LineEdit::RightSide); addWidget(m_bookmarkIcon, LineEdit::RightSide); - addWidget(m_rssIcon, LineEdit::RightSide); addWidget(m_loadingAnimation, LineEdit::RightSide); addWidget(rightSpacer, LineEdit::RightSide); setLeftMargin(20); @@ -78,7 +76,6 @@ PopupLocationBar::PopupLocationBar(QWidget* parent) setReadOnly(true); // Hide icons by default - m_rssIcon->hide(); m_autofillIcon->hide(); } @@ -87,7 +84,6 @@ void PopupLocationBar::setView(PopupWebView* view) m_view = view; m_bookmarkIcon->setWebView(m_view); - m_rssIcon->setWebView(m_view); m_autofillIcon->setWebView(m_view); connect(m_view, SIGNAL(rssChanged(bool)), this, SLOT(showRSSIcon(bool))); @@ -133,7 +129,5 @@ void PopupLocationBar::showSiteIcon() void PopupLocationBar::showRSSIcon(bool state) { - m_rssIcon->setVisible(state); - updateTextMargins(); } diff --git a/src/lib/popupwindow/popupstatusbarmessage.cpp b/src/lib/popupwindow/popupstatusbarmessage.cpp index 214197ca6..1f1d28057 100644 --- a/src/lib/popupwindow/popupstatusbarmessage.cpp +++ b/src/lib/popupwindow/popupstatusbarmessage.cpp @@ -24,7 +24,6 @@ #include #include -#include PopupStatusBarMessage::PopupStatusBarMessage(PopupWindow* window) : m_popupWindow(window) @@ -43,18 +42,22 @@ void PopupStatusBarMessage::showMessage(const QString &message) else { #endif PopupWebView* view = m_popupWindow->webView(); - QWebFrame* mainFrame = view->page()->mainFrame(); +#if QTWEBENGINE_DISABLED + QWebEngineFrame* mainFrame = view->page()->mainFrame(); +#endif int horizontalScrollSize = 0; int verticalScrollSize = 0; const int scrollbarSize = m_popupWindow->style()->pixelMetric(QStyle::PM_ScrollBarExtent); +#if QTWEBENGINE_DISABLED if (mainFrame->scrollBarMaximum(Qt::Horizontal)) { horizontalScrollSize = scrollbarSize; } if (mainFrame->scrollBarMaximum(Qt::Vertical)) { verticalScrollSize = scrollbarSize; } +#endif m_statusBarText->setText(message); m_statusBarText->setMaximumWidth(view->width() - verticalScrollSize); diff --git a/src/lib/popupwindow/popupwebpage.cpp b/src/lib/popupwindow/popupwebpage.cpp index 81a0ccb01..b3d579dcb 100644 --- a/src/lib/popupwindow/popupwebpage.cpp +++ b/src/lib/popupwindow/popupwebpage.cpp @@ -31,7 +31,7 @@ // // Got an idea how to determine it from kWebKitPart. -PopupWebPage::PopupWebPage(QWebPage::WebWindowType type, BrowserWindow* window) +PopupWebPage::PopupWebPage(QWebEnginePage::WebWindowType type, BrowserWindow* window) : WebPage() , m_window(window) , m_type(type) @@ -43,9 +43,11 @@ PopupWebPage::PopupWebPage(QWebPage::WebWindowType type, BrowserWindow* window) , m_progress(0) { connect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect))); +#if QTWEBENGINE_DISABLED connect(this, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(slotMenuBarVisibilityChangeRequested(bool))); connect(this, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(slotToolBarVisibilityChangeRequested(bool))); connect(this, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(slotStatusBarVisibilityChangeRequested(bool))); +#endif connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted())); connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); diff --git a/src/lib/popupwindow/popupwebpage.h b/src/lib/popupwindow/popupwebpage.h index 1e3957c83..9d982c036 100644 --- a/src/lib/popupwindow/popupwebpage.h +++ b/src/lib/popupwindow/popupwebpage.h @@ -45,7 +45,7 @@ private slots: private: BrowserWindow* m_window; - QWebPage::WebWindowType m_type; + QWebEnginePage::WebWindowType m_type; bool m_createNewWindow; bool m_menuBarVisible; diff --git a/src/lib/popupwindow/popupwebview.cpp b/src/lib/popupwindow/popupwebview.cpp index 356179247..f7401586d 100644 --- a/src/lib/popupwindow/popupwebview.cpp +++ b/src/lib/popupwindow/popupwebview.cpp @@ -25,7 +25,6 @@ #include "enhancedmenu.h" #include "loadrequest.h" -#include #include PopupWebView::PopupWebView(QWidget* parent) @@ -94,13 +93,16 @@ void PopupWebView::closeView() void PopupWebView::inspectElement() { - triggerPageAction(QWebPage::InspectElement); +#if QTWEBENGINE_DISABLED + triggerPageAction(QWebEnginePage::InspectElement); +#endif } void PopupWebView::contextMenuEvent(QContextMenuEvent* event) { m_menu->clear(); +#if QTWEBENGINE_DISABLED const QWebHitTestResult hitTest = page()->mainFrame()->hitTestContent(event->pos()); createContextMenu(m_menu, hitTest, event->pos()); @@ -115,6 +117,7 @@ void PopupWebView::contextMenuEvent(QContextMenuEvent* event) m_menu->popup(p); return; } +#endif WebView::contextMenuEvent(event); } diff --git a/src/lib/popupwindow/popupwindow.cpp b/src/lib/popupwindow/popupwindow.cpp index 5b7a3b1bd..034e91c19 100644 --- a/src/lib/popupwindow/popupwindow.cpp +++ b/src/lib/popupwindow/popupwindow.cpp @@ -28,7 +28,6 @@ #include #include -#include #include #include @@ -67,14 +66,14 @@ PopupWindow::PopupWindow(PopupWebView* view) m_menuBar->addMenu(menuFile); m_menuEdit = new QMenu(tr("Edit")); - m_menuEdit->addAction(m_view->pageAction(QWebPage::Undo)); - m_menuEdit->addAction(m_view->pageAction(QWebPage::Redo)); + m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::Undo)); + m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::Redo)); m_menuEdit->addSeparator(); - m_menuEdit->addAction(m_view->pageAction(QWebPage::Cut)); - m_menuEdit->addAction(m_view->pageAction(QWebPage::Copy)); - m_menuEdit->addAction(m_view->pageAction(QWebPage::Paste)); + m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::Cut)); + m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::Copy)); + m_menuEdit->addAction(m_view->pageAction(QWebEnginePage::Paste)); 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_menuBar->addMenu(m_menuEdit); @@ -125,9 +124,11 @@ PopupWindow::PopupWindow(PopupWebView* view) titleChanged(); QUrl urlToShow = m_view->url(); +#if QTWEBENGINE_DISABLED if (urlToShow.isEmpty()) { urlToShow = m_view->page()->mainFrame()->requestedUrl(); } +#endif m_locationBar->showUrl(urlToShow); @@ -212,8 +213,10 @@ void PopupWindow::closeEvent(QCloseEvent* event) void PopupWindow::savePageScreen() { +#if QTWEBENGINE_DISABLED PageScreen* pageScreen = new PageScreen(m_view, this); pageScreen->show(); +#endif } void PopupWindow::searchOnPage() diff --git a/src/lib/preferences/jsoptions.cpp b/src/lib/preferences/jsoptions.cpp index 00b5cb4a1..6d5817e8a 100644 --- a/src/lib/preferences/jsoptions.cpp +++ b/src/lib/preferences/jsoptions.cpp @@ -21,7 +21,7 @@ #include "mainapplication.h" #include "settings.h" -#include // QTWEBKIT_VERSION_CHECK macro +#include // QTWEBKIT_VERSION_CHECK macro #include JsOptions::JsOptions(QWidget* parent) diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index 2abaf2b17..f72fbe04e 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -364,18 +364,19 @@ Preferences::Preferences(BrowserWindow* window, QWidget* parent) //FONTS settings.beginGroup("Browser-Fonts"); - QWebSettings* webSettings = QWebSettings::globalSettings(); - ui->fontStandard->setCurrentFont(QFont(settings.value("StandardFont", webSettings->fontFamily(QWebSettings::StandardFont)).toString())); - ui->fontCursive->setCurrentFont(QFont(settings.value("CursiveFont", webSettings->fontFamily(QWebSettings::CursiveFont)).toString())); - ui->fontFantasy->setCurrentFont(QFont(settings.value("FantasyFont", webSettings->fontFamily(QWebSettings::FantasyFont)).toString())); - ui->fontFixed->setCurrentFont(QFont(settings.value("FixedFont", webSettings->fontFamily(QWebSettings::FixedFont)).toString())); - ui->fontSansSerif->setCurrentFont(QFont(settings.value("SansSerifFont", webSettings->fontFamily(QWebSettings::SansSerifFont)).toString())); - ui->fontSerif->setCurrentFont(QFont(settings.value("SerifFont", webSettings->fontFamily(QWebSettings::SerifFont)).toString())); - - ui->sizeDefault->setValue(settings.value("DefaultFontSize", webSettings->fontSize(QWebSettings::DefaultFontSize)).toInt()); - ui->sizeFixed->setValue(settings.value("FixedFontSize", webSettings->fontSize(QWebSettings::DefaultFixedFontSize)).toInt()); - ui->sizeMinimum->setValue(settings.value("MinimumFontSize", webSettings->fontSize(QWebSettings::MinimumFontSize)).toInt()); - ui->sizeMinimumLogical->setValue(settings.value("MinimumLogicalFontSize", webSettings->fontSize(QWebSettings::MinimumLogicalFontSize)).toInt()); +#if QTWEBENGINE_DISABLED + QWebEngineSettings* webSettings = QWebEngineSettings::globalSettings(); + ui->fontStandard->setCurrentFont(QFont(settings.value("StandardFont", webSettings->fontFamily(QWebEngineSettings::StandardFont)).toString())); + ui->fontCursive->setCurrentFont(QFont(settings.value("CursiveFont", webSettings->fontFamily(QWebEngineSettings::CursiveFont)).toString())); + ui->fontFantasy->setCurrentFont(QFont(settings.value("FantasyFont", webSettings->fontFamily(QWebEngineSettings::FantasyFont)).toString())); + ui->fontFixed->setCurrentFont(QFont(settings.value("FixedFont", webSettings->fontFamily(QWebEngineSettings::FixedFont)).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(QWebEngineSettings::DefaultFontSize)).toInt()); + ui->sizeFixed->setValue(settings.value("FixedFontSize", webSettings->fontSize(QWebEngineSettings::DefaultFixedFontSize)).toInt()); + ui->sizeMinimum->setValue(settings.value("MinimumFontSize", webSettings->fontSize(QWebEngineSettings::MinimumFontSize)).toInt()); + ui->sizeMinimumLogical->setValue(settings.value("MinimumLogicalFontSize", webSettings->fontSize(QWebEngineSettings::MinimumLogicalFontSize)).toInt()); +#endif settings.endGroup(); //KEYBOARD SHORTCUTS @@ -780,7 +781,9 @@ void Preferences::changeCachePathClicked() void Preferences::reloadPacFileClicked() { +#if QTWEBENGINE_DISABLED mApp->networkManager()->proxyFactory()->pacManager()->downloadPacFile(); +#endif } void Preferences::showPassManager(bool state) @@ -1110,7 +1113,9 @@ void Preferences::saveSettings() mApp->history()->loadSettings(); mApp->reloadSettings(); mApp->plugins()->c2f_saveSettings(); +#if QTWEBENGINE_DISABLED mApp->networkManager()->loadSettings(); +#endif mApp->desktopNotifications()->loadSettings(); mApp->autoFill()->loadSettings(); } diff --git a/src/lib/preferences/sslmanager.cpp b/src/lib/preferences/sslmanager.cpp index 17638ba93..a1afb77d6 100644 --- a/src/lib/preferences/sslmanager.cpp +++ b/src/lib/preferences/sslmanager.cpp @@ -56,8 +56,10 @@ SSLManager::SSLManager(QWidget* parent) connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close())); // Settings +#if QTWEBENGINE_DISABLED ui->disableWeakCiphers->setChecked(mApp->networkManager()->isDisablingWeakCiphers()); ui->ignoreAll->setChecked(mApp->networkManager()->isIgnoringAllWarnings()); +#endif } void SSLManager::addPath() @@ -98,6 +100,7 @@ void SSLManager::refreshCAList() void SSLManager::refreshLocalList() { +#if QTWEBENGINE_DISABLED ui->localList->setUpdatesEnabled(false); ui->localList->clear(); m_localCerts = mApp->networkManager()->getLocalCertificates(); @@ -111,13 +114,16 @@ void SSLManager::refreshLocalList() ui->localList->setCurrentRow(0); ui->localList->setUpdatesEnabled(true); +#endif } void SSLManager::refreshPaths() { +#if QTWEBENGINE_DISABLED foreach (const QString &path, mApp->networkManager()->certificatePaths()) { ui->pathList->addItem(path); } +#endif } void SSLManager::showCaCertInfo() @@ -133,6 +139,7 @@ void SSLManager::showCaCertInfo() void SSLManager::addLocalCertificate() { +#if QTWEBENGINE_DISABLED const QString path = QzTools::getOpenFileName("SSLManager-AddLocalCert", this, tr("Import certificate..."), QDir::homePath(), "*.crt"); if (path.isEmpty()) { @@ -147,6 +154,7 @@ void SSLManager::addLocalCertificate() mApp->networkManager()->addLocalCertificate(list.at(0)); refreshLocalList(); +#endif } void SSLManager::showLocalCertInfo() @@ -179,6 +187,7 @@ void SSLManager::showCertificateInfo(const QSslCertificate &cert) void SSLManager::deleteCertificate() { +#if QTWEBENGINE_DISABLED QListWidgetItem* item = ui->localList->currentItem(); if (!item) { return; @@ -188,20 +197,26 @@ void SSLManager::deleteCertificate() m_localCerts.removeOne(cert); mApp->networkManager()->removeLocalCertificate(cert); refreshLocalList(); +#endif } void SSLManager::ignoreAll(bool state) { +#if QTWEBENGINE_DISABLED mApp->networkManager()->setIgnoreAllWarnings(state); +#endif } void SSLManager::disableWeakCiphers(bool state) { +#if QTWEBENGINE_DISABLED mApp->networkManager()->setDisableWeakCiphers(state); +#endif } void SSLManager::closeEvent(QCloseEvent* e) { +#if QTWEBENGINE_DISABLED QStringList paths; for (int i = 0; i < ui->pathList->count(); i++) { QListWidgetItem* item = ui->pathList->item(i); @@ -214,6 +229,7 @@ void SSLManager::closeEvent(QCloseEvent* e) mApp->networkManager()->setCertificatePaths(paths); mApp->networkManager()->saveSettings(); +#endif QWidget::closeEvent(e); } diff --git a/src/lib/rss/rssicon.cpp b/src/lib/rss/rssicon.cpp index 51239764c..72a0ddcc3 100644 --- a/src/lib/rss/rssicon.cpp +++ b/src/lib/rss/rssicon.cpp @@ -20,6 +20,8 @@ #include +#if QTWEBENGINE_DISABLED + RssIcon::RssIcon(QWidget* parent) : ClickableLabel(parent) , m_view(0) @@ -60,3 +62,5 @@ void RssIcon::mousePressEvent(QMouseEvent* ev) // Prevent propagating to LocationBar ev->accept(); } + +#endif diff --git a/src/lib/rss/rssicon.h b/src/lib/rss/rssicon.h index d08d45b26..5460b4aa8 100644 --- a/src/lib/rss/rssicon.h +++ b/src/lib/rss/rssicon.h @@ -21,6 +21,8 @@ #include "qzcommon.h" #include "clickablelabel.h" +#if QTWEBENGINE_DISABLED + class WebView; class QUPZILLA_EXPORT RssIcon : public ClickableLabel @@ -41,4 +43,6 @@ private: WebView* m_view; }; +#endif + #endif // RSSICON_H diff --git a/src/lib/rss/rssmanager.cpp b/src/lib/rss/rssmanager.cpp index 3bcb87694..3ed26fec8 100644 --- a/src/lib/rss/rssmanager.cpp +++ b/src/lib/rss/rssmanager.cpp @@ -32,12 +32,14 @@ #include #include #include -#include +#include #include #include #include #include +#if QTWEBENGINE_DISABLED + RSSManager::RSSManager(BrowserWindow* window, QWidget* parent) : QWidget(parent) , ui(new Ui::RSSManager) @@ -423,3 +425,5 @@ RSSManager::~RSSManager() { delete ui; } + +#endif diff --git a/src/lib/rss/rssmanager.h b/src/lib/rss/rssmanager.h index 3aedc53a4..42cc6c533 100644 --- a/src/lib/rss/rssmanager.h +++ b/src/lib/rss/rssmanager.h @@ -30,6 +30,8 @@ #include #include +#if QTWEBENGINE_DISABLED + namespace Ui { class RSSManager; @@ -77,4 +79,6 @@ private: QPointer m_window; }; +#endif + #endif // RSSMANAGER_H diff --git a/src/lib/rss/rssnotification.cpp b/src/lib/rss/rssnotification.cpp index 1fb8fde60..f33bb26f9 100644 --- a/src/lib/rss/rssnotification.cpp +++ b/src/lib/rss/rssnotification.cpp @@ -30,6 +30,8 @@ #include #include +#if QTWEBENGINE_DISABLED + RSSNotification::RSSNotification(const QString &title, const QUrl &url, WebView* parent) : AnimatedWidget(AnimatedWidget::Down, 300, parent) , ui(new Ui::RSSNotification) @@ -185,3 +187,5 @@ RSSNotification::~RSSNotification() { delete ui; } + +#endif diff --git a/src/lib/rss/rssnotification.h b/src/lib/rss/rssnotification.h index d4b3e259d..93984a56d 100644 --- a/src/lib/rss/rssnotification.h +++ b/src/lib/rss/rssnotification.h @@ -25,6 +25,8 @@ #include "qzcommon.h" #include "animatedwidget.h" +#if QTWEBENGINE_DISABLED + class WebView; namespace Ui @@ -65,4 +67,6 @@ private: QVector m_rssApps; }; +#endif + #endif // RSSNOTIFICATION_H diff --git a/src/lib/rss/rsswidget.cpp b/src/lib/rss/rsswidget.cpp index 84d8479e5..f16562ac6 100644 --- a/src/lib/rss/rsswidget.cpp +++ b/src/lib/rss/rsswidget.cpp @@ -23,9 +23,11 @@ #include "rssmanager.h" #include "rssnotification.h" +#if QTWEBENGINE_DISABLED + #include #include -#include +#include #include RSSWidget::RSSWidget(WebView* view, QWidget* parent) @@ -35,7 +37,7 @@ RSSWidget::RSSWidget(WebView* view, QWidget* parent) { ui->setupUi(this); - QWebFrame* frame = m_view->page()->mainFrame(); + QWebEngineFrame* frame = m_view->page()->mainFrame(); 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 @@ -133,3 +135,5 @@ RSSWidget::~RSSWidget() { delete ui; } + +#endif diff --git a/src/lib/rss/rsswidget.h b/src/lib/rss/rsswidget.h index 2b3ba6811..c782ac1df 100644 --- a/src/lib/rss/rsswidget.h +++ b/src/lib/rss/rsswidget.h @@ -18,6 +18,8 @@ #ifndef RSSWIDGET_H #define RSSWIDGET_H +#if QTWEBENGINE_DISABLED + #include #include "qzcommon.h" @@ -47,4 +49,6 @@ private: WebView* m_view; }; +#endif + #endif // RSSWIDGET_H diff --git a/src/lib/tabwidget/tabicon.cpp b/src/lib/tabwidget/tabicon.cpp index 9345c8bfd..26c880c99 100644 --- a/src/lib/tabwidget/tabicon.cpp +++ b/src/lib/tabwidget/tabicon.cpp @@ -50,7 +50,9 @@ void TabIcon::setWebTab(WebTab* tab) connect(m_tab->webView(), SIGNAL(loadStarted()), this, SLOT(showLoadingAnimation())); connect(m_tab->webView(), SIGNAL(loadFinished(bool)), this, SLOT(hideLoadingAnimation())); +#if QTWEBENGINE_DISABLED connect(m_tab->webView(), SIGNAL(iconChanged()), this, SLOT(showIcon())); +#endif showIcon(); } diff --git a/src/lib/tabwidget/tabwidget.cpp b/src/lib/tabwidget/tabwidget.cpp index efc5c7350..927437b86 100644 --- a/src/lib/tabwidget/tabwidget.cpp +++ b/src/lib/tabwidget/tabwidget.cpp @@ -37,8 +37,7 @@ #include #include #include -#include -#include +#include #include 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(); } +#if QTWEBENGINE_DISABLED if (openFlags & Qz::NT_NotSelectedTab) { 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 if (currentWebTab && 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()); } } +#endif // Make sure user notice opening new background tabs if (!(openFlags & Qz::NT_SelectedTab)) { diff --git a/src/lib/tools/closedtabsmanager.cpp b/src/lib/tools/closedtabsmanager.cpp index 7ffc8f885..5662c8145 100644 --- a/src/lib/tools/closedtabsmanager.cpp +++ b/src/lib/tools/closedtabsmanager.cpp @@ -20,8 +20,8 @@ #include "qztools.h" #include "mainapplication.h" -#include -#include +#include +#include ClosedTabsManager::ClosedTabsManager() { diff --git a/src/lib/tools/html5permissions/html5permissionsmanager.cpp b/src/lib/tools/html5permissions/html5permissionsmanager.cpp index fa991c6d1..6f369f6c0 100644 --- a/src/lib/tools/html5permissions/html5permissionsmanager.cpp +++ b/src/lib/tools/html5permissions/html5permissionsmanager.cpp @@ -20,7 +20,6 @@ #include "settings.h" #include "webview.h" -#include HTML5PermissionsManager::HTML5PermissionsManager(QObject* parent) : QObject(parent) @@ -28,8 +27,8 @@ HTML5PermissionsManager::HTML5PermissionsManager(QObject* parent) loadSettings(); } -#if QTWEBKIT_FROM_2_2 -void HTML5PermissionsManager::requestPermissions(WebPage* page, QWebFrame* frame, const QWebPage::Feature &feature) +#if QTWEBENGINE_DISABLED +void HTML5PermissionsManager::requestPermissions(WebPage* page, QWebEngineFrame* frame, const QWebEnginePage::Feature &feature) { if (!frame || !page) { return; @@ -39,14 +38,14 @@ void HTML5PermissionsManager::requestPermissions(WebPage* page, QWebFrame* frame WebView* view = qobject_cast(page->view()); switch (feature) { - case QWebPage::Notifications: + case QWebEnginePage::Notifications: if (m_notificationsGranted.contains(host)) { - page->setFeaturePermission(frame, feature, QWebPage::PermissionGrantedByUser); + page->setFeaturePermission(frame, feature, QWebEnginePage::PermissionGrantedByUser); return; } if (m_notificationsDenied.contains(host)) { - page->setFeaturePermission(frame, feature, QWebPage::PermissionDeniedByUser); + page->setFeaturePermission(frame, feature, QWebEnginePage::PermissionDeniedByUser); return; } @@ -57,14 +56,14 @@ void HTML5PermissionsManager::requestPermissions(WebPage* page, QWebFrame* frame break; - case QWebPage::Geolocation: + case QWebEnginePage::Geolocation: if (m_geolocationGranted.contains(host)) { - page->setFeaturePermission(frame, feature, QWebPage::PermissionGrantedByUser); + page->setFeaturePermission(frame, feature, QWebEnginePage::PermissionGrantedByUser); return; } if (m_geolocationDenied.contains(host)) { - page->setFeaturePermission(frame, feature, QWebPage::PermissionDeniedByUser); + page->setFeaturePermission(frame, feature, QWebEnginePage::PermissionDeniedByUser); return; } @@ -81,16 +80,16 @@ void HTML5PermissionsManager::requestPermissions(WebPage* page, QWebFrame* frame } } -void HTML5PermissionsManager::rememberPermissions(const QString &host, const QWebPage::Feature &feature, - const QWebPage::PermissionPolicy &policy) +void HTML5PermissionsManager::rememberPermissions(const QString &host, const QWebEnginePage::Feature &feature, + const QWebEnginePage::PermissionPolicy &policy) { if (host.isEmpty()) { return; } switch (feature) { - case QWebPage::Notifications: - if (policy == QWebPage::PermissionGrantedByUser) { + case QWebEnginePage::Notifications: + if (policy == QWebEnginePage::PermissionGrantedByUser) { m_notificationsGranted.append(host); } else { @@ -98,8 +97,8 @@ void HTML5PermissionsManager::rememberPermissions(const QString &host, const QWe } break; - case QWebPage::Geolocation: - if (policy == QWebPage::PermissionGrantedByUser) { + case QWebEnginePage::Geolocation: + if (policy == QWebEnginePage::PermissionGrantedByUser) { m_geolocationGranted.append(host); } else { @@ -141,3 +140,4 @@ void HTML5PermissionsManager::saveSettings() void HTML5PermissionsManager::showSettingsDialog() { } + diff --git a/src/lib/tools/html5permissions/html5permissionsmanager.h b/src/lib/tools/html5permissions/html5permissionsmanager.h index 074113dfd..1e14fe933 100644 --- a/src/lib/tools/html5permissions/html5permissionsmanager.h +++ b/src/lib/tools/html5permissions/html5permissionsmanager.h @@ -32,10 +32,10 @@ class QUPZILLA_EXPORT HTML5PermissionsManager : public QObject public: explicit HTML5PermissionsManager(QObject* parent); -#if QTWEBKIT_FROM_2_2 - void requestPermissions(WebPage* page, QWebFrame* frame, const QWebPage::Feature &feature); - void rememberPermissions(const QString &host, const QWebPage::Feature &feature, - const QWebPage::PermissionPolicy &policy); +#if QTWEBENGINE_DISABLED + void requestPermissions(WebPage* page, QWebEngineFrame* frame, const QWebEnginePage::Feature &feature); + void rememberPermissions(const QString &host, const QWebEnginePage::Feature &feature, + const QWebEnginePage::PermissionPolicy &policy); #endif void loadSettings(); diff --git a/src/lib/tools/html5permissions/html5permissionsnotification.cpp b/src/lib/tools/html5permissions/html5permissionsnotification.cpp index 4ada1fb26..a8954d4af 100644 --- a/src/lib/tools/html5permissions/html5permissionsnotification.cpp +++ b/src/lib/tools/html5permissions/html5permissionsnotification.cpp @@ -21,10 +21,11 @@ #include "mainapplication.h" #include "iconprovider.h" -#include +#if QTWEBENGINE_DISABLED +#include #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) , ui(new Ui::HTML5PermissionsNotification) , m_host(host) @@ -39,11 +40,11 @@ HTML5PermissionsNotification::HTML5PermissionsNotification(const QString &host, QString message; QString site = m_host.isEmpty() ? tr("this site") : QString("%1").arg(m_host); - if (feature == QWebPage::Notifications) { + if (feature == QWebEnginePage::Notifications) { ui->iconLabel->setPixmap(QPixmap(":icons/other/notification.png")); 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")); message = tr("Allow %1 to locate your position?").arg(site); } @@ -63,11 +64,11 @@ void HTML5PermissionsNotification::grantPermissions() return; } - QWebPage* page = m_frame->page(); - page->setFeaturePermission(m_frame, m_feature, QWebPage::PermissionGrantedByUser); + QWebEnginePage* page = m_frame->page(); + page->setFeaturePermission(m_frame, m_feature, QWebEnginePage::PermissionGrantedByUser); if (ui->remember->isChecked()) { - mApp->html5PermissionsManager()->rememberPermissions(m_host, m_feature, QWebPage::PermissionGrantedByUser); + mApp->html5PermissionsManager()->rememberPermissions(m_host, m_feature, QWebEnginePage::PermissionGrantedByUser); } hide(); @@ -79,11 +80,11 @@ void HTML5PermissionsNotification::denyPermissions() return; } - QWebPage* page = m_frame->page(); - page->setFeaturePermission(m_frame, m_feature, QWebPage::PermissionDeniedByUser); + QWebEnginePage* page = m_frame->page(); + page->setFeaturePermission(m_frame, m_feature, QWebEnginePage::PermissionDeniedByUser); if (ui->remember->isChecked()) { - mApp->html5PermissionsManager()->rememberPermissions(m_host, m_feature, QWebPage::PermissionDeniedByUser); + mApp->html5PermissionsManager()->rememberPermissions(m_host, m_feature, QWebEnginePage::PermissionDeniedByUser); } hide(); @@ -94,3 +95,5 @@ HTML5PermissionsNotification::~HTML5PermissionsNotification() delete ui; } #endif // USE_QTWEBKIT_2_2 + +#endif diff --git a/src/lib/tools/html5permissions/html5permissionsnotification.h b/src/lib/tools/html5permissions/html5permissionsnotification.h index 2a04ddcbf..7cd4944d5 100644 --- a/src/lib/tools/html5permissions/html5permissionsnotification.h +++ b/src/lib/tools/html5permissions/html5permissionsnotification.h @@ -34,7 +34,7 @@ class HTML5PermissionsNotification : public AnimatedWidget #ifdef USE_QTWEBKIT_2_2 public: - explicit HTML5PermissionsNotification(const QString &host, QWebFrame* frame, const QWebPage::Feature &feature); + explicit HTML5PermissionsNotification(const QString &host, QWebEngineFrame* frame, const QWebEnginePage::Feature &feature); ~HTML5PermissionsNotification(); private slots: @@ -45,8 +45,8 @@ private: Ui::HTML5PermissionsNotification* ui; QString m_host; - QWebFrame* m_frame; - QWebPage::Feature m_feature; + QWebEngineFrame* m_frame; + QWebEnginePage::Feature m_feature; #endif }; diff --git a/src/lib/tools/pagethumbnailer.cpp b/src/lib/tools/pagethumbnailer.cpp index 4beda479e..d7573c45e 100644 --- a/src/lib/tools/pagethumbnailer.cpp +++ b/src/lib/tools/pagethumbnailer.cpp @@ -19,8 +19,10 @@ #include "mainapplication.h" #include "networkmanagerproxy.h" -#include -#include +#if QTWEBENGINE_DISABLED + +#include +#include #include CleanPluginFactory::CleanPluginFactory(QObject* parent) @@ -45,7 +47,7 @@ QObject* CleanPluginFactory::create(const QString &mimeType, const QUrl &url, co PageThumbnailer::PageThumbnailer(QObject* parent) : QObject(parent) - , m_page(new QWebPage(this)) + , m_page(new QWebEnginePage(this)) , m_size(QSize(450, 253)) , m_loadTitle(false) { @@ -129,7 +131,7 @@ void PageThumbnailer::createThumbnail(bool status) QPainter painter(&pixmap); painter.scale(scalingFactor, scalingFactor); - m_page->mainFrame()->render(&painter, QWebFrame::ContentsLayer); + m_page->mainFrame()->render(&painter, QWebEngineFrame::ContentsLayer); painter.end(); emit thumbnailCreated(pixmap.scaled(m_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); @@ -139,3 +141,5 @@ PageThumbnailer::~PageThumbnailer() { m_page->deleteLater(); } + +#endif diff --git a/src/lib/tools/pagethumbnailer.h b/src/lib/tools/pagethumbnailer.h index c5417059c..d48c11a39 100644 --- a/src/lib/tools/pagethumbnailer.h +++ b/src/lib/tools/pagethumbnailer.h @@ -18,6 +18,8 @@ #ifndef PAGETHUMBNAILER_H #define PAGETHUMBNAILER_H +#if QTWEBENGINE_DISABLED + #include #include #include @@ -25,7 +27,7 @@ #include "qzcommon.h" -class QWebPage; +class QWebEnginePage; class QPixmap; class QUPZILLA_EXPORT CleanPluginFactory : public QWebPluginFactory @@ -67,7 +69,7 @@ private slots: void createThumbnail(bool status); private: - QWebPage* m_page; + QWebEnginePage* m_page; QSize m_size; QUrl m_url; @@ -75,4 +77,6 @@ private: bool m_loadTitle; }; +#endif + #endif // PAGETHUMBNAILER_H diff --git a/src/lib/tools/qztools.cpp b/src/lib/tools/qztools.cpp index 88842f6d5..0cec6c392 100644 --- a/src/lib/tools/qztools.cpp +++ b/src/lib/tools/qztools.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #if QT_VERSION >= 0x050000 #include @@ -216,9 +215,13 @@ QString QzTools::escapeSqlString(QString urlString) return urlString; } -QUrl QzTools::frameUrl(QWebFrame* frame) +QUrl QzTools::frameUrl(QWebEngineFrame* frame) { +#if QTWEBENGINE_DISABLED return frame->url().isEmpty() ? frame->baseUrl() : frame->url(); +#else + return QUrl(); +#endif } QString QzTools::ensureUniqueFilename(const QString &name, const QString &appendFormat) diff --git a/src/lib/tools/qztools.h b/src/lib/tools/qztools.h index 1d4bd282f..ed3d7c854 100644 --- a/src/lib/tools/qztools.h +++ b/src/lib/tools/qztools.h @@ -24,7 +24,7 @@ class QSslCertificate; class QFontMetrics; -class QWebFrame; +class QWebEngineFrame; class QPixmap; class QIcon; class QWidget; @@ -49,7 +49,7 @@ public: static QString urlEncodeQueryString(const QUrl &url); static QString fromPunycode(const QString &str); 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 getFileNameFromUrl(const QUrl &url); diff --git a/src/lib/webkit/javascript/externaljsobject.cpp b/src/lib/webkit/javascript/externaljsobject.cpp index adca53625..0000b5c56 100644 --- a/src/lib/webkit/javascript/externaljsobject.cpp +++ b/src/lib/webkit/javascript/externaljsobject.cpp @@ -40,7 +40,11 @@ int ExternalJsObject::IsSearchProviderInstalled(const QString &engineURL) QObject* ExternalJsObject::speedDial() const { +#if QTWEBENGINE_DISABLED return m_onSpeedDial ? mApp->plugins()->speedDial() : 0; +#else + return 0; +#endif } void ExternalJsObject::setOnSpeedDial(bool on) diff --git a/src/lib/webkit/loadrequest.cpp b/src/lib/webkit/loadrequest.cpp index d717f9f7f..19c9336af 100644 --- a/src/lib/webkit/loadrequest.cpp +++ b/src/lib/webkit/loadrequest.cpp @@ -17,7 +17,7 @@ * ============================================================ */ #include "loadrequest.h" -#include +#include LoadRequest::LoadRequest() : m_operation(GetOperation) diff --git a/src/lib/webkit/webinspector.cpp b/src/lib/webkit/webinspector.cpp index c62a41562..6514bc2f2 100644 --- a/src/lib/webkit/webinspector.cpp +++ b/src/lib/webkit/webinspector.cpp @@ -19,6 +19,8 @@ #include "toolbutton.h" #include "iconprovider.h" +#if QTWEBENGINE_DISABLED + #include WebInspector::WebInspector(QWidget* parent) @@ -68,3 +70,5 @@ void WebInspector::resizeEvent(QResizeEvent* event) QTimer::singleShot(0, this, SLOT(updateCloseButton())); } + +#endif diff --git a/src/lib/webkit/webinspector.h b/src/lib/webkit/webinspector.h index 301fc470e..9ef8eb63f 100644 --- a/src/lib/webkit/webinspector.h +++ b/src/lib/webkit/webinspector.h @@ -18,6 +18,7 @@ #ifndef WEBINSPECTORDOCKWIDGET_H #define WEBINSPECTORDOCKWIDGET_H +#if QTWEBENGINE_DISABLED #include #include "qzcommon.h" @@ -42,5 +43,6 @@ private: ToolButton* m_closeButton; bool m_blockHideEvent; }; +#endif #endif // WEBINSPECTORDOCKWIDGET_H diff --git a/src/lib/webkit/webpage.cpp b/src/lib/webkit/webpage.cpp index aac579d71..2fc02076b 100644 --- a/src/lib/webkit/webpage.cpp +++ b/src/lib/webkit/webpage.cpp @@ -50,16 +50,19 @@ #include #endif +#include #include +#include +#include +#include #include -#include +#include #include #include #include #include #include -#include -#include +#include QString WebPage::s_lastUploadLocation = QDir::homePath(); QUrl WebPage::s_lastUnsupportedUrl; @@ -67,7 +70,7 @@ QTime WebPage::s_lastUnsupportedUrlTime; QList WebPage::s_livingPages; WebPage::WebPage(QObject* parent) - : QWebPage(parent) + : QWebEnginePage(parent) , m_view(0) , m_fileWatcher(0) , m_runningLoop(0) @@ -76,7 +79,8 @@ WebPage::WebPage(QObject* parent) , m_secureStatus(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->setPrimaryNetworkAccessManager(mApp->networkManager()); @@ -113,6 +117,8 @@ WebPage::WebPage(QObject* parent) #elif QTWEBKIT_FROM_2_2 connect(this, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin*,quint64)), this, SLOT(appCacheQuotaExceeded(QWebSecurityOrigin*,quint64))); +#endif + #endif s_livingPages.append(this); @@ -129,14 +135,11 @@ WebPage::~WebPage() s_livingPages.removeOne(this); +#if QTWEBENGINE_DISABLED // Page's network manager will be deleted and then set to null // Fixes issue with network manager being used after deleted in destructor setNetworkAccessManager(0); -} - -QUrl WebPage::url() const -{ - return mainFrame()->url(); +#endif } void WebPage::setWebView(TabbedWebView* view) @@ -177,7 +180,11 @@ void WebPage::scheduleAdjustPage() bool WebPage::loadingError() const { +#if QTWEBENGINE_DISABLED return !mainFrame()->findFirstElement("span[id=\"qupzilla-error-page\"]").isNull(); +#else + return false; +#endif } void WebPage::addRejectedCerts(const QList &certs) @@ -206,11 +213,13 @@ bool WebPage::containsRejectedCerts(const QList &certs) return matches == certs.count(); } +#if QTWEBENGINE_DISABLED QWebElement WebPage::activeElement() const { QRect activeRect = inputMethodQuery(Qt::ImMicroFocus).toRect(); return mainFrame()->hitTestContent(activeRect.center()).element(); } +#endif bool WebPage::isRunningLoop() { @@ -224,10 +233,12 @@ bool WebPage::isLoading() const void WebPage::urlChanged(const QUrl &url) { +#if QTWEBENGINE_DISABLED // Make sure JavaScript is enabled for qupzilla pages regardless of user settings if (url.scheme() == QLatin1String("qupzilla")) { - settings()->setAttribute(QWebSettings::JavascriptEnabled, true); + settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true); } +#endif if (isLoading()) { m_adBlockedEntries.clear(); @@ -253,8 +264,8 @@ void WebPage::finished() if (m_adjustingScheduled) { m_adjustingScheduled = false; - mainFrame()->setZoomFactor(mainFrame()->zoomFactor() + 1); - mainFrame()->setZoomFactor(mainFrame()->zoomFactor() - 1); + setZoomFactor(zoomFactor() + 1); + setZoomFactor(zoomFactor() - 1); } // File scheme watcher @@ -284,11 +295,12 @@ void WebPage::finished() void WebPage::watchedFileChanged(const QString &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(view()); if (!webView) { @@ -297,22 +309,25 @@ void WebPage::printFrame(QWebFrame* frame) webView->printPage(frame); } +#endif void WebPage::addJavaScriptObject() { +#if QTWEBENGINE_DISABLED // Make sure all other sites have JavaScript set by user preferences // (JavaScript is enabled in WebPage::urlChanged) if (url().scheme() != QLatin1String("qupzilla")) { - settings()->setAttribute(QWebSettings::JavascriptEnabled, m_javaScriptEnabled); + settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, m_javaScriptEnabled); } ExternalJsObject* jsObject = new ExternalJsObject(this); - mainFrame()->addToJavaScriptWindowObject("external", jsObject); + addToJavaScriptWindowObject("external", jsObject); if (url().toString() == QLatin1String("qupzilla:speeddial")) { jsObject->setOnSpeedDial(true); mApp->plugins()->speedDial()->addWebFrame(mainFrame()); } +#endif } void WebPage::handleUnsupportedContent(QNetworkReply* reply) @@ -327,6 +342,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply) case QNetworkReply::NoError: if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) { QString requestUrl = reply->request().url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery); +#if QTWEBENGINE_DISABLED if (requestUrl.endsWith(QLatin1String(".swf"))) { const QWebElement docElement = mainFrame()->documentElement(); const QWebElement object = docElement.findFirst(QString("object[src=\"%1\"]").arg(requestUrl)); @@ -340,6 +356,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply) } DownloadManager* dManager = mApp->downloadManager(); dManager->handleUnsupportedContent(reply, this); +#endif return; } // 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")) { DownloadManager* dManager = mApp->downloadManager(); +#if QTWEBENGINE_DISABLED dManager->handleUnsupportedContent(reply, this); +#endif return; } @@ -457,6 +476,7 @@ void WebPage::windowCloseRequested() webView->closeView(); } +#if QTWEBENGINE_DISABLED void WebPage::frameCreated(QWebFrame* frame) { connect(frame, SIGNAL(initialLayoutCompleted()), this, SLOT(frameInitialLayoutCompleted())); @@ -471,8 +491,144 @@ void WebPage::frameInitialLayoutCompleted() // Autofill 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 &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(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 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) { return; @@ -483,6 +639,7 @@ void WebPage::dbQuotaExceeded(QWebFrame* frame) frame->securityOrigin().setDatabaseQuota(oldQuota * 2); } +#endif void WebPage::doWebSearch(const QString &text) { @@ -504,7 +661,7 @@ void WebPage::appCacheQuotaExceeded(QWebSecurityOrigin* origin, quint64 original 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); } @@ -513,7 +670,7 @@ void WebPage::featurePermissionRequested(QWebFrame* frame, const QWebPage::Featu bool WebPage::event(QEvent* event) { if (event->type() == QEvent::Leave) { - // QWebPagePrivate::leaveEvent(): + // QWebEnginePagePrivate::leaveEvent(): // Fake a mouse move event just outside of the widget, since all // the interesting mouse-out behavior like invalidating scrollbars // 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); - return QWebPage::event(&fakeEvent); + return QWebEnginePage::event(&fakeEvent); } - return QWebPage::event(event); + return QWebEnginePage::event(event); } void WebPage::setSSLCertificate(const QSslCertificate &cert) @@ -569,12 +726,13 @@ QSslCertificate WebPage::sslCertificate() 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_lastRequestUrl = request.url(); - if (type == QWebPage::NavigationTypeFormResubmitted) { + if (type == QWebEnginePage::NavigationTypeFormResubmitted) { // Don't show this dialog if app is still starting if (!view() || !view()->isVisible()) { 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; } +#endif void WebPage::populateNetworkRequest(QNetworkRequest &request) { @@ -599,15 +758,17 @@ void WebPage::populateNetworkRequest(QNetworkRequest &request) QVariant variant = QVariant::fromValue((void*) pagePointer); request.setAttribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100), variant); +#if QTWEBENGINE_DISABLED if (m_lastRequestUrl == request.url()) { request.setAttribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 101), m_lastRequestType); if (m_lastRequestType == NavigationTypeLinkClicked) { request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1")); } } +#endif } -QWebPage* WebPage::createWindow(QWebPage::WebWindowType type) +QWebEnginePage* WebPage::createWindow(QWebEnginePage::WebWindowType type) { if (m_view) { 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()); } else { - mainFrame()->load(QUrl("qupzilla:start")); + load(QUrl("qupzilla:start")); } return 0; @@ -665,6 +826,7 @@ QVector WebPage::autoFillData() const void WebPage::cleanBlockedObjects() { +#if QTWEBENGINE_DISABLED AdBlockManager* manager = AdBlockManager::instance(); if (!manager->isEnabled()) { return; @@ -718,14 +880,16 @@ void WebPage::cleanBlockedObjects() if (view() && !view()->isVisible() && !url().fragment().isEmpty()) { mainFrame()->scrollToAnchor(url().fragment()); } +#endif } QString WebPage::userAgentForUrl(const QUrl &url) const { QString userAgent = mApp->userAgentManager()->userAgentForUrl(url); +#if QTWEBENGINE_DISABLED if (userAgent.isEmpty()) { - userAgent = QWebPage::userAgentForUrl(url); + userAgent = QWebEnginePage::userAgentForUrl(url); #ifdef Q_OS_MAC #ifdef __i386__ || __x86_64__ 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 return userAgent; } +#if QTWEBENGINE_DISABLED bool WebPage::supportsExtension(Extension extension) const { Q_UNUSED(extension) @@ -746,11 +912,11 @@ bool WebPage::supportsExtension(Extension extension) const bool WebPage::extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output) { if (extension == ChooseMultipleFilesExtension) { - const QWebPage::ChooseMultipleFilesExtensionOption* exOption = static_cast(option); - QWebPage::ChooseMultipleFilesExtensionReturn* exReturn = static_cast(output); + const QWebEnginePage::ChooseMultipleFilesExtensionOption* exOption = static_cast(option); + QWebEnginePage::ChooseMultipleFilesExtensionReturn* exReturn = static_cast(output); if (!exOption || !exReturn) { - return QWebPage::extension(extension, option, output); + return QWebEnginePage::extension(extension, option, output); } QString suggestedFileName; @@ -762,21 +928,21 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte return true; } - const ErrorPageExtensionOption* exOption = static_cast(option); - ErrorPageExtensionReturn* exReturn = static_cast(output); + const ErrorPageExtensionOption* exOption = static_cast(option); + ErrorPageExtensionReturn* exReturn = static_cast(output); if (!exOption || !exReturn) { - return QWebPage::extension(extension, option, output); + return QWebEnginePage::extension(extension, option, output); } WebPage* erPage = qobject_cast(exOption->frame->page()); if (!erPage) { - return QWebPage::extension(extension, option, output); + return QWebEnginePage::extension(extension, option, output); } QString errorString; - if (exOption->domain == QWebPage::QtNetwork) { + if (exOption->domain == QWebEnginePage::QtNetwork) { switch (exOption->error) { case QNetworkReply::ConnectionRefusedError: errorString = tr("Server refused the connection"); @@ -881,7 +1047,7 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte return false; } } - else if (exOption->domain == QWebPage::Http) { + else if (exOption->domain == QWebEnginePage::Http) { // 200 status code = OK // It shouldn't be reported as an error, but sometimes it is ... 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); } - else if (exOption->domain == QWebPage::WebKit) { + else if (exOption->domain == QWebEnginePage::WebKit) { return false; // Downloads } @@ -918,11 +1084,12 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte exReturn->content = QString(errString + "").toUtf8(); 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 - return QWebPage::javaScriptPrompt(originatingFrame, msg, defaultValue, result); + return QWebEnginePage::javaScriptPrompt(securityOrigin, msg, defaultValue, result); #else if (m_runningLoop) { return false; @@ -963,10 +1130,10 @@ bool WebPage::javaScriptPrompt(QWebFrame* originatingFrame, const QString &msg, #endif } -bool WebPage::javaScriptConfirm(QWebFrame* originatingFrame, const QString &msg) +bool WebPage::javaScriptConfirm(QUrl securityOrigin, const QString &msg) { #ifndef NONBLOCK_JS_DIALOGS - return QWebPage::javaScriptConfirm(originatingFrame, msg); + return QWebEnginePage::javaScriptConfirm(securityOrigin, msg); #else if (m_runningLoop) { return false; @@ -1003,9 +1170,9 @@ bool WebPage::javaScriptConfirm(QWebFrame* originatingFrame, const QString &msg) #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) { return; @@ -1058,11 +1225,14 @@ void WebPage::javaScriptAlert(QWebFrame* originatingFrame, const QString &msg) void WebPage::setJavaScriptEnabled(bool enabled) { - settings()->setAttribute(QWebSettings::JavascriptEnabled, enabled); +#if QTWEBENGINE_DISABLED + settings()->setAttribute(QWebEngineSettings::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; @@ -1073,7 +1243,7 @@ QString WebPage::chooseFile(QWebFrame* originatingFrame, const QString &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()) { s_lastUploadLocation = fileName; @@ -1089,6 +1259,7 @@ QString WebPage::chooseFile(QWebFrame* originatingFrame, const QString &oldFile) return fileName; } +#endif bool WebPage::isPointerSafeToUse(WebPage* page) { diff --git a/src/lib/webkit/webpage.h b/src/lib/webkit/webpage.h index 4e1004b84..7166c56b7 100644 --- a/src/lib/webkit/webpage.h +++ b/src/lib/webkit/webpage.h @@ -18,7 +18,7 @@ #ifndef WEBPAGE_H #define WEBPAGE_H -#include +#include #include #include @@ -35,7 +35,7 @@ class SpeedDial; class NetworkManagerProxy; class DelayedFileWatcher; -class QUPZILLA_EXPORT WebPage : public QWebPage +class QUPZILLA_EXPORT WebPage : public QWebEnginePage { Q_OBJECT public: @@ -51,17 +51,15 @@ public: WebPage(QObject* parent = 0); ~WebPage(); - QUrl url() const; - void setWebView(TabbedWebView* view); void populateNetworkRequest(QNetworkRequest &request); void setSSLCertificate(const QSslCertificate &cert); QSslCertificate sslCertificate(); - bool javaScriptPrompt(QWebFrame* originatingFrame, const QString &msg, const QString &defaultValue, QString* result); - bool javaScriptConfirm(QWebFrame* originatingFrame, const QString &msg); - void javaScriptAlert(QWebFrame* originatingFrame, const QString &msg); + bool javaScriptPrompt(QUrl securityOrigin, const QString &msg, const QString &defaultValue, QString* result); + bool javaScriptConfirm(QUrl securityOrigin, const QString &msg); + void javaScriptAlert(QUrl securityOrigin, const QString &msg); void setJavaScriptEnabled(bool enabled); @@ -80,7 +78,9 @@ public: void addRejectedCerts(const QList &certs); bool containsRejectedCerts(const QList &certs); +#if QTWEBENGINE_DISABLED QWebElement activeElement() const; +#endif QString userAgentForUrl(const QUrl &url) const; static bool isPointerSafeToUse(WebPage* page); @@ -100,14 +100,18 @@ private slots: void addJavaScriptObject(); void watchedFileChanged(const QString &file); - void printFrame(QWebFrame* frame); void downloadRequested(const QNetworkRequest &request); 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 frameInitialLayoutCompleted(); + void dbQuotaExceeded(QWebEngineFrame* frame); + void printFrame(QWebEngineFrame* frame); +#endif - void dbQuotaExceeded(QWebFrame* frame); void doWebSearch(const QString &text); #ifdef USE_QTWEBKIT_2_2 @@ -117,14 +121,16 @@ private slots: protected: bool event(QEvent* event); - QWebPage* createWindow(QWebPage::WebWindowType type); + QWebEnginePage* createWindow(QWebEnginePage::WebWindowType type); QObject* createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); private: +#if QTWEBENGINE_DISABLED bool supportsExtension(Extension extension) const; bool extension(Extension extension, const ExtensionOption* option, ExtensionReturn* output = 0); bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type); QString chooseFile(QWebFrame* originatingFrame, const QString &oldFile); +#endif void handleUnknownProtocol(const QUrl &url); void desktopServicesOpen(const QUrl &url); @@ -144,7 +150,6 @@ private: QVector m_adBlockedEntries; QVector m_passwordEntries; - QWebPage::NavigationType m_lastRequestType; QUrl m_lastRequestUrl; int m_loadProgress; diff --git a/src/lib/webkit/webpluginfactory.cpp b/src/lib/webkit/webpluginfactory.cpp index a48f74392..f8f7fbccd 100644 --- a/src/lib/webkit/webpluginfactory.cpp +++ b/src/lib/webkit/webpluginfactory.cpp @@ -22,6 +22,7 @@ #include "adblockmanager.h" #include "webpage.h" +#if QTWEBENGINE_DISABLED #include WebPluginFactory::WebPluginFactory(WebPage* page) @@ -97,3 +98,5 @@ QList WebPluginFactory::plugins() const // plugins.append(plugin); // return plugins; } + +#endif diff --git a/src/lib/webkit/webpluginfactory.h b/src/lib/webkit/webpluginfactory.h index 9f83eec51..ddb6883ad 100644 --- a/src/lib/webkit/webpluginfactory.h +++ b/src/lib/webkit/webpluginfactory.h @@ -18,6 +18,7 @@ #ifndef WEB_PLUGIN_FACTORY_H #define WEB_PLUGIN_FACTORY_H +#if QTWEBENGINE_DISABLED #include #include "qzcommon.h" @@ -35,4 +36,5 @@ public: private: WebPage* m_page; }; +#endif #endif // WEB_PLUGIN_FACTORY_H diff --git a/src/lib/webkit/webview.cpp b/src/lib/webkit/webview.cpp index 0c04ac211..4c1eb2604 100644 --- a/src/lib/webkit/webview.cpp +++ b/src/lib/webkit/webview.cpp @@ -45,8 +45,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -54,10 +53,12 @@ bool WebView::s_forceContextMenuOnMouseRelease = false; WebView::WebView(QWidget* parent) - : QWebView(parent) + : QWebEngineView(parent) , m_isLoading(false) , m_progress(0) +#if QTWEBENGINE_DISABLED , m_clickedFrame(0) +#endif , m_page(0) , m_disableTouchMocking(false) , m_isReloading(false) @@ -67,8 +68,10 @@ WebView::WebView(QWidget* parent) connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted())); connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished())); - connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged())); connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl))); +#if QTWEBENGINE_DISABLED + connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged())); +#endif m_zoomLevels = zoomLevels(); m_currentZoomLevel = m_zoomLevels.indexOf(100); @@ -82,7 +85,7 @@ WebView::WebView(QWidget* parent) WebView::~WebView() { - delete m_page; + //delete m_page; } QIcon WebView::icon() const @@ -99,9 +102,11 @@ QIcon WebView::icon() const return IconProvider::standardIcon(QStyle::SP_ComputerIcon); } - if (!QWebView::icon().isNull()) { - return QWebView::icon(); +#if QTWEBENGINE_DISABLED + if (!QWebEngineView::icon().isNull()) { + return QWebEngineView::icon(); } +#endif if (!m_siteIcon.isNull() && m_siteIconUrl.host() == url().host()) { return m_siteIcon; @@ -112,7 +117,7 @@ QIcon WebView::icon() const QString WebView::title() const { - QString title = QWebView::title(); + QString title = QWebEngineView::title(); if (title.isEmpty()) { title = url().toString(QUrl::RemoveFragment); @@ -127,7 +132,7 @@ QString WebView::title() const bool WebView::isTitleEmpty() const { - return QWebView::title().isEmpty(); + return QWebEngineView::title().isEmpty(); } QUrl WebView::url() const @@ -146,16 +151,18 @@ WebPage* WebView::page() const return m_page; } -void WebView::setPage(QWebPage* page) +void WebView::setPage(QWebEnginePage* page) { if (m_page == page) { return; } - QWebView::setPage(page); + QWebEngineView::setPage(page); m_page = qobject_cast(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))); // Set default zoom level @@ -166,11 +173,13 @@ void WebView::setPage(QWebPage* page) mApp->plugins()->emitWebPageCreated(m_page); +#if QTWEBENGINE_DISABLED // Set white background by default. // Fixes issue with dark themes. See #602 QPalette pal = palette(); pal.setBrush(QPalette::Base, Qt::white); page->setPalette(pal); +#endif } void WebView::load(const LoadRequest &request) @@ -182,9 +191,9 @@ void WebView::load(const LoadRequest &request) // Is the javascript source percent encoded or not? // Looking for % character in source should work in most cases if (scriptSource.contains(QL1C('%'))) - page()->mainFrame()->evaluateJavaScript(QUrl::fromPercentEncoding(scriptSource.toUtf8())); + page()->runJavaScript(QUrl::fromPercentEncoding(scriptSource.toUtf8())); else - page()->mainFrame()->evaluateJavaScript(scriptSource); + page()->runJavaScript(scriptSource); return; } @@ -235,11 +244,13 @@ bool WebView::hasRss() const return m_hasRss; } +#if QTWEBENGINE_DISABLED QWebElement WebView::activeElement() const { QRect activeRect = inputMethodQuery(Qt::ImMicroFocus).toRect(); return page()->mainFrame()->hitTestContent(activeRect.center()).element(); } +#endif int WebView::zoomLevel() const { @@ -254,11 +265,13 @@ void WebView::setZoomLevel(int level) bool WebView::onBeforeUnload() { +#if QTWEBENGINE_DISABLED const QString res = page()->mainFrame()->evaluateJavaScript("window.onbeforeunload(new Event(\"beforeunload\"))").toString(); if (!res.isEmpty()) { return page()->javaScriptConfirm(page()->mainFrame(), res); } +#endif return true; } @@ -364,32 +377,32 @@ void WebView::zoomReset() void WebView::editUndo() { - triggerPageAction(QWebPage::Undo); + triggerPageAction(QWebEnginePage::Undo); } void WebView::editRedo() { - triggerPageAction(QWebPage::Redo); + triggerPageAction(QWebEnginePage::Redo); } void WebView::editCut() { - triggerPageAction(QWebPage::Cut); + triggerPageAction(QWebEnginePage::Cut); } void WebView::editCopy() { - triggerPageAction(QWebPage::Copy); + triggerPageAction(QWebEnginePage::Copy); } void WebView::editPaste() { - triggerPageAction(QWebPage::Paste); + triggerPageAction(QWebEnginePage::Paste); } void WebView::editSelectAll() { - triggerPageAction(QWebPage::SelectAll); + triggerPageAction(QWebEnginePage::SelectAll); } void WebView::editDelete() @@ -402,40 +415,44 @@ void WebView::reload() { m_isReloading = true; - if (LocationBar::convertUrlToText(QWebView::url()).isEmpty() && !m_aboutToLoadUrl.isEmpty()) { + if (LocationBar::convertUrlToText(QWebEngineView::url()).isEmpty() && !m_aboutToLoadUrl.isEmpty()) { load(m_aboutToLoadUrl); return; } - QWebView::reload(); + QWebEngineView::reload(); } void WebView::reloadBypassCache() { - triggerPageAction(QWebPage::ReloadAndBypassCache); + triggerPageAction(QWebEnginePage::ReloadAndBypassCache); } void WebView::back() { - QWebHistory* history = page()->history(); + QWebEngineHistory* history = page()->history(); if (history->canGoBack()) { history->back(); emit urlChanged(url()); +#if QTWEBENGINE_DISABLED emit iconChanged(); +#endif } } void WebView::forward() { - QWebHistory* history = page()->history(); + QWebEngineHistory* history = page()->history(); if (history->canGoForward()) { history->forward(); emit urlChanged(url()); +#if QTWEBENGINE_DISABLED emit iconChanged(); +#endif } } @@ -472,7 +489,7 @@ void WebView::slotLoadFinished() 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())); } @@ -483,16 +500,18 @@ void WebView::emitChangedUrl() void WebView::checkRss() { +#if QTWEBENGINE_DISABLED if (m_rssChecked) { return; } m_rssChecked = true; - QWebFrame* frame = page()->mainFrame(); + QWebEngineFrame* frame = page()->mainFrame(); const QWebElementCollection links = frame->findAllElements("link[type=\"application/rss+xml\"]"); m_hasRss = links.count() != 0; emit rssChanged(m_hasRss); +#endif } void WebView::slotIconChanged() @@ -599,7 +618,9 @@ void WebView::downloadUrlToDisk() void WebView::copyImageToClipboard() { - triggerPageAction(QWebPage::CopyImageToClipboard); +#if QTWEBENGINE_DISABLED + triggerPageAction(QWebEnginePage::CopyImageToClipboard); +#endif } 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) { frame = page()->mainFrame(); @@ -619,11 +641,14 @@ void WebView::showSource(QWebFrame* frame, const QString &selectedHtml) QzTools::centerWidgetToParent(source, this); source->show(); } +#endif void WebView::showSiteInfo() { +#if QTWEBENGINE_DISABLED SiteInfo* s = new SiteInfo(this, this); s->show(); +#endif } void WebView::searchSelectedText() @@ -733,22 +758,26 @@ void WebView::userDefinedOpenUrlInBgTab(const QUrl &url) void WebView::loadClickedFrame() { +#if QTWEBENGINE_DISABLED QUrl frameUrl = m_clickedFrame->baseUrl(); if (frameUrl.isEmpty()) { frameUrl = m_clickedFrame->requestedUrl(); } load(frameUrl); +#endif } void WebView::loadClickedFrameInNewTab(bool invert) { +#if QTWEBENGINE_DISABLED QUrl frameUrl = m_clickedFrame->baseUrl(); if (frameUrl.isEmpty()) { frameUrl = m_clickedFrame->requestedUrl(); } userDefinedOpenUrlInNewTab(frameUrl, invert); +#endif } void WebView::loadClickedFrameInBgTab() @@ -758,50 +787,63 @@ void WebView::loadClickedFrameInBgTab() void WebView::reloadClickedFrame() { +#if QTWEBENGINE_DISABLED QUrl frameUrl = m_clickedFrame->baseUrl(); if (frameUrl.isEmpty()) { frameUrl = m_clickedFrame->requestedUrl(); } m_clickedFrame->load(frameUrl); +#endif } void WebView::printClickedFrame() { +#if QTWEBENGINE_DISABLED printPage(m_clickedFrame); +#endif } void WebView::clickedFrameZoomIn() { +#if QTWEBENGINE_DISABLED qreal zFactor = m_clickedFrame->zoomFactor() + 0.1; if (zFactor > 2.5) { zFactor = 2.5; } m_clickedFrame->setZoomFactor(zFactor); +#endif } void WebView::clickedFrameZoomOut() { +#if QTWEBENGINE_DISABLED qreal zFactor = m_clickedFrame->zoomFactor() - 0.1; if (zFactor < 0.5) { zFactor = 0.5; } m_clickedFrame->setZoomFactor(zFactor); +#endif } void WebView::clickedFrameZoomReset() { +#if QTWEBENGINE_DISABLED m_clickedFrame->setZoomFactor(zoomFactor()); +#endif } void WebView::showClickedFrameSource() { +#if QTWEBENGINE_DISABLED showSource(m_clickedFrame); +#endif } -void WebView::printPage(QWebFrame* frame) +#if QTWEBENGINE_DISABLED +void WebView::printPage(QWebEngineFrame* frame) { QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this); dialog->setAttribute(Qt::WA_DeleteOnClose); @@ -816,12 +858,14 @@ void WebView::printPage(QWebFrame* frame) dialog->open(); } +#endif QUrl WebView::lastUrl() { return m_lastUrl; } +#if QTWEBENGINE_DISABLED bool WebView::isMediaElement(const QWebElement &element) { return (element.tagName().toLower() == QLatin1String("video") @@ -921,7 +965,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c ++i; } - if (menu->actions().last() == pageAction(QWebPage::InspectElement)) { + if (menu->actions().last() == pageAction(QWebEnginePage::InspectElement)) { // We have own Inspect Element action 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) { - QWebFrame* frameAtPos = page()->frameAt(pos); + QWebEngineFrame* frameAtPos = page()->frameAt(pos); QAction* action = menu->addAction(tr("&Back"), this, SLOT(back())); action->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowBack)); @@ -1045,8 +1089,8 @@ void WebView::createLinkContextMenu(QMenu* menu, const QWebHitTestResult &hitTes menu->addSeparator(); if (!selectedText().isEmpty()) { - pageAction(QWebPage::Copy)->setIcon(QIcon::fromTheme("edit-copy")); - menu->addAction(pageAction(QWebPage::Copy)); + pageAction(QWebEnginePage::Copy)->setIcon(QIcon::fromTheme("edit-copy")); + menu->addAction(pageAction(QWebEnginePage::Copy)); } } @@ -1066,8 +1110,8 @@ void WebView::createImageContextMenu(QMenu* menu, const QWebHitTestResult &hitTe menu->addSeparator(); if (!selectedText().isEmpty()) { - pageAction(QWebPage::Copy)->setIcon(QIcon::fromTheme("edit-copy")); - menu->addAction(pageAction(QWebPage::Copy)); + pageAction(QWebEnginePage::Copy)->setIcon(QIcon::fromTheme("edit-copy")); + menu->addAction(pageAction(QWebEnginePage::Copy)); } } @@ -1078,8 +1122,8 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult QString selectedText = page()->selectedText(); menu->addSeparator(); - if (!menu->actions().contains(pageAction(QWebPage::Copy))) { - menu->addAction(pageAction(QWebPage::Copy)); + if (!menu->actions().contains(pageAction(QWebEnginePage::Copy))) { + menu->addAction(pageAction(QWebEnginePage::Copy)); } menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send text..."), this, SLOT(sendLinkByMail()))->setData(selectedText); menu->addSeparator(); @@ -1186,74 +1230,77 @@ void WebView::muteMedia() m_clickedElement.evaluateJavaScript("this.muted = true"); } } +#endif void WebView::addSpeedDial() { - page()->mainFrame()->evaluateJavaScript("addSpeedDial()"); + page()->runJavaScript("addSpeedDial()"); } void WebView::configureSpeedDial() { - page()->mainFrame()->evaluateJavaScript("configureSpeedDial()"); + page()->runJavaScript("configureSpeedDial()"); } void WebView::reloadAllSpeedDials() { - page()->mainFrame()->evaluateJavaScript("reloadAll()"); + page()->runJavaScript("reloadAll()"); } void WebView::initializeActions() { - QAction* undoAction = pageAction(QWebPage::Undo); + QAction* undoAction = pageAction(QWebEnginePage::Undo); undoAction->setText(tr("&Undo")); undoAction->setShortcut(QKeySequence("Ctrl+Z")); undoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); undoAction->setIcon(QIcon::fromTheme(QSL("edit-undo"))); - QAction* redoAction = pageAction(QWebPage::Redo); + QAction* redoAction = pageAction(QWebEnginePage::Redo); redoAction->setText(tr("&Redo")); redoAction->setShortcut(QKeySequence("Ctrl+Shift+Z")); redoAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); redoAction->setIcon(QIcon::fromTheme(QSL("edit-redo"))); - QAction* cutAction = pageAction(QWebPage::Cut); + QAction* cutAction = pageAction(QWebEnginePage::Cut); cutAction->setText(tr("&Cut")); cutAction->setShortcut(QKeySequence("Ctrl+X")); cutAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); cutAction->setIcon(QIcon::fromTheme(QSL("edit-cut"))); - QAction* copyAction = pageAction(QWebPage::Copy); + QAction* copyAction = pageAction(QWebEnginePage::Copy); copyAction->setText(tr("&Copy")); copyAction->setShortcut(QKeySequence("Ctrl+C")); copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); copyAction->setIcon(QIcon::fromTheme(QSL("edit-copy"))); - QAction* pasteAction = pageAction(QWebPage::Paste); + QAction* pasteAction = pageAction(QWebEnginePage::Paste); pasteAction->setText(tr("&Paste")); pasteAction->setShortcut(QKeySequence("Ctrl+V")); pasteAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); pasteAction->setIcon(QIcon::fromTheme(QSL("edit-paste"))); - QAction* selectAllAction = pageAction(QWebPage::SelectAll); + QAction* selectAllAction = pageAction(QWebEnginePage::SelectAll); selectAllAction->setText(tr("Select All")); selectAllAction->setShortcut(QKeySequence("Ctrl+A")); selectAllAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); selectAllAction->setIcon(QIcon::fromTheme(QSL("edit-select-all"))); - QAction* reloadAction = pageAction(QWebPage::Reload); + QAction* reloadAction = pageAction(QWebEnginePage::Reload); reloadAction->setText(tr("&Reload")); reloadAction->setIcon(QIcon::fromTheme(QSL("view-refresh"))); - QAction* stopAction = pageAction(QWebPage::Stop); + QAction* stopAction = pageAction(QWebEnginePage::Stop); stopAction->setText(tr("S&top")); stopAction->setIcon(QIcon::fromTheme(QSL("process-stop"))); - pageAction(QWebPage::SetTextDirectionDefault)->setText(tr("Default")); - pageAction(QWebPage::SetTextDirectionLeftToRight)->setText(tr("Left to Right")); - pageAction(QWebPage::SetTextDirectionRightToLeft)->setText(tr("Right to Left")); - pageAction(QWebPage::ToggleBold)->setText(tr("Bold")); - pageAction(QWebPage::ToggleItalic)->setText(tr("Italic")); - pageAction(QWebPage::ToggleUnderline)->setText(tr("Underline")); +#if QTWEBENGINE_DISABLED + pageAction(QWebEnginePage::SetTextDirectionDefault)->setText(tr("Default")); + pageAction(QWebEnginePage::SetTextDirectionLeftToRight)->setText(tr("Left to Right")); + pageAction(QWebEnginePage::SetTextDirectionRightToLeft)->setText(tr("Right to Left")); + pageAction(QWebEnginePage::ToggleBold)->setText(tr("Bold")); + pageAction(QWebEnginePage::ToggleItalic)->setText(tr("Italic")); + pageAction(QWebEnginePage::ToggleUnderline)->setText(tr("Underline")); +#endif // Make action shortcuts available for webview addAction(undoAction); @@ -1277,7 +1324,7 @@ void WebView::wheelEvent(QWheelEvent* event) return; } - QWebView::wheelEvent(event); + QWebEngineView::wheelEvent(event); } void WebView::mousePressEvent(QMouseEvent* event) @@ -1298,19 +1345,22 @@ void WebView::mousePressEvent(QMouseEvent* event) break; case Qt::MiddleButton: { - QWebFrame* frame = page()->frameAt(event->pos()); +#if QTWEBENGINE_DISABLED + QWebEngineFrame* frame = page()->frameAt(event->pos()); if (frame) { m_clickedUrl = frame->hitTestContent(event->pos()).linkUrl(); if (!m_clickedUrl.isEmpty()) { return; } } +#endif break; } case Qt::LeftButton: { - QWebFrame* frame = page()->frameAt(event->pos()); +#if QTWEBENGINE_DISABLED + QWebEngineFrame* frame = page()->frameAt(event->pos()); if (frame) { const QUrl link = frame->hitTestContent(event->pos()).linkUrl(); if (event->modifiers() & Qt::ControlModifier && isUrlValid(link)) { @@ -1319,13 +1369,14 @@ void WebView::mousePressEvent(QMouseEvent* event) return; } } +#endif } default: break; } - QWebView::mousePressEvent(event); + QWebEngineView::mousePressEvent(event); } void WebView::mouseReleaseEvent(QMouseEvent* event) @@ -1336,7 +1387,8 @@ void WebView::mouseReleaseEvent(QMouseEvent* event) switch (event->button()) { case Qt::MiddleButton: { - QWebFrame* frame = page()->frameAt(event->pos()); +#if QTWEBENGINE_DISABLED + QWebEngineFrame* frame = page()->frameAt(event->pos()); if (frame) { const QUrl link = frame->hitTestContent(event->pos()).linkUrl(); if (m_clickedUrl == link && isUrlValid(link)) { @@ -1345,6 +1397,7 @@ void WebView::mouseReleaseEvent(QMouseEvent* event) return; } } +#endif break; } @@ -1359,7 +1412,7 @@ void WebView::mouseReleaseEvent(QMouseEvent* event) break; } - QWebView::mouseReleaseEvent(event); + QWebEngineView::mouseReleaseEvent(event); } void WebView::mouseMoveEvent(QMouseEvent* event) @@ -1368,7 +1421,7 @@ void WebView::mouseMoveEvent(QMouseEvent* event) return; } - QWebView::mouseMoveEvent(event); + QWebEngineView::mouseMoveEvent(event); } void WebView::keyPressEvent(QKeyEvent* event) @@ -1386,6 +1439,7 @@ void WebView::keyPressEvent(QKeyEvent* event) // event->spontaneous() check guards recursive calling of keyPressEvent // Events created from app have spontaneous() == false +#if QTWEBENGINE_DISABLED if (event->spontaneous() && (eventKey == Qt::Key_Left || eventKey == Qt::Key_Right)) { const QWebElement elementHasCursor = activeElement(); if (!elementHasCursor.isNull()) { @@ -1455,7 +1509,7 @@ void WebView::keyPressEvent(QKeyEvent* event) case Qt::Key_Down: if (event->modifiers() & Qt::ShiftModifier) { - triggerPageAction(QWebPage::SelectNextLine); + triggerPageAction(QWebEnginePage::SelectNextLine); event->accept(); return; } @@ -1464,10 +1518,10 @@ void WebView::keyPressEvent(QKeyEvent* event) case Qt::Key_Left: if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() == Qt::ShiftModifier) { - triggerPageAction(QWebPage::SelectPreviousChar); + triggerPageAction(QWebEnginePage::SelectPreviousChar); } else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { - triggerPageAction(QWebPage::SelectPreviousWord); + triggerPageAction(QWebEnginePage::SelectPreviousWord); } event->accept(); return; @@ -1477,10 +1531,10 @@ void WebView::keyPressEvent(QKeyEvent* event) case Qt::Key_Right: if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() == Qt::ShiftModifier) { - triggerPageAction(QWebPage::SelectNextChar); + triggerPageAction(QWebEnginePage::SelectNextChar); } else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { - triggerPageAction(QWebPage::SelectNextWord); + triggerPageAction(QWebEnginePage::SelectNextWord); } event->accept(); return; @@ -1490,10 +1544,10 @@ void WebView::keyPressEvent(QKeyEvent* event) case Qt::Key_Home: if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() == Qt::ShiftModifier) { - triggerPageAction(QWebPage::SelectStartOfLine); + triggerPageAction(QWebEnginePage::SelectStartOfLine); } else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { - triggerPageAction(QWebPage::SelectStartOfDocument); + triggerPageAction(QWebEnginePage::SelectStartOfDocument); } event->accept(); return; @@ -1503,10 +1557,10 @@ void WebView::keyPressEvent(QKeyEvent* event) case Qt::Key_End: if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() == Qt::ShiftModifier) { - triggerPageAction(QWebPage::SelectEndOfLine); + triggerPageAction(QWebEnginePage::SelectEndOfLine); } else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { - triggerPageAction(QWebPage::SelectEndOfDocument); + triggerPageAction(QWebEnginePage::SelectEndOfDocument); } event->accept(); return; @@ -1515,12 +1569,12 @@ void WebView::keyPressEvent(QKeyEvent* event) case Qt::Key_Insert: if (event->modifiers() == Qt::ControlModifier) { - triggerPageAction(QWebPage::Copy); + triggerPageAction(QWebEnginePage::Copy); event->accept(); return; } if (event->modifiers() == Qt::ShiftModifier) { - triggerPageAction(QWebPage::Paste); + triggerPageAction(QWebEnginePage::Paste); event->accept(); return; } @@ -1529,8 +1583,9 @@ void WebView::keyPressEvent(QKeyEvent* event) default: break; } +#endif - QWebView::keyPressEvent(event); + QWebEngineView::keyPressEvent(event); } void WebView::keyReleaseEvent(QKeyEvent* event) @@ -1539,23 +1594,29 @@ void WebView::keyReleaseEvent(QKeyEvent* event) return; } - QWebView::keyReleaseEvent(event); + QWebEngineView::keyReleaseEvent(event); } void WebView::resizeEvent(QResizeEvent* event) { - QWebView::resizeEvent(event); + QWebEngineView::resizeEvent(event); +#if QTWEBENGINE_DISABLED emit viewportResized(page()->viewportSize()); +#endif } void WebView::loadRequest(const LoadRequest &req) { m_aboutToLoadUrl = req.url(); +#if QTWEBENGINE_DISABLED if (req.operation() == LoadRequest::GetOperation) - QWebView::load(req.networkRequest()); + QWebEngineView::load(req.networkRequest()); 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) @@ -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) #if QTWEBKIT_TO_2_3 // 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)) { return false; } +#endif if (ev->type() == QEvent::MouseButtonPress && !(ev->buttons() & Qt::LeftButton)) { return false; @@ -1634,5 +1697,5 @@ bool WebView::eventFilter(QObject* obj, QEvent* event) return false; } #endif - return QWebView::eventFilter(obj, event); + return QWebEngineView::eventFilter(obj, event); } diff --git a/src/lib/webkit/webview.h b/src/lib/webkit/webview.h index 82d475976..bee702afb 100644 --- a/src/lib/webkit/webview.h +++ b/src/lib/webkit/webview.h @@ -18,8 +18,11 @@ #ifndef WEBVIEW_H #define WEBVIEW_H -#include +#include +#include +#if QTWEBENGINE_DISABLED #include +#endif #include "qzcommon.h" #include "loadrequest.h" @@ -27,7 +30,7 @@ class WebPage; class LoadRequest; -class QUPZILLA_EXPORT WebView : public QWebView +class QUPZILLA_EXPORT WebView : public QWebEngineView { Q_OBJECT public: @@ -41,7 +44,7 @@ public: bool isTitleEmpty() const; WebPage* page() const; - void setPage(QWebPage* page); + void setPage(QWebEnginePage* page); void load(const LoadRequest &request); bool loadingError() const; @@ -51,7 +54,9 @@ public: void fakeLoadingProgress(int progress); bool hasRss() const; +#if QTWEBENGINE_DISABLED QWebElement activeElement() const; +#endif // Set zoom level (0 - 17) int zoomLevel() const; @@ -100,7 +105,9 @@ public slots: void back(); void forward(); - void printPage(QWebFrame* frame = 0); +#if QTWEBENGINE_DISABLED + void printPage(QWebEngineFrame* frame = 0); +#endif void sendPageByMail(); void savePageAs(); @@ -124,7 +131,9 @@ protected slots: void downloadUrlToDisk(); void copyImageToClipboard(); 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 searchSelectedText(); void searchSelectedTextInBackgroundTab(); @@ -136,7 +145,9 @@ protected slots: void userDefinedOpenUrlInNewTab(const QUrl &url = QUrl(), bool invert = false); void userDefinedOpenUrlInBgTab(const QUrl &url = QUrl()); +#if QTWEBENGINE_DISABLED void createSearchEngine(); +#endif // Clicked frame actions void loadClickedFrame(); @@ -162,6 +173,7 @@ protected: void applyZoom(); QUrl lastUrl(); +#if QTWEBENGINE_DISABLED bool isMediaElement(const QWebElement &element); void checkForForm(QMenu* menu, const QWebElement &element); @@ -171,10 +183,13 @@ protected: void createImageContextMenu(QMenu* menu, const QWebHitTestResult &hitTest); void createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult &hitTest); void createMediaContextMenu(QMenu* menu, const QWebHitTestResult &hitTest); +#endif private slots: +#if QTWEBENGINE_DISABLED void pauseMedia(); void muteMedia(); +#endif void frameStateChanged(); void emitChangedUrl(); void checkRss(); @@ -196,8 +211,10 @@ private: QUrl m_aboutToLoadUrl; QUrl m_lastUrl; +#if QTWEBENGINE_DISABLED QWebElement m_clickedElement; - QWebFrame* m_clickedFrame; + QWebEngineFrame* m_clickedFrame; +#endif QUrl m_clickedUrl; WebPage* m_page; diff --git a/src/lib/webtab/searchtoolbar.cpp b/src/lib/webtab/searchtoolbar.cpp index 61d0b84c4..86cef875a 100644 --- a/src/lib/webtab/searchtoolbar.cpp +++ b/src/lib/webtab/searchtoolbar.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,22 @@ #include #include +template +struct InvokeWrapper { + R* receiver; + void (C::*memberFun)(Arg); + void operator()(Arg result) { + (receiver->*memberFun)(result); + } +}; + +template +InvokeWrapper invoke(R* receiver, void (C::*memberFun)(Arg)) +{ + InvokeWrapper wrapper = {receiver, memberFun}; + return wrapper; +} + SearchToolBar::SearchToolBar(WebView* view, QWidget* parent) : AnimatedWidget(AnimatedWidget::Up, 300, parent) , ui(new Ui::SearchToolbar) @@ -33,16 +49,15 @@ SearchToolBar::SearchToolBar(WebView* view, QWidget* parent) setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(widget()); - ui->closeButton->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton)); - ui->next->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowDown)); - ui->previous->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowUp)); + ui->closeButton->setIcon(IconProvider::instance()->standardIcon(QStyle::SP_DialogCloseButton)); + ui->next->setIcon(IconProvider::instance()->standardIcon(QStyle::SP_ArrowDown)); + ui->previous->setIcon(IconProvider::instance()->standardIcon(QStyle::SP_ArrowUp)); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide())); connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(findNext())); connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(findNext())); connect(ui->next, SIGNAL(clicked()), this, SLOT(findNext())); connect(ui->previous, SIGNAL(clicked()), this, SLOT(findPrevious())); - connect(ui->highligh, SIGNAL(clicked()), this, SLOT(highlightChanged())); connect(ui->caseSensitive, SIGNAL(clicked()), this, SLOT(caseSensitivityChanged())); startAnimation(); @@ -63,7 +78,6 @@ void SearchToolBar::setWebView(WebView* view) void SearchToolBar::showMinimalInPopupWindow() { // Show only essentials widget + set minimum width - ui->highligh->hide(); ui->caseSensitive->hide(); ui->results->hide(); ui->horizontalLayout->setSpacing(2); @@ -86,7 +100,7 @@ void SearchToolBar::hide() void SearchToolBar::findNext() { - m_findFlags = QWebPage::FindWrapsAroundDocument; + m_findFlags = 0; updateFindFlags(); searchText(ui->lineEdit->text()); @@ -94,7 +108,7 @@ void SearchToolBar::findNext() void SearchToolBar::findPrevious() { - m_findFlags = QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument; + m_findFlags = QWebEnginePage::FindBackward; updateFindFlags(); searchText(ui->lineEdit->text()); @@ -103,20 +117,10 @@ void SearchToolBar::findPrevious() void SearchToolBar::updateFindFlags() { if (ui->caseSensitive->isChecked()) { - m_findFlags = m_findFlags | QWebPage::FindCaseSensitively; + m_findFlags = m_findFlags | QWebEnginePage::FindCaseSensitively; } else { - m_findFlags = m_findFlags & ~QWebPage::FindCaseSensitively; - } -} - -void SearchToolBar::highlightChanged() -{ - if (ui->highligh->isChecked()) { - m_view->findText(ui->lineEdit->text(), m_findFlags | QWebPage::HighlightAllOccurrences); - } - else { - m_view->findText(QString(), QWebPage::HighlightAllOccurrences); + m_findFlags = m_findFlags & ~QWebEnginePage::FindCaseSensitively; } } @@ -129,24 +133,15 @@ void SearchToolBar::caseSensitivityChanged() void SearchToolBar::searchText(const QString &text) { - // Clear highlighting on page - m_view->findText(QString(), QWebPage::HighlightAllOccurrences); + m_view->findText(text, m_findFlags, invoke(this, &SearchToolBar::handleSearchResult)); +} - bool found = m_view->findText(text, m_findFlags); - - if (text.isEmpty()) { +void SearchToolBar::handleSearchResult(bool found) +{ + if (ui->lineEdit->text().isEmpty()) { found = true; } - if (ui->highligh->isChecked()) { - m_findFlags = QWebPage::HighlightAllOccurrences; - updateFindFlags(); - m_view->findText(text, m_findFlags); - } - else { - m_view->findText(QString(), QWebPage::HighlightAllOccurrences); - } - if (!found) { ui->results->setText(tr("No results found.")); } diff --git a/src/lib/webtab/searchtoolbar.h b/src/lib/webtab/searchtoolbar.h index 824ef3dce..11cb23ab1 100644 --- a/src/lib/webtab/searchtoolbar.h +++ b/src/lib/webtab/searchtoolbar.h @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ #ifndef SEARCHTOOLBAR_H #define SEARCHTOOLBAR_H -#include +#include #include "qzcommon.h" #include "animatedwidget.h" @@ -51,7 +51,6 @@ signals: public slots: void searchText(const QString &text); void updateFindFlags(); - void highlightChanged(); void caseSensitivityChanged(); void findNext(); @@ -60,10 +59,11 @@ public slots: void hide(); private: + void handleSearchResult(bool found); Ui::SearchToolbar* ui; WebView* m_view; - QWebPage::FindFlags m_findFlags; + QWebEnginePage::FindFlags m_findFlags; }; #endif // SEARCHTOOLBAR_H diff --git a/src/lib/webtab/tabbedwebview.cpp b/src/lib/webtab/tabbedwebview.cpp index f79184d1a..09e8bf809 100644 --- a/src/lib/webtab/tabbedwebview.cpp +++ b/src/lib/webtab/tabbedwebview.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include TabbedWebView::TabbedWebView(WebTab* webTab) @@ -58,7 +57,9 @@ void TabbedWebView::setWebPage(WebPage* page) page->setParent(this); setPage(page); +#if QTWEBENGINE_DISABLED connect(page, SIGNAL(linkHovered(QString,QString,QString)), this, SLOT(linkHovered(QString,QString,QString))); +#endif } BrowserWindow* TabbedWebView::browserWindow() const @@ -68,21 +69,27 @@ BrowserWindow* TabbedWebView::browserWindow() const void TabbedWebView::setBrowserWindow(BrowserWindow* window) { +#if QTWEBENGINE_DISABLED if (m_window) { disconnect(this, SIGNAL(statusBarMessage(QString)), m_window->statusBar(), SLOT(showMessage(QString))); } +#endif m_window = window; +#if QTWEBENGINE_DISABLED if (m_window) { connect(this, SIGNAL(statusBarMessage(QString)), m_window->statusBar(), SLOT(showMessage(QString))); } +#endif } void TabbedWebView::inspectElement() { +#if QTWEBENGINE_DISABLED m_webTab->showWebInspector(); - triggerPageAction(QWebPage::InspectElement); + triggerPageAction(QWebEnginePage::InspectElement); +#endif } WebTab* TabbedWebView::webTab() const @@ -186,6 +193,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event) { m_menu->clear(); +#if QTWEBENGINE_DISABLED const QWebHitTestResult hitTest = page()->mainFrame()->hitTestContent(event->pos()); createContextMenu(m_menu, hitTest, event->pos()); @@ -205,6 +213,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event) m_menu->popup(p); return; } +#endif WebView::contextMenuEvent(event); } diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index 298c56bf2..78bfadb83 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -29,8 +29,7 @@ #include "mainapplication.h" #include -#include -#include +#include #include #include #include @@ -131,6 +130,7 @@ TabbedWebView* WebTab::webView() const void WebTab::showWebInspector() { +#if QTWEBENGINE_DISABLED if (!m_inspector) { m_inspector = new WebInspector(this); m_inspector->setPage(m_webView->page()); @@ -138,6 +138,7 @@ void WebTab::showWebInspector() } m_inspector->show(); +#endif } QUrl WebTab::url() const @@ -170,7 +171,7 @@ QIcon WebTab::icon() const } } -QWebHistory* WebTab::history() const +QWebEngineHistory* WebTab::history() const { return m_webView->history(); } @@ -306,6 +307,7 @@ void WebTab::p_restoreTab(const WebTab::SavedTab &tab) QPixmap WebTab::renderTabPreview() { +#if QTWEBENGINE_DISABLED WebPage* page = m_webView->page(); const QSize oldSize = page->viewportSize(); const QPoint originalScrollPosition = page->mainFrame()->scrollPosition(); @@ -341,6 +343,13 @@ QPixmap WebTab::renderTabPreview() page->mainFrame()->setScrollBarValue(Qt::Horizontal, originalScrollPosition.x()); return pageImage.scaled(previewWidth, previewHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); +#else + const int previewWidth = 230; + const int previewHeight = 150; + + QPixmap p = m_webView->grab(); + return p.scaled(previewWidth, previewHeight, Qt::KeepAspectRatioByExpanding); +#endif } void WebTab::showNotification(QWidget* notif) diff --git a/src/lib/webtab/webtab.h b/src/lib/webtab/webtab.h index 48d9f9237..4802f8e99 100644 --- a/src/lib/webtab/webtab.h +++ b/src/lib/webtab/webtab.h @@ -25,7 +25,7 @@ #include "qzcommon.h" class QVBoxLayout; -class QWebHistory; +class QWebEngineHistory; class QSplitter; class BrowserWindow; @@ -64,7 +64,7 @@ public: QUrl url() const; QString title() const; QIcon icon() const; - QWebHistory* history() const; + QWebEngineHistory* history() const; void detach(); void attach(BrowserWindow* window); diff --git a/src/main/main.cpp b/src/main/main.cpp index 070d42efd..bad4c0195 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -31,11 +31,13 @@ #include #if QT_VERSION >= 0x050000 -#include +#include #else #include "qwebkitversion.h" #endif +#include + void qupzilla_signal_handler(int s) { if (s != SIGSEGV) { @@ -86,7 +88,11 @@ void qupzilla_signal_handler(int s) stream << "Time: " << currentDateTime.toString() << endl; stream << "Qt version: " << qVersion() << " (compiled with " << QT_VERSION_STR << ")" << endl; stream << "QupZilla version: " << Qz::VERSION << endl; +#if QTWEBENGINE_DISABLED stream << "WebKit version: " << qWebKitVersion() << endl; +#else + stream << "WebKit version: QtWebEngine" << endl; +#endif stream << endl; stream << "============== BACKTRACE ==============" << endl; diff --git a/src/main/main.pro b/src/main/main.pro index 39bb5d005..9f1905dfa 100644 --- a/src/main/main.pro +++ b/src/main/main.pro @@ -1,7 +1,7 @@ include(../defines.pri) isEqual(QT_MAJOR_VERSION, 5) { - QT += webkitwidgets network widgets printsupport sql script + QT += webengine webenginewidgets network widgets printsupport sql script } else { QT += core gui webkit sql network script }