From d06a0d60e0ff3e9e3d5dbaec17b3447fca665b92 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Sat, 12 May 2018 03:15:56 +0200 Subject: [PATCH] Fix the fix for #391300 to require only QtWebEngine 5.10, not Qt 5.10 QtWebEngine can be newer than the rest of Qt (e.g., on Fedora 27). This fixes the version check in WebView::savePageAs to use a macro defined in config.h.cmake based on the version of QtWebEngineWidgets rather than relying on QT_VERSION, which is the version of QtCore. Reviewed By: drosca Differential Revision: https://phabricator.kde.org/D12833 CCBUG: 391300 --- CMakeLists.txt | 2 ++ config.h.cmake | 3 +++ src/lib/webengine/webview.cpp | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e3125ee4..1dd3adc7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,8 @@ if (WIN32) add_definitions(-D_WIN32_WINNT=${ver}) endif() +set(HAVE_QTWEBENGINE_5_10 NOT Qt5WebEngineWidgets_VERSION VERSION_LESS 5.10.0) + # Mandatory: OpenSSL find_package(OpenSSL REQUIRED) diff --git a/config.h.cmake b/config.h.cmake index d35648e5b..3cc5d3484 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -9,3 +9,6 @@ /* Disable DBus support */ #cmakedefine DISABLE_DBUS + +/* QtWebEngine is at least version 5.10 */ +#cmakedefine01 HAVE_QTWEBENGINE_5_10 diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index 28228a856..73003773d 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -495,7 +495,7 @@ void WebView::copyLinkToClipboard() void WebView::savePageAs() { -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) +#if HAVE_QTWEBENGINE_5_10 page()->runJavaScript(QSL("document.contentType"), WebPage::SafeJsWorld, [this](const QVariant &res) { const QSet webPageTypes = { QSL("text/html"),