diff --git a/resources/text/CHANGELOG b/resources/text/CHANGELOG
index a7c9dde09..cde7ce5ea 100755
--- a/resources/text/CHANGELOG
+++ b/resources/text/CHANGELOG
@@ -3,7 +3,7 @@
Main:
-▪ Internal web browser and message preview window now use component based on Chromium/Blink (QtWebEngine).
+▪ Internal web browser and message preview window now use component based on Chromium/Blink (QtWebEngine). Note that new QtWebEngine lacks some features and those were thus removed from RSS Guard, including Adblock, mouse gestures and some other features. Note that I was force to switch to this component because old Qt WebKit component will be removed from Qt.
▪ RSS Guard now uses only Qt 5.6 or higher.
Added:
diff --git a/src/gui/dialogs/formsettings.cpp b/src/gui/dialogs/formsettings.cpp
index 490dea5d4..3c43fad51 100755
--- a/src/gui/dialogs/formsettings.cpp
+++ b/src/gui/dialogs/formsettings.cpp
@@ -382,7 +382,6 @@ void FormSettings::onProxyTypeChanged(int index) {
void FormSettings::loadBrowser() {
// Load settings of web browser GUI.
- m_ui->m_checkMouseGestures->setChecked(m_settings->value(GROUP(Browser), SETTING(Browser::GesturesEnabled)).toBool());
m_ui->m_checkQueueTabs->setChecked(m_settings->value(GROUP(Browser), SETTING(Browser::QueueTabs)).toBool());
m_ui->m_cmbExternalBrowserPreset->addItem(tr("Opera 12 or older"), QSL("-nosession %1"));
m_ui->m_txtExternalBrowserExecutable->setText(m_settings->value(GROUP(Browser), SETTING(Browser::CustomExternalBrowserExecutable)).toString());
@@ -403,7 +402,6 @@ void FormSettings::loadBrowser() {
void FormSettings::saveBrowser() {
// Save settings of GUI of web browser.
m_settings->setValue(GROUP(Browser), Browser::CustomExternalBrowserEnabled, m_ui->m_grpCustomExternalBrowser->isChecked());
- m_settings->setValue(GROUP(Browser), Browser::GesturesEnabled, m_ui->m_checkMouseGestures->isChecked());
m_settings->setValue(GROUP(Browser), Browser::QueueTabs, m_ui->m_checkQueueTabs->isChecked());
m_settings->setValue(GROUP(Browser), Browser::CustomExternalBrowserExecutable, m_ui->m_txtExternalBrowserExecutable->text());
m_settings->setValue(GROUP(Browser), Browser::CustomExternalBrowserArguments, m_ui->m_txtExternalBrowserArguments->text());
diff --git a/src/gui/dialogs/formsettings.ui b/src/gui/dialogs/formsettings.ui
index 3251ff0b8..b958a898d 100755
--- a/src/gui/dialogs/formsettings.ui
+++ b/src/gui/dialogs/formsettings.ui
@@ -88,7 +88,7 @@
-
- 3
+ 5
@@ -470,7 +470,7 @@ Authors of this application are NOT responsible for lost data.
QTabWidget::North
- 1
+ 0
@@ -913,7 +913,7 @@ Authors of this application are NOT responsible for lost data.
-
- Enable external plugins based on NPAPI
+ Enable external plugins
@@ -924,32 +924,6 @@ Authors of this application are NOT responsible for lost data.
- -
-
-
- Enable mouse gestures
-
-
-
- -
-
-
-
- true
-
-
-
- Mouse gestures work with middle mouse button. Possible gestures are:
- • previous web page (drag mouse left),
- • next web page (drag mouse right),
- • reload current web page (drag mouse up),
- • open new web browser tab (drag mouse down).
-
-
- 20
-
-
-
@@ -1639,7 +1613,6 @@ Authors of this application are NOT responsible for lost data.
m_checkEnableJavascript
m_checkEnablePlugins
m_checkAutoLoadImages
- m_checkMouseGestures
m_grpCustomExternalBrowser
m_txtExternalBrowserExecutable
m_btnExternalBrowserExecutable
diff --git a/src/miscellaneous/settings.cpp b/src/miscellaneous/settings.cpp
index ebbdaf032..ba4009a54 100755
--- a/src/miscellaneous/settings.cpp
+++ b/src/miscellaneous/settings.cpp
@@ -238,9 +238,6 @@ DKEY Keyboard::ID = "keyboard";
// Web browser.
DKEY Browser::ID = "browser";
-DKEY Browser::GesturesEnabled = "gestures_enabled";
-DVALUE(bool) Browser::GesturesEnabledDef = true;
-
DKEY Browser::JavascriptEnabled = "enable_javascript";
DVALUE(bool) Browser::JavascriptEnabledDef = true;
diff --git a/src/miscellaneous/settings.h b/src/miscellaneous/settings.h
index 8413c21bf..ed5113e8f 100755
--- a/src/miscellaneous/settings.h
+++ b/src/miscellaneous/settings.h
@@ -267,9 +267,6 @@ namespace Keyboard {
namespace Browser {
KEY ID;
- KEY GesturesEnabled;
- VALUE(bool) GesturesEnabledDef;
-
KEY JavascriptEnabled;
VALUE(bool) JavascriptEnabledDef;
diff --git a/src/network-web/webbrowser.cpp b/src/network-web/webbrowser.cpp
index cff01a927..cc7078e3a 100755
--- a/src/network-web/webbrowser.cpp
+++ b/src/network-web/webbrowser.cpp
@@ -18,7 +18,6 @@
#include "network-web/webbrowser.h"
#include "definitions/definitions.h"
-#include "network-web/webpage.h"
#include "network-web/webview.h"
#include "network-web/networkfactory.h"
#include "miscellaneous/skinfactory.h"
@@ -191,8 +190,6 @@ void WebBrowser::createConnections() {
// Connect this WebBrowser to global TabWidget.
TabWidget *tab_widget = qApp->mainForm()->tabWidget();
- connect(m_webView, SIGNAL(newTabRequested()), tab_widget, SLOT(addEmptyBrowser()));
- connect(m_webView, SIGNAL(linkMiddleClicked(QUrl)), tab_widget, SLOT(addLinkedBrowser(QUrl)));
// Change location textbox status according to webpage status.
connect(m_webView, SIGNAL(loadStarted()), this, SLOT(onLoadingStarted()));
@@ -316,7 +313,6 @@ void WebBrowser::setupIcons() {
m_actionForward->setIcon(qApp->icons()->fromTheme(QSL("go-next")));
m_actionReload->setIcon(qApp->icons()->fromTheme(QSL("go-refresh")));
m_actionStop->setIcon(qApp->icons()->fromTheme(QSL("go-stop")));
- m_webView->setupIcons();
}
QIcon WebBrowser::icon() const {
diff --git a/src/network-web/webpage.cpp b/src/network-web/webpage.cpp
deleted file mode 100755
index fc792a383..000000000
--- a/src/network-web/webpage.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// This file is part of RSS Guard.
-//
-// Copyright (C) 2011-2016 by Martin Rotter
-//
-// RSS Guard is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// RSS Guard is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with RSS Guard. If not, see .
-
-#include "network-web/webpage.h"
-
-
-WebPage::WebPage(QObject *parent) : QWebEnginePage(parent) {
-}
-
-WebPage::~WebPage() {
-}
diff --git a/src/network-web/webpage.h b/src/network-web/webpage.h
deleted file mode 100755
index 231c8b3df..000000000
--- a/src/network-web/webpage.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// This file is part of RSS Guard.
-//
-// Copyright (C) 2011-2016 by Martin Rotter
-//
-// RSS Guard is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// RSS Guard is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with RSS Guard. If not, see .
-
-#ifndef WEBPAGE_H
-#define WEBPAGE_H
-
-#include
-
-
-class WebPage : public QWebEnginePage {
- Q_OBJECT
-
- public:
- // Constructors and destructors.
- explicit WebPage(QObject *parent = 0);
- virtual ~WebPage();
-};
-
-#endif // WEBPAGE_H
diff --git a/src/network-web/webview.cpp b/src/network-web/webview.cpp
index b967c79a3..1ca3663f4 100755
--- a/src/network-web/webview.cpp
+++ b/src/network-web/webview.cpp
@@ -18,259 +18,20 @@
#include "network-web/webview.h"
#include "definitions/definitions.h"
-#include "miscellaneous/settings.h"
-#include "miscellaneous/skinfactory.h"
-#include "miscellaneous/iconfactory.h"
-#include "miscellaneous/textfactory.h"
-#include "network-web/webpage.h"
-#include "network-web/webfactory.h"
-#include "gui/messagebox.h"
-#include "gui/dialogs/formmain.h"
-#include
-#include
-#include
-#include
-#include
#include
-#include
-#include
-#include
-#include
-#include
+#include
WebView::WebView(QWidget *parent)
- : QWebEngineView(parent), m_page(new WebPage(this)) {
+ : QWebEngineView(parent), m_page(new QWebEnginePage(this)) {
setPage(m_page);
- initializeActions();
- createConnections();
}
WebView::~WebView() {
qDebug("Destroying WebView.");
}
-void WebView::copySelectedText() {
- Application::clipboard()->setText(selectedText());
-}
-
-void WebView::openLinkInNewTab() {
- emit linkMiddleClicked(m_contextLinkUrl);
-}
-
-void WebView::openLinkExternally() {
- WebFactory::instance()->openUrlInExternalBrowser(m_contextLinkUrl.toString());
-}
-
-void WebView::openImageInNewTab() {
- emit linkMiddleClicked(m_contextImageUrl);
-}
-
-void WebView::searchTextViaGoogle() {
- emit linkMiddleClicked(QString(GOOGLE_SEARCH_URL).arg((selectedText())));
-}
-
-void WebView::saveCurrentPageToFile() {
- QString selected_file;
- const QString implicit_file_base_name = tr("source_page");
-
- // NOTE: It is good to always ask for destination here, since download manager
- // is not displaying afterwards because this is *not* real download actually.
- //if (qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::AlwaysPromptForFilename)).toBool()) {
- const QString filter_html = tr("HTML web pages (*.html)");
-
- QString filter;
- QString selected_filter;
- const QString filename_for_prompt = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::TargetExplicitDirectory)).toString() +
- QDir::separator() + implicit_file_base_name + QL1S(".html");
-
- // Add more filters here.
- filter += filter_html;
- selected_file = QFileDialog::getSaveFileName(this, tr("Select destination file for web page"),
- filename_for_prompt, filter, &selected_filter);
-
- if (!selected_file.isEmpty()) {
- qApp->settings()->setValue(GROUP(Downloads), Downloads::TargetExplicitDirectory,
- QDir::toNativeSeparators(QFileInfo(selected_file).absolutePath()));
- }
- /*}
- else {
- QString base_folder = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::TargetDirectory)).toString();
-
- if (!base_folder.endsWith(QDir::separator())) {
- base_folder += QDir::separator();
- }
-
- selected_file = base_folder + implicit_file_base_name + QL1S(".html");
-
- if (QFile::exists(selected_file)) {
- int file_suffix = 0;
- QString subsequent_file_name;
-
- do {
- subsequent_file_name = base_folder + QString(implicit_file_base_name + QL1S("-%1.html")).arg(file_suffix++);
- } while (QFile::exists(subsequent_file_name));
-
- selected_file = subsequent_file_name;
- }
- }*/
-
- if (!selected_file.isEmpty()) {
- page()->toHtml([this, selected_file](const QString &html) {
- QFile selected_file_handle(selected_file);
-
- if (selected_file_handle.open(QIODevice::WriteOnly | QIODevice::Unbuffered)) {
- QTextStream str(&selected_file_handle);
-
- str.setCodec("UTF-16");
- str << html;
- selected_file_handle.close();
- }
- else {
- MessageBox::show(this, QMessageBox::Critical, tr("Cannot save web page"),
- tr("Web page cannot be saved because destination file is not writtable."));
- }
- });
- }
-}
-
-void WebView::createConnections() {
- connect(m_actionSavePageAs, SIGNAL(triggered()), this, SLOT(saveCurrentPageToFile()));
- connect(m_actionPrint, SIGNAL(triggered()), this, SLOT(printCurrentPage()));
- connect(m_actionOpenLinkNewTab, SIGNAL(triggered()), this, SLOT(openLinkInNewTab()));
- connect(m_actionOpenImageNewTab, SIGNAL(triggered()), this, SLOT(openImageInNewTab()));
- connect(m_actionOpenLinkExternally, SIGNAL(triggered()), this, SLOT(openLinkExternally()));
- connect(m_actionLookupText, SIGNAL(triggered()), this, SLOT(searchTextViaGoogle()));
-}
-
-void WebView::setupIcons() {
- m_actionPrint->setIcon(qApp->icons()->fromTheme(QSL("print-web-page")));
- m_actionCopySelectedItem->setIcon(qApp->icons()->fromTheme(QSL("edit-copy")));
- m_actionCopyLink->setIcon(qApp->icons()->fromTheme(QSL("edit-copy")));
- m_actionCopyImage->setIcon(qApp->icons()->fromTheme(QSL("edit-copy-image")));
- m_actionSaveHyperlinkAs->setIcon(qApp->icons()->fromTheme(QSL("document-download")));
- m_actionSaveImageAs->setIcon(qApp->icons()->fromTheme(QSL("document-download")));
- m_actionCopyImageUrl->setIcon(qApp->icons()->fromTheme(QSL("edit-copy")));
- m_actionOpenLinkThisTab->setIcon(qApp->icons()->fromTheme(QSL("item-open-internal")));
- m_actionOpenLinkNewTab->setIcon(qApp->icons()->fromTheme(QSL("item-open-internal")));
- m_actionOpenLinkExternally->setIcon(qApp->icons()->fromTheme(QSL("item-open-external")));
- m_actionOpenImageNewTab->setIcon(qApp->icons()->fromTheme(QSL("edit-copy-image")));
-
- m_actionLookupText->setIcon(qApp->icons()->fromTheme(QSL("item-search-google")));
-}
-
-void WebView::initializeActions() {
- m_actionPrint = new QAction(tr("Print"), this);
- m_actionPrint->setToolTip(tr("Print current web page."));
-
- m_actionCopySelectedItem = pageAction(QWebEnginePage::Copy);
- m_actionCopySelectedItem->setParent(this);
-
- m_actionSaveHyperlinkAs = pageAction(QWebEnginePage::DownloadLinkToDisk);
- m_actionSaveHyperlinkAs->setParent(this);
-
- m_actionCopyLink = pageAction(QWebEnginePage::CopyLinkToClipboard);
- m_actionCopyLink->setParent(this);
-
- m_actionCopyImage = pageAction(QWebEnginePage::CopyImageToClipboard);
- m_actionCopyImage->setParent(this);
-
- m_actionSaveImageAs = pageAction(QWebEnginePage::DownloadImageToDisk);
- m_actionSaveImageAs->setParent(this);
- m_actionSavePageAs = new QAction(qApp->icons()->fromTheme(QSL("document-download")), tr("Save page as..."), this);
-
- m_actionCopyImageUrl = pageAction(QWebEnginePage::CopyImageUrlToClipboard);
- m_actionCopyImageUrl->setParent(this);
-
- m_actionOpenLinkNewTab = pageAction(QWebEnginePage::OpenLinkInNewTab);
- m_actionOpenLinkNewTab->setParent(this);
-
- m_actionOpenLinkThisTab = pageAction(QWebEnginePage::OpenLinkInThisWindow);
- m_actionOpenLinkThisTab->setParent(this);
-
- m_actionOpenLinkExternally = new QAction(tr("Open link in external browser"), this);
-
- // TODO: bude fungovat?
- m_actionOpenImageNewTab = pageAction(QWebEnginePage::OpenLinkInNewTab);
- m_actionOpenImageNewTab->setParent(this);
-
- m_actionLookupText = new QAction("", this);
-}
-
-void WebView::setActionTexts() {
- m_actionCopySelectedItem->setText(tr("Copy selection"));
- m_actionCopySelectedItem->setToolTip(tr("Copies current selection into the clipboard."));
- m_actionSaveHyperlinkAs->setText(tr("Save target as..."));
- m_actionSaveHyperlinkAs->setToolTip(tr("Download content from the hyperlink."));
- m_actionCopyLink->setText(tr("Copy link url"));
- m_actionCopyLink->setToolTip(tr("Copy link url to clipboard."));
- m_actionCopyImage->setText(tr("Copy image"));
- m_actionCopyImage->setToolTip(tr("Copy image to clipboard."));
- m_actionSaveImageAs->setText(tr("Save image as..."));
- m_actionSaveImageAs->setToolTip(tr("Save image to disk."));
-
- m_actionCopyImageUrl->setText(tr("Copy image url"));
- m_actionCopyImageUrl->setToolTip(tr("Copy image url to clipboard."));
-
- m_actionOpenLinkNewTab->setText(tr("Open link in new tab"));
- m_actionOpenLinkNewTab->setToolTip(tr("Open this hyperlink in new tab."));
- m_actionOpenLinkThisTab->setText(tr("Follow link"));
- m_actionOpenLinkThisTab->setToolTip(tr("Open the hyperlink in this tab."));
- m_actionOpenLinkExternally->setToolTip(tr("Open the hyperlink in external browser."));
- m_actionOpenImageNewTab->setText(tr("Open image in new tab"));
- m_actionOpenImageNewTab->setToolTip(tr("Open this image in this tab."));
-}
-
-void WebView::printCurrentPage() {
- QScopedPointer print_preview(new QPrintPreviewDialog(this));
- connect(print_preview.data(), SIGNAL(paintRequested(QPrinter*)), this, SLOT(print(QPrinter*)));
- print_preview.data()->exec();
-}
-
-void WebView::mousePressEvent(QMouseEvent *event) {
- if (event->button() & Qt::MiddleButton) {
- m_gestureOrigin = event->pos();
- }
- else {
- QWebEngineView::mousePressEvent(event);
- }
-}
-
-void WebView::mouseReleaseEvent(QMouseEvent *event) {
- if (event->button() & Qt::MiddleButton) {
- const bool are_gestures_enabled = qApp->settings()->value(GROUP(Browser), SETTING(Browser::GesturesEnabled)).toBool();
-
- if (are_gestures_enabled) {
- const QPoint release_point = event->pos();
- int left_move = m_gestureOrigin.x() - release_point.x();
- int right_move = -left_move;
- int top_move = m_gestureOrigin.y() - release_point.y();
- int bottom_move = -top_move;
- int total_max = qMax(qMax(qMax(left_move, right_move), qMax(top_move, bottom_move)), 40);
-
- if (total_max == left_move) {
- back();
- }
- else if (total_max == right_move) {
- forward();
- }
- else if (total_max == top_move) {
- reload();
- }
- else if (total_max == bottom_move) {
- emit newTabRequested();
- }
- }
- }
-
- QWebEngineView::mouseReleaseEvent(event);
-}
-
-void WebView::contextMenuEvent(QContextMenuEvent *event) {
- QWebEngineView::contextMenuEvent(event);
-}
-
void WebView::wheelEvent(QWheelEvent *event) {
if (event->modifiers() & Qt::ControlModifier) {
if (event->delta() > 0) {
diff --git a/src/network-web/webview.h b/src/network-web/webview.h
index ae5a06b9f..a6adbb75e 100755
--- a/src/network-web/webview.h
+++ b/src/network-web/webview.h
@@ -21,10 +21,6 @@
#include
-class QAction;
-class QPaintEvent;
-class WebPage;
-
class WebView : public QWebEngineView {
Q_OBJECT
@@ -34,20 +30,11 @@ class WebView : public QWebEngineView {
virtual ~WebView();
// Page accessor.
- inline WebPage *page() const {
+ inline QWebEnginePage *page() const {
return m_page;
}
- void setupIcons();
-
signals:
- // Is emitted if user wants to open some hyperlink in new
- // web browser tab.
- void linkMiddleClicked(const QUrl &link_url);
-
- // User wants to open new empty web browser tab.
- void newTabRequested();
-
// Emitted if user changes zoom factor via CTRL + mouse wheel combo.
void zoomFactorChanged();
@@ -57,52 +44,12 @@ class WebView : public QWebEngineView {
bool decreaseWebPageZoom();
bool resetWebPageZoom();
- void copySelectedText();
- void openLinkInNewTab();
- void openLinkExternally();
- void openImageInNewTab();
- void searchTextViaGoogle();
- void saveCurrentPageToFile();
- void printCurrentPage();
-
protected:
- // Initializes all actions.
- void initializeActions();
-
- void setActionTexts();
-
- // Creates necessary connections.
- void createConnections();
-
// Customize mouse wheeling.
void wheelEvent(QWheelEvent *event);
- // Provides custom mouse actions.
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
-
- void contextMenuEvent(QContextMenuEvent *event);
-
private:
- WebPage *m_page;
-
- QAction *m_actionPrint;
- QAction *m_actionCopySelectedItem;
- QAction *m_actionCopyLink;
- QAction *m_actionCopyImage;
- QAction *m_actionSavePageAs;
- QAction *m_actionSaveHyperlinkAs;
- QAction *m_actionSaveImageAs;
- QAction *m_actionCopyImageUrl;
- QAction *m_actionOpenLinkThisTab;
- QAction *m_actionOpenLinkNewTab;
- QAction *m_actionOpenLinkExternally;
- QAction *m_actionOpenImageNewTab;
- QAction *m_actionLookupText;
-
- QPoint m_gestureOrigin;
- QUrl m_contextLinkUrl;
- QUrl m_contextImageUrl;
+ QWebEnginePage *m_page;
};
#endif // BASEWEBVIEW_H