diff --git a/CMakeLists.txt b/CMakeLists.txt index ed9c14308..8410fb570 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ endif() add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_USE_QSTRINGBUILDER -DQT_NO_CAST_TO_ASCII) # Mandatory: Qt5 -set(QT_MIN_VERSION "5.10.0") +set(QT_MIN_VERSION "5.9.0") find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network Sql QuickWidgets PrintSupport WebEngine WebEngineWidgets WebChannel) if (BUILD_TESTING) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Test) diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index cb403f01b..34634f40d 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -929,7 +929,10 @@ void MainApplication::loadSettings() webSettings->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, true); webSettings->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true); webSettings->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false); + +#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0) webSettings->setAttribute(QWebEngineSettings::AllowWindowActivationFromJavaScript, settings.value(QSL("allowJavaScriptActivateWindow"), false).toBool()); +#endif #if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 11, 0) webSettings->setAttribute(QWebEngineSettings::JavascriptCanPaste, settings.value(QSL("allowJavaScriptPaste"), true).toBool()); diff --git a/src/lib/preferences/jsoptions.cpp b/src/lib/preferences/jsoptions.cpp index 44604a08b..8bd06d097 100644 --- a/src/lib/preferences/jsoptions.cpp +++ b/src/lib/preferences/jsoptions.cpp @@ -30,6 +30,10 @@ JsOptions::JsOptions(QWidget* parent) ui->setupUi(this); +#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 10, 0) + ui->jscanActivateWindow->setVisible(false); +#endif + #if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 11, 0) ui->jscanPaste->setVisible(false); #endif diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index f275b15fd..a2506c1c8 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -496,6 +496,7 @@ void WebView::copyLinkToClipboard() void WebView::savePageAs() { +#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0) page()->runJavaScript(QSL("document.contentType"), WebPage::SafeJsWorld, [this](const QVariant &res) { const QSet webPageTypes = { QSL("text/html"), @@ -507,6 +508,9 @@ void WebView::savePageAs() page()->download(url()); } }); +#else + triggerPageAction(QWebEnginePage::SavePage); +#endif } void WebView::copyImageToClipboard()