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

Remove Qt5 support

This commit is contained in:
Juraj Oravec 2023-11-17 20:58:45 +01:00
parent 21ab3bf8b1
commit e02a8ee664
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
65 changed files with 73 additions and 618 deletions

View File

@ -10,6 +10,10 @@ set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_
# Project name and version # Project name and version
project(Falkon VERSION ${RELEASE_SERVICE_VERSION}) project(Falkon VERSION ${RELEASE_SERVICE_VERSION})
set(KF_MAJOR_VERSION "6")
set(QT_MIN_VERSION "6.4.0")
set(KF_MIN_VERSION "5.240.0")
# Find ECM, with nice error handling in case of failure # Find ECM, with nice error handling in case of failure
include(FeatureSummary) include(FeatureSummary)
find_package(ECM 5.78.0 CONFIG) find_package(ECM 5.78.0 CONFIG)
@ -26,15 +30,6 @@ include(ECMSetupVersion)
include(ECMAddAppIcon) include(ECMAddAppIcon)
include(ECMQtDeclareLoggingCategory) include(ECMQtDeclareLoggingCategory)
include(ECMPoQmTools) include(ECMPoQmTools)
if (QT_MAJOR_VERSION STREQUAL "6")
set(QT_MIN_VERSION "6.4.0")
set(KF_MIN_VERSION "5.240.0")
set(KF_MAJOR_VERSION "6")
else()
set(QT_MIN_VERSION "5.15.0")
set(KF_MIN_VERSION "5.78.0")
set(KF_MAJOR_VERSION "5")
endif()
# Output dirs (like ECM 5.38 does) # Output dirs (like ECM 5.38 does)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
@ -60,13 +55,8 @@ add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_USE_QSTRINGBUILDER -DQT_NO_CAS
# Mandatory: Qt5/6 # Mandatory: Qt5/6
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network Sql QuickWidgets PrintSupport WebChannel) find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network Sql QuickWidgets PrintSupport WebChannel)
if (QT_MAJOR_VERSION STREQUAL "6") find_package(Qt6WebEngineCore ${QT_MIN_VERSION} REQUIRED)
find_package(Qt6WebEngineCore ${QT_MIN_VERSION} REQUIRED) find_package(Qt6WebEngineWidgets ${QT_MIN_VERSION} REQUIRED)
find_package(Qt6WebEngineWidgets ${QT_MIN_VERSION} REQUIRED)
else()
find_package(Qt5WebEngine ${QT_MIN_VERSION} REQUIRED)
find_package(Qt5WebEngineWidgets ${QT_MIN_VERSION} REQUIRED)
endif()
if (BUILD_TESTING) if (BUILD_TESTING)
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS Test) find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS Test)
endif() endif()
@ -77,9 +67,6 @@ endif()
if (UNIX AND NOT APPLE AND NOT NO_X11) if (UNIX AND NOT APPLE AND NOT NO_X11)
add_definitions(-DQZ_WS_X11) add_definitions(-DQZ_WS_X11)
find_package(XCB REQUIRED COMPONENTS XCB UTIL) find_package(XCB REQUIRED COMPONENTS XCB UTIL)
if (NOT (QT_MAJOR_VERSION STREQUAL "6"))
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras)
endif()
endif() endif()
if (WIN32) if (WIN32)
add_definitions(-DW7API) add_definitions(-DW7API)
@ -108,14 +95,12 @@ if (WIN32)
add_definitions(-D_WIN32_WINNT=${ver}) add_definitions(-D_WIN32_WINNT=${ver})
endif() endif()
if (QT_MAJOR_VERSION STREQUAL "6") find_package(Qt6Core5Compat)
find_package(Qt6Core5Compat)
endif()
# Mandatory: OpenSSL # Mandatory: OpenSSL
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
# Mandatory: KF5/6 # Mandatory: KF6
find_package(KF${KF_MAJOR_VERSION} REQUIRED COMPONENTS Archive) find_package(KF${KF_MAJOR_VERSION} REQUIRED COMPONENTS Archive)
# KF5I18n: Mandatory with downloaded translations (only for ki18n_install) # KF5I18n: Mandatory with downloaded translations (only for ki18n_install)
@ -152,30 +137,17 @@ endif()
# Optional: PySide2 # Optional: PySide2
option(BUILD_PYTHON_SUPPORT "Support for Python plugins" ON) option(BUILD_PYTHON_SUPPORT "Support for Python plugins" ON)
if (BUILD_PYTHON_SUPPORT) if (BUILD_PYTHON_SUPPORT)
if (QT_MAJOR_VERSION STREQUAL "6") # Optional: PySide6
# Optional: PySide6 find_package(PySide6 "6.4.0")
find_package(PySide6 "6.4.0") find_package(Shiboken6 "6.4.0")
find_package(Shiboken6 "6.4.0") find_package(Shiboken6Tools "6.4.0")
find_package(Shiboken6Tools "6.4.0") find_package(Python3 COMPONENTS Development)
find_package(Python3 COMPONENTS Development) set_package_properties(PySide6 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
set_package_properties(PySide6 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL) set_package_properties(Shiboken6 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
set_package_properties(Shiboken6 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL) set_package_properties(Shiboken6Tools PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
set_package_properties(Shiboken6Tools PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL) set_package_properties(Python3 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
set_package_properties(Python3 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL) if (PySide6_FOUND AND Shiboken6_FOUND AND Shiboken6Tools_FOUND AND Python3_FOUND)
if (PySide6_FOUND AND Shiboken6_FOUND AND Shiboken6Tools_FOUND AND Python3_FOUND) set(ENABLE_PYTHON_PLUGINS TRUE)
set(ENABLE_PYTHON_PLUGINS TRUE)
endif()
else()
# Optional: PySide2
find_package(PySide2 "2.0.0")
find_package(Shiboken2 "2.0.0")
find_package(Python3 COMPONENTS Development)
set_package_properties(PySide2 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
set_package_properties(Shiboken2 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
set_package_properties(Python3 PROPERTIES DESCRIPTION "Python plugins" TYPE OPTIONAL)
if (PySide2_FOUND AND Shiboken2_FOUND AND Python3_FOUND)
set(ENABLE_PYTHON_PLUGINS TRUE)
endif()
endif() endif()
endif() endif()

View File

@ -307,11 +307,7 @@ void FancyTabBar::paintEvent(QPaintEvent* event)
} }
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void FancyTab::enterEvent(QEvent*)
#else
void FancyTab::enterEvent(QEnterEvent*) void FancyTab::enterEvent(QEnterEvent*)
#endif
{ {
fadeIn(); fadeIn();
} }

View File

@ -86,11 +86,7 @@ public:
QString text; QString text;
protected: protected:
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void enterEvent(QEvent *event) override;
#else
void enterEvent(QEnterEvent *event) override; void enterEvent(QEnterEvent *event) override;
#endif
void leaveEvent(QEvent*) override; void leaveEvent(QEvent*) override;
private: private:

View File

@ -43,10 +43,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QDataStream> #include <QDataStream>
#include <QTime> #include <QTime>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#include <QRegExp> #include <QRegExp>
#endif
#include "../config.h" #include "../config.h"
#if defined(Q_OS_LINUX) && !defined(DISABLE_DBUS) #if defined(Q_OS_LINUX) && !defined(DISABLE_DBUS)
@ -114,11 +111,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
#endif #endif
prefix = id.section(QLatin1Char('/'), -1); prefix = id.section(QLatin1Char('/'), -1);
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
prefix.remove(QRegExp("[^a-zA-Z]"));
#else
prefix = QRegExp("[^a-zA-Z]").removeIn(prefix); prefix = QRegExp("[^a-zA-Z]").removeIn(prefix);
#endif
prefix.truncate(6); prefix.truncate(6);
QByteArray idc = id.toUtf8(); QByteArray idc = id.toUtf8();

View File

@ -160,11 +160,7 @@ void StyleHelper::verticalGradient(QPainter* painter, const QRect &spanRect, con
clipRect.height(), keyColor.rgb()); clipRect.height(), keyColor.rgb());
QPixmap pixmap; QPixmap pixmap;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (!QPixmapCache::find(key, pixmap)) {
#else
if (!QPixmapCache::find(key, &pixmap)) { if (!QPixmapCache::find(key, &pixmap)) {
#endif
pixmap = QPixmap(clipRect.size()); pixmap = QPixmap(clipRect.size());
QPainter p(&pixmap); QPainter p(&pixmap);
QRect rect(0, 0, clipRect.width(), clipRect.height()); QRect rect(0, 0, clipRect.width(), clipRect.height());
@ -187,11 +183,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
QPixmap cache; QPixmap cache;
QString pixmapName = QSL("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height()); QString pixmapName = QSL("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height());
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (!QPixmapCache::find(pixmapName, cache)) {
#else
if (!QPixmapCache::find(pixmapName, &cache)) { if (!QPixmapCache::find(pixmapName, &cache)) {
#endif
QPixmap px = icon.pixmap(rect.size(), iconMode); QPixmap px = icon.pixmap(rect.size(), iconMode);
px.setDevicePixelRatio(qApp->devicePixelRatio()); px.setDevicePixelRatio(qApp->devicePixelRatio());
cache = QPixmap(px.size() + QSize(radius * 2, radius * 2)); cache = QPixmap(px.size() + QSize(radius * 2, radius * 2));

View File

@ -577,41 +577,23 @@ qt_add_resources(SRCS
add_library(FalkonPrivate SHARED ${SRCS} ${LOGGING_SRCS}) add_library(FalkonPrivate SHARED ${SRCS} ${LOGGING_SRCS})
if (QT_MAJOR_VERSION STREQUAL "6") get_property(QT_WEBENGINE_INCLUDE_DIRS TARGET Qt6::WebEngineCore PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(QT_WEBENGINE_INCLUDE_DIRS TARGET Qt6::WebEngineCore PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
else()
get_property(QT_WEBENGINE_INCLUDE_DIRS TARGET Qt::WebEngine PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
endif()
target_include_directories(FalkonPrivate SYSTEM PUBLIC ${QT_WEBENGINE_INCLUDE_DIRS}) target_include_directories(FalkonPrivate SYSTEM PUBLIC ${QT_WEBENGINE_INCLUDE_DIRS})
if (QT_MAJOR_VERSION STREQUAL "6") target_link_libraries(FalkonPrivate
target_link_libraries(FalkonPrivate Qt6::Widgets
Qt6::Widgets Qt6::WebEngineWidgets
Qt6::WebEngineWidgets Qt6::Network
Qt6::Network Qt6::NetworkPrivate
Qt6::NetworkPrivate Qt6::Sql
Qt6::Sql Qt6::PrintSupport
Qt6::PrintSupport Qt6::QuickWidgets
Qt6::QuickWidgets Qt6::WebChannel
Qt6::WebChannel Qt6::Core5Compat
Qt6::Core5Compat KF6::Archive
KF6::Archive ${OPENSSL_CRYPTO_LIBRARY}
${OPENSSL_CRYPTO_LIBRARY} )
)
else()
target_link_libraries(FalkonPrivate
Qt::Widgets
Qt::WebEngineWidgets
Qt::Network
Qt::Sql
Qt::PrintSupport
Qt::QuickWidgets
Qt::WebChannel
KF5::Archive
${OPENSSL_CRYPTO_LIBRARY}
)
endif()
if (HAVE_LIBINTL) if (HAVE_LIBINTL)
target_include_directories(FalkonPrivate SYSTEM PUBLIC ${Intl_INCLUDE_DIRS}) target_include_directories(FalkonPrivate SYSTEM PUBLIC ${Intl_INCLUDE_DIRS})
@ -621,9 +603,6 @@ endif()
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
if (NOT NO_X11) if (NOT NO_X11)
target_link_libraries(FalkonPrivate XCB::XCB) target_link_libraries(FalkonPrivate XCB::XCB)
if (NOT (QT_MAJOR_VERSION STREQUAL "6"))
target_link_libraries(FalkonPrivate Qt::X11Extras)
endif()
endif() endif()
set_target_properties(FalkonPrivate PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION "3") set_target_properties(FalkonPrivate PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION "3")

View File

@ -296,11 +296,7 @@ void AdBlockManager::load()
} }
QTextStream textStream(&file); QTextStream textStream(&file);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
textStream.setCodec("UTF-8");
#else
textStream.setEncoding(QStringConverter::Utf8); textStream.setEncoding(QStringConverter::Utf8);
#endif
QString title = textStream.readLine(1024).remove(QLatin1String("Title: ")); QString title = textStream.readLine(1024).remove(QLatin1String("Title: "));
QUrl url = QUrl(textStream.readLine(1024).remove(QLatin1String("Url: "))); QUrl url = QUrl(textStream.readLine(1024).remove(QLatin1String("Url: ")));

View File

@ -53,16 +53,12 @@
#include <QWebEnginePage> #include <QWebEnginePage>
#include <QWebEngineUrlRequestInfo> #include <QWebEngineUrlRequestInfo>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) /* TODO Qt6 Replace with PUBLIC API */
#include <QtCore/private/qurl_p.h> #include <QtCore/private/qurl_p.h>
#include <QtNetwork/private/qtldurl_p.h> #include <QtNetwork/private/qtldurl_p.h>
#endif
static QString getTopLevelDomain(const QUrl &url) static QString getTopLevelDomain(const QUrl &url)
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
return url.topLevelDomain();
#else
// QUrl::topLevelDomain() was removed in Qt6. // QUrl::topLevelDomain() was removed in Qt6.
// The following is copied from the old "qTopLevelDomain" code in Qt6::Network. // The following is copied from the old "qTopLevelDomain" code in Qt6::Network.
// It was removed in this commit: https://github.com/qt/qtbase/commit/50b30976837be0969efdccced68cfb584d99981a // It was removed in this commit: https://github.com/qt/qtbase/commit/50b30976837be0969efdccced68cfb584d99981a
@ -81,7 +77,6 @@ static QString getTopLevelDomain(const QUrl &url)
//return qt_ACE_do(tld, ToAceOnly, AllowLeadingDot, {}); //return qt_ACE_do(tld, ToAceOnly, AllowLeadingDot, {});
// TODO QT6 - QUrl::toAce() uses ForbidLeadingDot, while the old QUrl::topLevelDomain() used AllowLeadingDot. Does this matter? // TODO QT6 - QUrl::toAce() uses ForbidLeadingDot, while the old QUrl::topLevelDomain() used AllowLeadingDot. Does this matter?
return QString(QUrl::toAce(tld)); return QString(QUrl::toAce(tld));
#endif
} }
static QString toSecondLevelDomain(const QUrl &url) static QString toSecondLevelDomain(const QUrl &url)

View File

@ -103,11 +103,7 @@ void AdBlockSubscription::loadSubscription(const QStringList &disabledRules)
} }
QTextStream textStream(&file); QTextStream textStream(&file);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) textStream.setEncoding(QStringConverter::Utf8);
textStream.setCodec("UTF-8");
#else
textStream.setEncoding(QStringConverter::Utf8);
#endif
// Header is on 3rd line // Header is on 3rd line
textStream.readLine(1024); textStream.readLine(1024);
textStream.readLine(1024); textStream.readLine(1024);
@ -310,11 +306,7 @@ void AdBlockCustomList::loadSubscription(const QStringList &disabledRules)
if (file.open(QFile::WriteOnly | QFile::Append)) { if (file.open(QFile::WriteOnly | QFile::Append)) {
QTextStream stream(&file); QTextStream stream(&file);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
stream.setCodec("UTF-8");
#else
stream.setEncoding(QStringConverter::Utf8); stream.setEncoding(QStringConverter::Utf8);
#endif
if (!rules.contains(ddg1 + QL1S("\n"))) if (!rules.contains(ddg1 + QL1S("\n")))
stream << ddg1 << Qt::endl; stream << ddg1 << Qt::endl;
@ -337,11 +329,7 @@ void AdBlockCustomList::saveSubscription()
} }
QTextStream textStream(&file); QTextStream textStream(&file);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
textStream.setCodec("UTF-8");
#else
textStream.setEncoding(QStringConverter::Utf8); textStream.setEncoding(QStringConverter::Utf8);
#endif
textStream << "Title: " << title() << Qt::endl; textStream << "Title: " << title() << Qt::endl;
textStream << "Url: " << url().toString() << Qt::endl; textStream << "Url: " << url().toString() << Qt::endl;
textStream << "[Adblock Plus 1.1.1]" << Qt::endl; textStream << "[Adblock Plus 1.1.1]" << Qt::endl;

View File

@ -72,9 +72,6 @@
#include <QWebEngineHistory> #include <QWebEngineHistory>
#include <QWebEngineSettings> #include <QWebEngineSettings>
#include <QMessageBox> #include <QMessageBox>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QDesktopWidget>
#endif
#include <QToolTip> #include <QToolTip>
#include <QScrollArea> #include <QScrollArea>
#include <QCollator> #include <QCollator>
@ -82,9 +79,6 @@
#include <QActionGroup> #include <QActionGroup>
#ifdef QZ_WS_X11 #ifdef QZ_WS_X11
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QX11Info>
#endif
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_atom.h> #include <xcb/xcb_atom.h>
#endif #endif
@ -405,11 +399,7 @@ void BrowserWindow::setupUi()
m_statusBar->addButton(downloadsButton); m_statusBar->addButton(downloadsButton);
m_navigationToolbar->addToolButton(downloadsButton); m_navigationToolbar->addToolButton(downloadsButton);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QDesktopWidget* desktop = mApp->desktop();
#else
auto desktop = QGuiApplication::primaryScreen(); auto desktop = QGuiApplication::primaryScreen();
#endif
int windowWidth = desktop->availableGeometry().width() / 1.3; int windowWidth = desktop->availableGeometry().width() / 1.3;
int windowHeight = desktop->availableGeometry().height() / 1.3; int windowHeight = desktop->availableGeometry().height() / 1.3;
@ -1573,14 +1563,10 @@ void BrowserWindow::closeTab()
#ifdef QZ_WS_X11 #ifdef QZ_WS_X11
static xcb_connection_t *getXcbConnection() static xcb_connection_t *getXcbConnection()
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
return QX11Info::connection();
#else
const QNativeInterface::QX11Application *x11App = qApp->nativeInterface<QNativeInterface::QX11Application>(); const QNativeInterface::QX11Application *x11App = qApp->nativeInterface<QNativeInterface::QX11Application>();
if (x11App == nullptr) if (x11App == nullptr)
return 0; return 0;
return x11App->connection(); return x11App->connection();
#endif
} }
int BrowserWindow::getCurrentVirtualDesktop() const int BrowserWindow::getCurrentVirtualDesktop() const

View File

@ -62,9 +62,6 @@
#include <QDir> #include <QDir>
#include <QStandardPaths> #include <QStandardPaths>
#include <QWebEngineProfile> #include <QWebEngineProfile>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QWebEngineDownloadItem>
#endif
#include <QWebEngineScriptCollection> #include <QWebEngineScriptCollection>
#include <QRegularExpression> #include <QRegularExpression>
#include <QtWebEngineWidgetsVersion> #include <QtWebEngineWidgetsVersion>
@ -298,11 +295,7 @@ MainApplication::MainApplication(int &argc, char** argv)
NetworkManager::registerSchemes(); NetworkManager::registerSchemes();
registerAllowedSchemes(); registerAllowedSchemes();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
m_webProfile = isPrivate() ? new QWebEngineProfile() : QWebEngineProfile::defaultProfile();
#else
m_webProfile = isPrivate() ? new QWebEngineProfile() : new QWebEngineProfile(QSL("Default")); m_webProfile = isPrivate() ? new QWebEngineProfile() : new QWebEngineProfile(QSL("Default"));
#endif
connect(m_webProfile, &QWebEngineProfile::downloadRequested, this, &MainApplication::downloadRequested); connect(m_webProfile, &QWebEngineProfile::downloadRequested, this, &MainApplication::downloadRequested);
m_webProfile->setNotificationPresenter([&] (std::unique_ptr<QWebEngineNotification> notification) { m_webProfile->setNotificationPresenter([&] (std::unique_ptr<QWebEngineNotification> notification) {
@ -408,11 +401,9 @@ MainApplication::~MainApplication()
delete m_cookieJar; delete m_cookieJar;
m_cookieJar = nullptr; m_cookieJar = nullptr;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
// On Qt 6, deleting the web profile is necessary in order to make sure cache, cookies, etc. are flushed to disk. // On Qt 6, deleting the web profile is necessary in order to make sure cache, cookies, etc. are flushed to disk.
delete m_webProfile; delete m_webProfile;
m_webProfile = nullptr; m_webProfile = nullptr;
#endif
Settings::syncSettings(); Settings::syncSettings();
} }
@ -946,11 +937,7 @@ void MainApplication::runDeferredPostLaunchActions()
checkOptimizeDatabase(); checkOptimizeDatabase();
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void MainApplication::downloadRequested(QWebEngineDownloadItem *download)
#else
void MainApplication::downloadRequested(QWebEngineDownloadRequest *download) void MainApplication::downloadRequested(QWebEngineDownloadRequest *download)
#endif
{ {
downloadManager()->download(download); downloadManager()->download(download);
} }
@ -1016,11 +1003,7 @@ void MainApplication::loadSettings()
webSettings->setFontSize(QWebEngineSettings::MinimumLogicalFontSize, settings.value(QSL("MinimumLogicalFontSize"), 5).toInt()); webSettings->setFontSize(QWebEngineSettings::MinimumLogicalFontSize, settings.value(QSL("MinimumLogicalFontSize"), 5).toInt());
settings.endGroup(); settings.endGroup();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QWebEngineProfile* profile = QWebEngineProfile::defaultProfile();
#else
QWebEngineProfile* profile = m_webProfile; QWebEngineProfile* profile = m_webProfile;
#endif
profile->setPersistentCookiesPolicy(QWebEngineProfile::AllowPersistentCookies); profile->setPersistentCookiesPolicy(QWebEngineProfile::AllowPersistentCookies);
profile->setPersistentStoragePath(DataPaths::currentProfilePath()); profile->setPersistentStoragePath(DataPaths::currentProfilePath());
@ -1210,17 +1193,9 @@ void MainApplication::setUserStyleSheet(const QString &filePath)
userCss += QzTools::readAllFileContents(filePath).remove(QLatin1Char('\n')); userCss += QzTools::readAllFileContents(filePath).remove(QLatin1Char('\n'));
const QString name = QStringLiteral("_falkon_userstylesheet"); const QString name = QStringLiteral("_falkon_userstylesheet");
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QWebEngineScript oldScript = m_webProfile->scripts()->findScript(name);
if (!oldScript.isNull()) {
m_webProfile->scripts()->remove(oldScript);
}
#else
for (const QWebEngineScript &oldScript : m_webProfile->scripts()->find(name)) { for (const QWebEngineScript &oldScript : m_webProfile->scripts()->find(name)) {
m_webProfile->scripts()->remove(oldScript); m_webProfile->scripts()->remove(oldScript);
} }
#endif
if (userCss.isEmpty()) if (userCss.isEmpty())
return; return;

View File

@ -31,11 +31,7 @@ class QMenu;
class QWebEngineProfile; class QWebEngineProfile;
class QWebEngineSettings; class QWebEngineSettings;
class QNetworkAccessManager; class QNetworkAccessManager;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
class QWebEngineDownloadItem;
#else
class QWebEngineDownloadRequest; class QWebEngineDownloadRequest;
#endif
class History; class History;
class AutoFill; class AutoFill;
@ -150,11 +146,7 @@ private Q_SLOTS:
void onFocusChanged(); void onFocusChanged();
void runDeferredPostLaunchActions(); void runDeferredPostLaunchActions();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void downloadRequested(QWebEngineDownloadItem *download);
#else
void downloadRequested(QWebEngineDownloadRequest *download); void downloadRequested(QWebEngineDownloadRequest *download);
#endif
private: private:
enum PostLaunchAction { enum PostLaunchAction {

View File

@ -249,9 +249,6 @@ QByteArray AutoFill::exportPasswords()
QByteArray output; QByteArray output;
QXmlStreamWriter stream(&output); QXmlStreamWriter stream(&output);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
stream.setCodec("UTF-8");
#endif
stream.setAutoFormatting(true); stream.setAutoFormatting(true);
stream.writeStartDocument(); stream.writeStartDocument();

View File

@ -49,11 +49,7 @@ bool HtmlExporter::exportBookmarks(BookmarkItem* root)
} }
QTextStream stream(&file); QTextStream stream(&file);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) stream.setEncoding(QStringConverter::Utf8);
stream.setCodec("UTF-8");
#else
stream.setEncoding(QStringConverter::Utf8);
#endif
stream << "<!DOCTYPE NETSCAPE-Bookmark-file-1>" << Qt::endl; stream << "<!DOCTYPE NETSCAPE-Bookmark-file-1>" << Qt::endl;
stream << "<!-- This is an automatically generated file." << Qt::endl; stream << "<!-- This is an automatically generated file." << Qt::endl;

View File

@ -25,11 +25,7 @@
OperaImporter::OperaImporter(QObject* parent) OperaImporter::OperaImporter(QObject* parent)
: BookmarksImporter(parent) : BookmarksImporter(parent)
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) m_stream.setEncoding(QStringConverter::Utf8);
m_stream.setCodec("UTF-8");
#else
m_stream.setEncoding(QStringConverter::Utf8);
#endif
} }
QString OperaImporter::description() const QString OperaImporter::description() const

View File

@ -256,11 +256,7 @@ QString BookmarksToolbarButton::createTooltip() const
return m_bookmark->urlString(); return m_bookmark->urlString();
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void BookmarksToolbarButton::enterEvent(QEvent* event)
#else
void BookmarksToolbarButton::enterEvent(QEnterEvent* event) void BookmarksToolbarButton::enterEvent(QEnterEvent* event)
#endif
{ {
QPushButton::enterEvent(event); QPushButton::enterEvent(event);

View File

@ -63,11 +63,7 @@ private:
void init(); void init();
QString createTooltip() const; QString createTooltip() const;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void enterEvent(QEvent *event) override;
#else
void enterEvent(QEnterEvent *event) override; void enterEvent(QEnterEvent *event) override;
#endif
void leaveEvent(QEvent* event) override; void leaveEvent(QEvent* event) override;
void mousePressEvent(QMouseEvent* event) override; void mousePressEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent* event) override; void mouseReleaseEvent(QMouseEvent* event) override;

View File

@ -35,11 +35,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QFileIconProvider> #include <QFileIconProvider>
#include <QDesktopServices> #include <QDesktopServices>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QWebEngineDownloadItem>
#else
#include <QWebEngineDownloadRequest> #include <QWebEngineDownloadRequest>
#endif
#include <QtWebEngineWidgetsVersion> #include <QtWebEngineWidgetsVersion>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -49,7 +45,7 @@
//#define DOWNMANAGER_DEBUG //#define DOWNMANAGER_DEBUG
DownloadItem::DownloadItem(QListWidgetItem *item, Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS* downloadItem, const QString &path, const QString &fileName, bool openFile, DownloadManager* manager) DownloadItem::DownloadItem(QListWidgetItem *item, QWebEngineDownloadRequest* downloadItem, const QString &path, const QString &fileName, bool openFile, DownloadManager* manager)
: QWidget() : QWidget()
, ui(new Ui::DownloadItem) , ui(new Ui::DownloadItem)
, m_item(item) , m_item(item)
@ -85,14 +81,9 @@ DownloadItem::DownloadItem(QListWidgetItem *item, Q_WEB_ENGINE_DOWNLOAD_ITEM_CLA
void DownloadItem::startDownloading() void DownloadItem::startDownloading()
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
connect(m_download, &QWebEngineDownloadItem::finished, this, &DownloadItem::finished);
connect(m_download, &QWebEngineDownloadItem::downloadProgress, this, &DownloadItem::downloadProgress);
#else
connect(m_download, &QWebEngineDownloadRequest::isFinishedChanged, this, &DownloadItem::finished); connect(m_download, &QWebEngineDownloadRequest::isFinishedChanged, this, &DownloadItem::finished);
connect(m_download, &QWebEngineDownloadRequest::receivedBytesChanged, this, &DownloadItem::receivedOrTotalBytesChanged); connect(m_download, &QWebEngineDownloadRequest::receivedBytesChanged, this, &DownloadItem::receivedOrTotalBytesChanged);
connect(m_download, &QWebEngineDownloadRequest::totalBytesChanged, this, &DownloadItem::receivedOrTotalBytesChanged); connect(m_download, &QWebEngineDownloadRequest::totalBytesChanged, this, &DownloadItem::receivedOrTotalBytesChanged);
#endif
m_downloading = true; m_downloading = true;
if (!m_downTimer.isValid()) { if (!m_downTimer.isValid()) {
@ -133,16 +124,16 @@ void DownloadItem::finished()
QString host = m_download->url().host(); QString host = m_download->url().host();
switch (m_download->state()) { switch (m_download->state()) {
case Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::DownloadCompleted: case QWebEngineDownloadRequest::DownloadCompleted:
success = true; success = true;
ui->downloadInfo->setText(tr("Done - %1 (%2)").arg(host, QLocale().toString(QDateTime::currentDateTime(), QLocale::ShortFormat))); ui->downloadInfo->setText(tr("Done - %1 (%2)").arg(host, QLocale().toString(QDateTime::currentDateTime(), QLocale::ShortFormat)));
break; break;
case Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::DownloadInterrupted: case QWebEngineDownloadRequest::DownloadInterrupted:
ui->downloadInfo->setText(tr("Error - %1").arg(host)); ui->downloadInfo->setText(tr("Error - %1").arg(host));
break; break;
case Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::DownloadCancelled: case QWebEngineDownloadRequest::DownloadCancelled:
ui->downloadInfo->setText(tr("Cancelled - %1").arg(host)); ui->downloadInfo->setText(tr("Cancelled - %1").arg(host));
break; break;
@ -164,15 +155,10 @@ void DownloadItem::finished()
Q_EMIT downloadFinished(true); Q_EMIT downloadFinished(true);
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void DownloadItem::downloadProgress(qint64 received, qint64 total)
{
#else
void DownloadItem::receivedOrTotalBytesChanged() void DownloadItem::receivedOrTotalBytesChanged()
{ {
qint64 received = m_download->receivedBytes(); qint64 received = m_download->receivedBytes();
qint64 total = m_download->totalBytes(); qint64 total = m_download->totalBytes();
#endif
#ifdef DOWNMANAGER_DEBUG #ifdef DOWNMANAGER_DEBUG
qDebug() << __FUNCTION__ << received << total; qDebug() << __FUNCTION__ << received << total;
#endif #endif

View File

@ -35,13 +35,7 @@ class DownloadItem;
} }
class QListWidgetItem; class QListWidgetItem;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
class QWebEngineDownloadItem;
#define Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS QWebEngineDownloadItem
#else
class QWebEngineDownloadRequest; class QWebEngineDownloadRequest;
#define Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS QWebEngineDownloadRequest
#endif
class DownloadManager; class DownloadManager;
@ -50,7 +44,7 @@ class FALKON_EXPORT DownloadItem : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit DownloadItem(QListWidgetItem* item, Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS* downloadItem, const QString &path, const QString &fileName, bool openFile, DownloadManager* manager); explicit DownloadItem(QListWidgetItem* item, QWebEngineDownloadRequest* downloadItem, const QString &path, const QString &fileName, bool openFile, DownloadManager* manager);
bool isDownloading() const { return m_downloading; } bool isDownloading() const { return m_downloading; }
bool isCancelled(); bool isCancelled();
QTime remainingTime() const { return m_remTime; } QTime remainingTime() const { return m_remTime; }
@ -75,11 +69,7 @@ Q_SIGNALS:
private Q_SLOTS: private Q_SLOTS:
void parentResized(const QSize &size); void parentResized(const QSize &size);
void finished(); void finished();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void downloadProgress(qint64 received, qint64 total);
#else
void receivedOrTotalBytesChanged(); void receivedOrTotalBytesChanged();
#endif
void stop(); void stop();
void pauseResume(); void pauseResume();
void openFile(); void openFile();
@ -96,7 +86,7 @@ private:
Ui::DownloadItem* ui; Ui::DownloadItem* ui;
QListWidgetItem* m_item; QListWidgetItem* m_item;
Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS* m_download; QWebEngineDownloadRequest* m_download;
QString m_path; QString m_path;
QString m_fileName; QString m_fileName;
QElapsedTimer m_downTimer; QElapsedTimer m_downTimer;

View File

@ -40,11 +40,7 @@
#include <QShortcut> #include <QShortcut>
#include <QStandardPaths> #include <QStandardPaths>
#include <QWebEngineHistory> #include <QWebEngineHistory>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QWebEngineDownloadItem>
#else
#include <QWebEngineDownloadRequest> #include <QWebEngineDownloadRequest>
#endif
#include <QtWebEngineWidgetsVersion> #include <QtWebEngineWidgetsVersion>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -127,11 +123,7 @@ void DownloadManager::keyPressEvent(QKeyEvent* e)
QWidget::keyPressEvent(e); QWidget::keyPressEvent(e);
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void DownloadManager::closeDownloadTab(QWebEngineDownloadItem *item) const
#else
void DownloadManager::closeDownloadTab(QWebEngineDownloadRequest *item) const void DownloadManager::closeDownloadTab(QWebEngineDownloadRequest *item) const
#endif
{ {
// Attempt to close empty tab that was opened only for loading the download url // Attempt to close empty tab that was opened only for loading the download url
auto testWebView = [](TabbedWebView *view, const QUrl &url) { auto testWebView = [](TabbedWebView *view, const QUrl &url) {
@ -266,7 +258,7 @@ void DownloadManager::clearList()
Q_EMIT downloadsCountChanged(); Q_EMIT downloadsCountChanged();
} }
void DownloadManager::download(Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS *downloadItem) void DownloadManager::download(QWebEngineDownloadRequest *downloadItem)
{ {
QElapsedTimer downloadTimer; QElapsedTimer downloadTimer;
downloadTimer.start(); downloadTimer.start();
@ -276,13 +268,9 @@ void DownloadManager::download(Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS *downloadItem)
QString downloadPath; QString downloadPath;
bool openFile = false; bool openFile = false;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
const QString fileName = QFileInfo(downloadItem->path()).fileName();
#else
const QString fileName = downloadItem->downloadFileName(); const QString fileName = downloadItem->downloadFileName();
#endif
const bool forceAsk = downloadItem->savePageFormat() != Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::UnknownSaveFormat const bool forceAsk = downloadItem->savePageFormat() != QWebEngineDownloadRequest::UnknownSaveFormat
|| downloadItem->isSavePageDownload(); || downloadItem->isSavePageDownload();
if (m_useExternalManager) { if (m_useExternalManager) {
@ -291,7 +279,7 @@ void DownloadManager::download(Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS *downloadItem)
enum Result { Open = 1, Save = 2, ExternalManager = 3, SavePage = 4, Unknown = 0 }; enum Result { Open = 1, Save = 2, ExternalManager = 3, SavePage = 4, Unknown = 0 };
Result result = Unknown; Result result = Unknown;
if (downloadItem->savePageFormat() != Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::UnknownSaveFormat) { if (downloadItem->savePageFormat() != QWebEngineDownloadRequest::UnknownSaveFormat) {
// Save Page requested // Save Page requested
result = SavePage; result = SavePage;
} else if (downloadItem->isSavePageDownload()) { } else if (downloadItem->isSavePageDownload()) {
@ -338,17 +326,17 @@ void DownloadManager::download(Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS *downloadItem)
Settings().setValue(QSL("DownloadManager/lastDownloadPath"), m_lastDownloadPath); Settings().setValue(QSL("DownloadManager/lastDownloadPath"), m_lastDownloadPath);
m_lastDownloadOption = SaveFile; m_lastDownloadOption = SaveFile;
Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::SavePageFormat format = Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::UnknownSaveFormat; QWebEngineDownloadRequest::SavePageFormat format = QWebEngineDownloadRequest::UnknownSaveFormat;
if (selectedFilter == mhtml) { if (selectedFilter == mhtml) {
format = Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::MimeHtmlSaveFormat; format = QWebEngineDownloadRequest::MimeHtmlSaveFormat;
} else if (selectedFilter == htmlSingle) { } else if (selectedFilter == htmlSingle) {
format = Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::SingleHtmlSaveFormat; format = QWebEngineDownloadRequest::SingleHtmlSaveFormat;
} else if (selectedFilter == htmlComplete) { } else if (selectedFilter == htmlComplete) {
format = Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::CompleteHtmlSaveFormat; format = QWebEngineDownloadRequest::CompleteHtmlSaveFormat;
} }
if (format != Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::UnknownSaveFormat) { if (format != QWebEngineDownloadRequest::UnknownSaveFormat) {
downloadItem->setSavePageFormat(format); downloadItem->setSavePageFormat(format);
} }
} }
@ -373,12 +361,8 @@ void DownloadManager::download(Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS *downloadItem)
} }
// Set download path and accept // Set download path and accept
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
downloadItem->setPath(downloadPath);
#else
downloadItem->setDownloadDirectory(QFileInfo(downloadPath).absoluteDir().absolutePath()); downloadItem->setDownloadDirectory(QFileInfo(downloadPath).absoluteDir().absolutePath());
downloadItem->setDownloadFileName(QFileInfo(downloadPath).fileName()); downloadItem->setDownloadFileName(QFileInfo(downloadPath).fileName());
#endif
downloadItem->accept(); downloadItem->accept();
// Create download item // Create download item

View File

@ -32,11 +32,7 @@ class DownloadManager;
class QUrl; class QUrl;
class QNetworkAccessManager; class QNetworkAccessManager;
class QListWidgetItem; class QListWidgetItem;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
class QWebEngineDownloadItem;
#else
class QWebEngineDownloadRequest; class QWebEngineDownloadRequest;
#endif
class QWinTaskbarButton; class QWinTaskbarButton;
class DownloadItem; class DownloadItem;
@ -69,11 +65,7 @@ public:
void loadSettings(); void loadSettings();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void download(QWebEngineDownloadItem *downloadItem);
#else
void download(QWebEngineDownloadRequest *downloadItem); void download(QWebEngineDownloadRequest *downloadItem);
#endif
int downloadsCount() const; int downloadsCount() const;
int activeDownloadsCount() const; int activeDownloadsCount() const;
@ -106,11 +98,7 @@ private:
void resizeEvent(QResizeEvent* e) override; void resizeEvent(QResizeEvent* e) override;
void keyPressEvent(QKeyEvent* e) override; void keyPressEvent(QKeyEvent* e) override;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void closeDownloadTab(QWebEngineDownloadItem *item) const;
#else
void closeDownloadTab(QWebEngineDownloadRequest *item) const; void closeDownloadTab(QWebEngineDownloadRequest *item) const;
#endif
QWinTaskbarButton *taskbarButton(); QWinTaskbarButton *taskbarButton();
Ui::DownloadManager* ui; Ui::DownloadManager* ui;

View File

@ -33,11 +33,7 @@ QVariant DownloadManagerModel::data(const QModelIndex &index, int role) const
{ {
if (role == Qt::DisplayRole) { if (role == Qt::DisplayRole) {
const DownloadItem *item = m_downloads.at(index.row()); const DownloadItem *item = m_downloads.at(index.row());
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
return item;
#else
return QVariant::fromValue(item); return QVariant::fromValue(item);
#endif
} }
return QVariant(); return QVariant();
} }

View File

@ -21,13 +21,9 @@
#include <QClipboard> #include <QClipboard>
#include <QMimeDatabase> #include <QMimeDatabase>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QWebEngineDownloadItem>
#else
#include <QWebEngineDownloadRequest> #include <QWebEngineDownloadRequest>
#endif
DownloadOptionsDialog::DownloadOptionsDialog(const QString &fileName, Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS *downloadItem, QWidget *parent) DownloadOptionsDialog::DownloadOptionsDialog(const QString &fileName, QWebEngineDownloadRequest *downloadItem, QWidget *parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::DownloadOptionsDialog) , ui(new Ui::DownloadOptionsDialog)
, m_downloadItem(downloadItem) , m_downloadItem(downloadItem)

View File

@ -30,18 +30,14 @@ namespace Ui
class DownloadOptionsDialog; class DownloadOptionsDialog;
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
class QWebEngineDownloadItem;
#else
class QWebEngineDownloadRequest; class QWebEngineDownloadRequest;
#endif
class FALKON_EXPORT DownloadOptionsDialog : public QDialog class FALKON_EXPORT DownloadOptionsDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DownloadOptionsDialog(const QString &fileName, Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS *downloadItem, QWidget* parent = nullptr); explicit DownloadOptionsDialog(const QString &fileName, QWebEngineDownloadRequest *downloadItem, QWidget* parent = nullptr);
~DownloadOptionsDialog() override; ~DownloadOptionsDialog() override;
void showExternalManagerOption(bool show); void showExternalManagerOption(bool show);
@ -61,7 +57,7 @@ Q_SIGNALS:
private: private:
Ui::DownloadOptionsDialog* ui; Ui::DownloadOptionsDialog* ui;
Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS *m_downloadItem; QWebEngineDownloadRequest *m_downloadItem;
bool m_signalEmited; bool m_signalEmited;
}; };

View File

@ -324,11 +324,7 @@ int LocationCompleterDelegate::viewItemDrawText(QPainter *p, const QStyleOptionV
highlightParts << highlightedPart; highlightParts << highlightedPart;
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
textLayout.setFormats(QVector<QTextLayout::FormatRange>::fromList(highlightParts));
#else
textLayout.setFormats(highlightParts); textLayout.setFormats(highlightParts);
#endif
} }
} }

View File

@ -40,11 +40,7 @@ LocationCompleterRefreshJob::LocationCompleterRefreshJob(const QString &searchSt
m_watcher = new QFutureWatcher<void>(this); m_watcher = new QFutureWatcher<void>(this);
connect(m_watcher, &QFutureWatcherBase::finished, this, &LocationCompleterRefreshJob::slotFinished); connect(m_watcher, &QFutureWatcherBase::finished, this, &LocationCompleterRefreshJob::slotFinished);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QFuture<void> future = QtConcurrent::run(this, &LocationCompleterRefreshJob::runJob);
#else
QFuture<void> future = QtConcurrent::run(&LocationCompleterRefreshJob::runJob, this); QFuture<void> future = QtConcurrent::run(&LocationCompleterRefreshJob::runJob, this);
#endif
m_watcher->setFuture(future); m_watcher->setFuture(future);
} }

View File

@ -178,11 +178,7 @@ void WebSearchBar::setupEngines()
item.icon = en.icon; item.icon = en.icon;
item.text = en.name; item.text = en.name;
QVariant v; QVariant v;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
v.setValue<SearchEngine>(en);
#else
v.setValue(en); v.setValue(en);
#endif
item.userData = v; item.userData = v;
m_boxSearchType->addItem(item); m_boxSearchType->addItem(item);

View File

@ -70,19 +70,10 @@ NetworkManager::NetworkManager(QObject *parent)
}); });
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
bool NetworkManager::certificateError(const QWebEngineCertificateError &error, QWidget *parent)
#else
bool NetworkManager::certificateError(QWebEngineCertificateError &error, QWidget *parent) bool NetworkManager::certificateError(QWebEngineCertificateError &error, QWidget *parent)
#endif
{ {
const QString &host = error.url().host(); const QString &host = error.url().host();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
const auto errorType = error.error();
#else
const auto errorType = error.type(); const auto errorType = error.type();
#endif
if (m_rejectedSslErrors.contains(host) && m_rejectedSslErrors.value(host) == errorType) { if (m_rejectedSslErrors.contains(host) && m_rejectedSslErrors.value(host) == errorType) {
return false; return false;
@ -93,21 +84,15 @@ bool NetworkManager::certificateError(QWebEngineCertificateError &error, QWidget
return true; return true;
} }
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
// Defer loading the URL until the user prompt has completed. // Defer loading the URL until the user prompt has completed.
if (error.isOverridable()) if (error.isOverridable())
error.defer(); error.defer();
#endif
QString title = tr("SSL Certificate Error!"); QString title = tr("SSL Certificate Error!");
QString text1 = tr("The page you are trying to access has the following errors in the SSL certificate:"); QString text1 = tr("The page you are trying to access has the following errors in the SSL certificate:");
QString text2 = tr("Would you like to make an exception for this certificate?"); QString text2 = tr("Would you like to make an exception for this certificate?");
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
const auto errorDescription = error.errorDescription();
#else
const auto errorDescription = error.description(); const auto errorDescription = error.description();
#endif
QString message = QSL("<b>%1</b><p>%2</p><ul><li>%3</li></ul><p>%4</p>").arg(title, text1, errorDescription, text2); QString message = QSL("<b>%1</b><p>%2</p><ul><li>%3</li></ul><p>%4</p>").arg(title, text1, errorDescription, text2);
SslErrorDialog dialog(parent); SslErrorDialog dialog(parent);
@ -350,11 +335,7 @@ void NetworkManager::registerSchemes()
QNetworkReply *NetworkManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData) QNetworkReply *NetworkManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
{ {
QNetworkRequest req = request; QNetworkRequest req = request;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) /* TODO Use HTTP2 */
// These have either been removed or changed to the default in Qt 6.
req.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
return QNetworkAccessManager::createRequest(op, req, outgoingData); return QNetworkAccessManager::createRequest(op, req, outgoingData);
} }

View File

@ -35,11 +35,7 @@ class FALKON_EXPORT NetworkManager : public QNetworkAccessManager
public: public:
explicit NetworkManager(QObject *parent = nullptr); explicit NetworkManager(QObject *parent = nullptr);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
bool certificateError(const QWebEngineCertificateError &error, QWidget *parent = nullptr);
#else
bool certificateError(QWebEngineCertificateError &error, QWidget *parent = nullptr); bool certificateError(QWebEngineCertificateError &error, QWidget *parent = nullptr);
#endif
void authentication(const QUrl &url, QAuthenticator *auth, QWidget *parent = nullptr); void authentication(const QUrl &url, QAuthenticator *auth, QWidget *parent = nullptr);
void proxyAuthentication(const QString &proxyHost, QAuthenticator *auth, QWidget *parent = nullptr); void proxyAuthentication(const QString &proxyHost, QAuthenticator *auth, QWidget *parent = nullptr);
@ -62,13 +58,8 @@ private:
NetworkUrlInterceptor *m_urlInterceptor; NetworkUrlInterceptor *m_urlInterceptor;
ExtensionSchemeManager *m_extensionScheme; ExtensionSchemeManager *m_extensionScheme;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QHash<QString, QWebEngineCertificateError::Error> m_ignoredSslErrors;
QHash<QString, QWebEngineCertificateError::Error> m_rejectedSslErrors;
#else
QHash<QString, QWebEngineCertificateError::Type> m_ignoredSslErrors; QHash<QString, QWebEngineCertificateError::Type> m_ignoredSslErrors;
QHash<QString, QWebEngineCertificateError::Type> m_rejectedSslErrors; QHash<QString, QWebEngineCertificateError::Type> m_rejectedSslErrors;
#endif
QStringList m_ignoredSslHosts; QStringList m_ignoredSslHosts;
}; };

View File

@ -81,11 +81,7 @@ void EditSearchEngine::setShortcut(const QString &shortcut)
QIcon EditSearchEngine::icon() QIcon EditSearchEngine::icon()
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
return QIcon(*ui->icon->pixmap());
#else
return QIcon(ui->icon->pixmap()); return QIcon(ui->icon->pixmap());
#endif
} }
void EditSearchEngine::setIcon(const QIcon &icon) void EditSearchEngine::setIcon(const QIcon &icon)

View File

@ -173,11 +173,7 @@ SearchEngine SearchEnginesDialog::getEngine(QTreeWidgetItem* item)
void SearchEnginesDialog::setEngine(QTreeWidgetItem* item, const SearchEngine &engine) void SearchEnginesDialog::setEngine(QTreeWidgetItem* item, const SearchEngine &engine)
{ {
QVariant v; QVariant v;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
v.setValue<SearchEngine>(engine);
#else
v.setValue(engine); v.setValue(engine);
#endif
item->setData(0, EngineRole, v); item->setData(0, EngineRole, v);
item->setText(0, engine.name); item->setText(0, engine.name);
} }

View File

@ -28,11 +28,7 @@
#include <QUrlQuery> #include <QUrlQuery>
#include <QNetworkReply> #include <QNetworkReply>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <KArchive/KZip>
#else
#include <KZip> #include <KZip>
#endif
Q_GLOBAL_STATIC(OcsSupport, qz_ocs_support) Q_GLOBAL_STATIC(OcsSupport, qz_ocs_support)

View File

@ -20,9 +20,7 @@
QmlUserScript::QmlUserScript(QObject *parent) QmlUserScript::QmlUserScript(QObject *parent)
: QObject(parent) : QObject(parent)
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
, m_isNull(true) , m_isNull(true)
#endif
{ {
} }
@ -44,11 +42,7 @@ void QmlUserScript::setWebEngineScript(const QWebEngineScript &script)
bool QmlUserScript::null() const bool QmlUserScript::null() const
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
return m_webEngineScript.isNull();
#else
return m_isNull; return m_isNull;
#endif
} }
QString QmlUserScript::name() const QString QmlUserScript::name() const

View File

@ -100,10 +100,8 @@ Q_SIGNALS:
void injectionPointChanged(int injectionPoint); void injectionPointChanged(int injectionPoint);
private: private:
QWebEngineScript m_webEngineScript; QWebEngineScript m_webEngineScript;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
bool m_isNull;
#endif
QBasicTimer m_basicTimer; QBasicTimer m_basicTimer;
bool m_isNull;
bool null() const; bool null() const;
QString name() const; QString name() const;
@ -122,9 +120,7 @@ private:
void setNotNull() void setNotNull()
{ {
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
// TODO QT6: This is a really hacky way of keeping track of whether the script has been initialized - and is it even necessary? // TODO QT6: This is a really hacky way of keeping track of whether the script has been initialized - and is it even necessary?
m_isNull = false; m_isNull = false;
#endif
} }
}; };

View File

@ -67,26 +67,17 @@ QObject *QmlUserScripts::findScript(const QString &name) const
{ {
auto *qmlUserScript = new QmlUserScript(); auto *qmlUserScript = new QmlUserScript();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QWebEngineScript webEngineScript = mApp->webProfile()->scripts()->findScript(name);
qmlUserScript->setWebEngineScript(webEngineScript);
#else
auto scripts = mApp->webProfile()->scripts()->find(name); auto scripts = mApp->webProfile()->scripts()->find(name);
if (!scripts.empty()) { if (!scripts.empty()) {
qmlUserScript->setWebEngineScript(scripts.first()); qmlUserScript->setWebEngineScript(scripts.first());
} }
#endif
return qmlUserScript; return qmlUserScript;
} }
QList<QObject*> QmlUserScripts::findScripts(const QString &name) const QList<QObject*> QmlUserScripts::findScripts(const QString &name) const
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QList<QWebEngineScript> list = mApp->webProfile()->scripts()->findScripts(name);
#else
QList<QWebEngineScript> list = mApp->webProfile()->scripts()->find(name); QList<QWebEngineScript> list = mApp->webProfile()->scripts()->find(name);
#endif
return toQObjectList(list); return toQObjectList(list);
} }

View File

@ -92,11 +92,7 @@ void AutoFillManager::loadPasswords()
item->setText(2, "*****"); item->setText(2, "*****");
QVariant v; QVariant v;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
v.setValue<PasswordEntry>(entry);
#else
v.setValue(entry); v.setValue(entry);
#endif
item->setData(0, Qt::UserRole + 10, v); item->setData(0, Qt::UserRole + 10, v);
ui->treePass->addTopLevelItem(item); ui->treePass->addTopLevelItem(item);
} }
@ -263,11 +259,7 @@ void AutoFillManager::editPass()
if (mApp->autoFill()->updateEntry(entry)) { if (mApp->autoFill()->updateEntry(entry)) {
QVariant v; QVariant v;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
v.setValue<PasswordEntry>(entry);
#else
v.setValue(entry); v.setValue(entry);
#endif
curItem->setData(0, Qt::UserRole + 10, v); curItem->setData(0, Qt::UserRole + 10, v);
if (m_passwordsShown) { if (m_passwordsShown) {

View File

@ -57,9 +57,6 @@
#include <QMessageBox> #include <QMessageBox>
#include <QCloseEvent> #include <QCloseEvent>
#include <QColorDialog> #include <QColorDialog>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QDesktopWidget>
#endif
#include <QWebEngineProfile> #include <QWebEngineProfile>
#include <QWebEngineSettings> #include <QWebEngineSettings>
#include <QLibraryInfo> #include <QLibraryInfo>
@ -533,11 +530,7 @@ Preferences::Preferences(BrowserWindow* window)
ui->listWidget->setCurrentRow(currentSettingsPage); ui->listWidget->setCurrentRow(currentSettingsPage);
QSize s = size(); QSize s = size();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
const QRect &availableGeometryForScreen = QApplication::desktop()->availableGeometry(this);
#else
const QRect &availableGeometryForScreen = screen()->availableGeometry(); const QRect &availableGeometryForScreen = screen()->availableGeometry();
#endif
if (availableGeometryForScreen.size().width() < s.width()) { if (availableGeometryForScreen.size().width() < s.width()) {
s.setWidth(availableGeometryForScreen.size().width() - 50); s.setWidth(availableGeometryForScreen.size().width() - 50);
} }

View File

@ -1359,9 +1359,6 @@ void TabBarHelper::paintEvent(QPaintEvent *)
grabImage.setDevicePixelRatio(devicePixelRatioF()); grabImage.setDevicePixelRatio(devicePixelRatioF());
grabImage.fill(Qt::transparent); grabImage.fill(Qt::transparent);
QStylePainter p(&grabImage, this); QStylePainter p(&grabImage, this);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
p.initFrom(this);
#endif
if (tabDragOffset != 0) { if (tabDragOffset != 0) {
tab.position = QStyleOptionTab::OnlyOneTab; tab.position = QStyleOptionTab::OnlyOneTab;
} }
@ -1814,11 +1811,7 @@ QSize CloseButton::sizeHint() const
return QSize(width, height); return QSize(width, height);
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void CloseButton::enterEvent(QEvent* event)
#else
void CloseButton::enterEvent(QEnterEvent* event) void CloseButton::enterEvent(QEnterEvent* event)
#endif
{ {
if (isEnabled()) { if (isEnabled()) {
update(); update();

View File

@ -364,11 +364,7 @@ public:
QSize sizeHint() const override; QSize sizeHint() const override;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void enterEvent(QEvent *event) override;
#else
void enterEvent(QEnterEvent *event) override; void enterEvent(QEnterEvent *event) override;
#endif
void leaveEvent(QEvent *event) override; void leaveEvent(QEvent *event) override;
void paintEvent(QPaintEvent *event) override; void paintEvent(QPaintEvent *event) override;
}; };

View File

@ -160,11 +160,7 @@ void ButtonWithMenu::generateMenu()
for (const Item &item : qAsConst(m_items)) { for (const Item &item : qAsConst(m_items)) {
QVariant variant; QVariant variant;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
variant.setValue<Item>(item);
#else
variant.setValue(item); variant.setValue(item);
#endif
m_menu->addAction(item.icon, item.text, this, SLOT(setCurrentItem()))->setData(variant); m_menu->addAction(item.icon, item.text, this, SLOT(setCurrentItem()))->setData(variant);
} }
} }

View File

@ -27,9 +27,6 @@ DesktopFile::DesktopFile()
DesktopFile::DesktopFile(const QString &fileName) DesktopFile::DesktopFile(const QString &fileName)
{ {
m_settings.reset(new QSettings(fileName, QSettings::IniFormat)); m_settings.reset(new QSettings(fileName, QSettings::IniFormat));
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
m_settings->setIniCodec("UTF-8");
#endif
m_settings->beginGroup(QSL("Desktop Entry")); m_settings->beginGroup(QSL("Desktop Entry"));
} }

View File

@ -101,11 +101,7 @@ void HTML5PermissionsNotification::grantPermissions()
QTimer::singleShot(0, this, [this]() { QTimer::singleShot(0, this, [this]() {
// We need to have cursor inside view to correctly grab mouse // We need to have cursor inside view to correctly grab mouse
if (m_feature == QWebEnginePage::MouseLock) { if (m_feature == QWebEnginePage::MouseLock) {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QWidget *view = m_page->view();
#else
QWidget *view = QWebEngineView::forPage(m_page); QWidget *view = QWebEngineView::forPage(m_page);
#endif
QCursor::setPos(view->mapToGlobal(view->rect().center())); QCursor::setPos(view->mapToGlobal(view->rect().center()));
} }

View File

@ -33,11 +33,7 @@ PageThumbnailer::PageThumbnailer(QObject* parent)
, m_loadTitle(false) , m_loadTitle(false)
{ {
m_view->setAttribute(Qt::WA_DontShowOnScreen); m_view->setAttribute(Qt::WA_DontShowOnScreen);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
m_view->setSource(QUrl(QSL("qrc:data/thumbnailer-qt5.qml")));
#else
m_view->setSource(QUrl(QSL("qrc:data/thumbnailer.qml"))); m_view->setSource(QUrl(QSL("qrc:data/thumbnailer.qml")));
#endif
m_view->rootContext()->setContextProperty(QSL("thumbnailer"), this); m_view->rootContext()->setContextProperty(QSL("thumbnailer"), this);
m_view->show(); m_view->show();
} }

View File

@ -32,11 +32,7 @@
#include <QWidget> #include <QWidget>
#include <QApplication> #include <QApplication>
#include <QSslCertificate> #include <QSslCertificate>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QDesktopWidget>
#else
#include <QScreen> #include <QScreen>
#endif
#include <QUrl> #include <QUrl>
#include <QIcon> #include <QIcon>
#include <QFileIconProvider> #include <QFileIconProvider>
@ -49,9 +45,6 @@
#include <QtGuiVersion> #include <QtGuiVersion>
#ifdef QZ_WS_X11 #ifdef QZ_WS_X11
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QX11Info>
#endif
#include <xcb/xcb.h> #include <xcb/xcb.h>
#endif #endif
@ -121,11 +114,7 @@ QByteArray QzTools::readAllFileByteContents(const QString &filename)
void QzTools::centerWidgetOnScreen(QWidget* w) void QzTools::centerWidgetOnScreen(QWidget* w)
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QRect screen = QApplication::desktop()->screenGeometry(w);
#else
QRect screen = w->screen()->geometry(); QRect screen = w->screen()->geometry();
#endif
const QRect size = w->geometry(); const QRect size = w->geometry();
w->move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2); w->move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2);
} }
@ -872,14 +861,10 @@ bool QzTools::startExternalProcess(const QString &executable, const QString &arg
#ifdef QZ_WS_X11 #ifdef QZ_WS_X11
static xcb_connection_t *getXcbConnection() static xcb_connection_t *getXcbConnection()
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
return QX11Info::connection();
#else
const QNativeInterface::QX11Application *x11App = qApp->nativeInterface<QNativeInterface::QX11Application>(); const QNativeInterface::QX11Application *x11App = qApp->nativeInterface<QNativeInterface::QX11Application>();
if (x11App == nullptr) if (x11App == nullptr)
return 0; return 0;
return x11App->connection(); return x11App->connection();
#endif
} }
#endif #endif

View File

@ -18,11 +18,7 @@
#include "webhittestresult.h" #include "webhittestresult.h"
#include "webpage.h" #include "webpage.h"
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QWebEngineContextMenuData>
#else
#include <QWebEngineContextMenuRequest> #include <QWebEngineContextMenuRequest>
#endif
WebHitTestResult::WebHitTestResult(const WebPage *page, const QPoint &pos) WebHitTestResult::WebHitTestResult(const WebPage *page, const QPoint &pos)
: m_isNull(true) : m_isNull(true)
@ -96,13 +92,8 @@ WebHitTestResult::WebHitTestResult(const WebPage *page, const QPoint &pos)
init(p->url(), p->execJavaScript(js, WebPage::SafeJsWorld).toMap()); init(p->url(), p->execJavaScript(js, WebPage::SafeJsWorld).toMap());
} }
void WebHitTestResult::updateWithContextMenuData(const Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS &data) void WebHitTestResult::updateWithContextMenuData(const QWebEngineContextMenuRequest &data)
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (!data.isValid()) {
return;
}
#endif
if (data.position() != m_pos) { if (data.position() != m_pos) {
return; return;
} }
@ -113,12 +104,12 @@ void WebHitTestResult::updateWithContextMenuData(const Q_WEB_ENGINE_CONTEXT_MENU
m_isContentSelected = !data.selectedText().isEmpty(); m_isContentSelected = !data.selectedText().isEmpty();
switch (data.mediaType()) { switch (data.mediaType()) {
case Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS::MediaTypeImage: case QWebEngineContextMenuRequest::MediaTypeImage:
m_imageUrl = data.mediaUrl(); m_imageUrl = data.mediaUrl();
break; break;
case Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS::MediaTypeVideo: case QWebEngineContextMenuRequest::MediaTypeVideo:
case Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS::MediaTypeAudio: case QWebEngineContextMenuRequest::MediaTypeAudio:
m_mediaUrl = data.mediaUrl(); m_mediaUrl = data.mediaUrl();
break; break;

View File

@ -25,13 +25,7 @@
#include "qzcommon.h" #include "qzcommon.h"
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
class QWebEngineContextMenuData;
#define Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS QWebEngineContextMenuData
#else
class QWebEngineContextMenuRequest; class QWebEngineContextMenuRequest;
#define Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS QWebEngineContextMenuRequest
#endif
class WebPage; class WebPage;
@ -40,7 +34,7 @@ class FALKON_EXPORT WebHitTestResult
public: public:
explicit WebHitTestResult(const WebPage *page, const QPoint &pos); explicit WebHitTestResult(const WebPage *page, const QPoint &pos);
void updateWithContextMenuData(const Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS &data); void updateWithContextMenuData(const QWebEngineContextMenuRequest &data);
QUrl baseUrl() const; QUrl baseUrl() const;
QString alternateText() const; QString alternateText() const;

View File

@ -89,9 +89,7 @@ WebPage::WebPage(QObject* parent)
connect(this, &QWebEnginePage::windowCloseRequested, this, &WebPage::windowCloseRequested); connect(this, &QWebEnginePage::windowCloseRequested, this, &WebPage::windowCloseRequested);
connect(this, &QWebEnginePage::fullScreenRequested, this, &WebPage::fullScreenRequested); connect(this, &QWebEnginePage::fullScreenRequested, this, &WebPage::fullScreenRequested);
connect(this, &QWebEnginePage::renderProcessTerminated, this, &WebPage::renderProcessTerminated); connect(this, &QWebEnginePage::renderProcessTerminated, this, &WebPage::renderProcessTerminated);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
connect(this, &QWebEnginePage::certificateError, this, &WebPage::onCertificateError); connect(this, &QWebEnginePage::certificateError, this, &WebPage::onCertificateError);
#endif
connect(this, &QWebEnginePage::authenticationRequired, this, [this](const QUrl &url, QAuthenticator *auth) { connect(this, &QWebEnginePage::authenticationRequired, this, [this](const QUrl &url, QAuthenticator *auth) {
mApp->networkManager()->authentication(url, auth, view()); mApp->networkManager()->authentication(url, auth, view());
@ -140,11 +138,7 @@ WebPage::~WebPage()
WebView *WebPage::view() const WebView *WebPage::view() const
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
return static_cast<WebView*>(QWebEnginePage::view());
#else
return static_cast<WebView*>(QWebEngineView::forPage(this)); return static_cast<WebView*>(QWebEngineView::forPage(this));
#endif
} }
bool WebPage::execPrintPage(QPrinter *printer, int timeout) bool WebPage::execPrintPage(QPrinter *printer, int timeout)
@ -153,14 +147,6 @@ bool WebPage::execPrintPage(QPrinter *printer, int timeout)
bool result = false; bool result = false;
QTimer::singleShot(timeout, loop.data(), &QEventLoop::quit); QTimer::singleShot(timeout, loop.data(), &QEventLoop::quit);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
print(printer, [loop, &result](bool res) {
if (loop && loop->isRunning()) {
result = res;
loop->quit();
}
});
#else
connect(view(), &QWebEngineView::printFinished, this, [loop, &result](bool res) { connect(view(), &QWebEngineView::printFinished, this, [loop, &result](bool res) {
if (loop && loop->isRunning()) { if (loop && loop->isRunning()) {
result = res; result = res;
@ -168,7 +154,6 @@ bool WebPage::execPrintPage(QPrinter *printer, int timeout)
} }
}); });
view()->print(printer); view()->print(printer);
#endif
loop->exec(); loop->exec();
delete loop; delete loop;
@ -454,11 +439,6 @@ bool WebPage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::Navigatio
QUrlQuery query(url); QUrlQuery query(url);
mApp->searchEnginesManager()->addEngine(QUrl(query.queryItemValue(QSL("url")))); mApp->searchEnginesManager()->addEngine(QUrl(query.queryItemValue(QSL("url"))));
return false; return false;
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 12, 0)
} else if (url.path() == QL1S("PrintPage")) {
Q_EMIT printRequested();
return false;
#endif
} }
} }
@ -480,12 +460,6 @@ bool WebPage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::Navigatio
return result; return result;
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
bool WebPage::certificateError(const QWebEngineCertificateError &error)
{
return mApp->networkManager()->certificateError(error, view());
}
#else
void WebPage::onCertificateError(QWebEngineCertificateError error) void WebPage::onCertificateError(QWebEngineCertificateError error)
{ {
auto mutableError = const_cast<QWebEngineCertificateError&>(error); auto mutableError = const_cast<QWebEngineCertificateError&>(error);
@ -494,7 +468,6 @@ void WebPage::onCertificateError(QWebEngineCertificateError error)
else else
mutableError.rejectCertificate(); mutableError.rejectCertificate();
} }
#endif
QStringList WebPage::chooseFiles(QWebEnginePage::FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes) QStringList WebPage::chooseFiles(QWebEnginePage::FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes)
{ {

View File

@ -21,9 +21,7 @@
#include <QWebEnginePage> #include <QWebEnginePage>
#include <QWebEngineScript> #include <QWebEngineScript>
#include <QWebEngineFullScreenRequest> #include <QWebEngineFullScreenRequest>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#include <QPrinter> #include <QPrinter>
#endif
#include <QVector> #include <QVector>
#include <QElapsedTimer> #include <QElapsedTimer>
@ -96,15 +94,11 @@ private Q_SLOTS:
void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest); void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest);
void featurePermissionRequested(const QUrl &origin, const QWebEnginePage::Feature &feature); void featurePermissionRequested(const QUrl &origin, const QWebEnginePage::Feature &feature);
void renderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus terminationStatus, int exitCode); void renderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus terminationStatus, int exitCode);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
void onCertificateError(QWebEngineCertificateError error); void onCertificateError(QWebEngineCertificateError error);
#endif
private: private:
bool acceptNavigationRequest(const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) override; bool acceptNavigationRequest(const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) override;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
bool certificateError(const QWebEngineCertificateError &error) override;
#endif
QStringList chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes) override; QStringList chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes) override;
QWebEnginePage* createWindow(QWebEnginePage::WebWindowType type) override; QWebEnginePage* createWindow(QWebEnginePage::WebWindowType type) override;

View File

@ -211,14 +211,9 @@ void WebScrollBarManager::createUserScript(int thickness)
void WebScrollBarManager::removeUserScript() void WebScrollBarManager::removeUserScript()
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QWebEngineScript script = mApp->webProfile()->scripts()->findScript(QSL("_falkon_scrollbar"));
mApp->webProfile()->scripts()->remove(script);
#else
for (const QWebEngineScript &script : mApp->webProfile()->scripts()->find(QSL("_falkon_scrollbar"))) { for (const QWebEngineScript &script : mApp->webProfile()->scripts()->find(QSL("_falkon_scrollbar"))) {
mApp->webProfile()->scripts()->remove(script); mApp->webProfile()->scripts()->remove(script);
} }
#endif
} }
QSize WebScrollBarManager::viewportSize(WebView *view, int thickness) const QSize WebScrollBarManager::viewportSize(WebView *view, int thickness) const

View File

@ -44,11 +44,7 @@
#include <QWebEngineHistory> #include <QWebEngineHistory>
#include <QClipboard> #include <QClipboard>
#include <QMimeData> #include <QMimeData>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QWebEngineContextMenuData>
#else
#include <QWebEngineContextMenuRequest> #include <QWebEngineContextMenuRequest>
#endif
#include <QStackedLayout> #include <QStackedLayout>
#include <QScrollBar> #include <QScrollBar>
#include <QPrintDialog> #include <QPrintDialog>
@ -150,9 +146,6 @@ void WebView::setPage(WebPage *page)
Q_EMIT m_page->loadFinished(true); Q_EMIT m_page->loadFinished(true);
} }
mApp->plugins()->emitWebPageDeleted(m_page); mApp->plugins()->emitWebPageDeleted(m_page);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
m_page->setView(nullptr);
#endif
} }
page->setParent(this); page->setParent(this);
@ -409,17 +402,10 @@ void WebView::printPage()
m_page->printToPdf(dialog->printer()->outputFileName(), dialog->printer()->pageLayout()); m_page->printToPdf(dialog->printer()->outputFileName(), dialog->printer()->pageLayout());
delete dialog; delete dialog;
} else { } else {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
m_page->print(dialog->printer(), [=](bool success) {
Q_UNUSED(success);
delete dialog;
});
#else
connect(this, &QWebEngineView::printFinished, this, [&dialog](bool success) { connect(this, &QWebEngineView::printFinished, this, [&dialog](bool success) {
Q_UNUSED(success); Q_UNUSED(success);
delete dialog; delete dialog;
}); });
#endif
} }
} }
} }
@ -683,14 +669,11 @@ void WebView::createContextMenu(QMenu *menu, WebHitTestResult &hitTest)
// cppcheck-suppress variableScope // cppcheck-suppress variableScope
int spellCheckActionCount = 0; int spellCheckActionCount = 0;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) const QWebEngineContextMenuRequest *contextMenuDataPtr = lastContextMenuRequest();
const Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS &contextMenuData = page()->contextMenuData(); if (contextMenuDataPtr == NULL) {
#else
const Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS *contextMenuDataPtr = lastContextMenuRequest();
if (contextMenuDataPtr == NULL)
return; return;
const Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS &contextMenuData = *contextMenuDataPtr; }
#endif const QWebEngineContextMenuRequest &contextMenuData = *contextMenuDataPtr;
hitTest.updateWithContextMenuData(contextMenuData); hitTest.updateWithContextMenuData(contextMenuData);
@ -1288,11 +1271,7 @@ bool WebView::eventFilter(QObject *obj, QEvent *event)
if (obj == this && event->type() == QEvent::ChildAdded) { if (obj == this && event->type() == QEvent::ChildAdded) {
QPointer<QWidget> child = qobject_cast<QWidget*>(static_cast<QChildEvent*>(event)->child()); QPointer<QWidget> child = qobject_cast<QWidget*>(static_cast<QChildEvent*>(event)->child());
QTimer::singleShot(0, this, [=]() { QTimer::singleShot(0, this, [=]() {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (child && child->inherits("QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget")) {
#else
if (child) { if (child) {
#endif
m_rwhvqt = child; m_rwhvqt = child;
m_rwhvqt->installEventFilter(this); m_rwhvqt->installEventFilter(this);
if (auto *w = qobject_cast<QQuickWidget*>(m_rwhvqt)) { if (auto *w = qobject_cast<QQuickWidget*>(m_rwhvqt)) {

View File

@ -121,12 +121,8 @@ void SearchToolBar::searchText(const QString &text)
{ {
m_searchRequests++; m_searchRequests++;
QPointer<SearchToolBar> guard = this; QPointer<SearchToolBar> guard = this;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
m_view->findText(text, m_findFlags, [=](bool found) {
#else
m_view->findText(text, m_findFlags, [=](QWebEngineFindTextResult result) { m_view->findText(text, m_findFlags, [=](QWebEngineFindTextResult result) {
bool found = result.numberOfMatches() > 0; bool found = result.numberOfMatches() > 0;
#endif
if (!guard) { if (!guard) {
return; return;
} }

View File

@ -182,13 +182,9 @@ void GM_Manager::disableScript(GM_Script* script)
m_disabledScripts.append(script->fullName()); m_disabledScripts.append(script->fullName());
QWebEngineScriptCollection *collection = mApp->webProfile()->scripts(); QWebEngineScriptCollection *collection = mApp->webProfile()->scripts();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
collection->remove(collection->findScript(script->fullName()));
#else
for (const auto &script : collection->find(script->fullName())) { for (const auto &script : collection->find(script->fullName())) {
collection->remove(script); collection->remove(script);
} }
#endif
} }
bool GM_Manager::addScript(GM_Script* script) bool GM_Manager::addScript(GM_Script* script)
@ -216,13 +212,9 @@ bool GM_Manager::removeScript(GM_Script* script, bool removeFile)
m_scripts.removeOne(script); m_scripts.removeOne(script);
QWebEngineScriptCollection *collection = mApp->webProfile()->scripts(); QWebEngineScriptCollection *collection = mApp->webProfile()->scripts();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
collection->remove(collection->findScript(script->fullName()));
#else
for (const auto &script : collection->find(script->fullName())) { for (const auto &script : collection->find(script->fullName())) {
collection->remove(script); collection->remove(script);
} }
#endif
m_disabledScripts.removeOne(script->fullName()); m_disabledScripts.removeOne(script->fullName());
@ -291,13 +283,9 @@ void GM_Manager::scriptChanged()
return; return;
QWebEngineScriptCollection *collection = mApp->webProfile()->scripts(); QWebEngineScriptCollection *collection = mApp->webProfile()->scripts();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
collection->remove(collection->findScript(script->fullName()));
#else
for (const auto &script : collection->find(script->fullName())) { for (const auto &script : collection->find(script->fullName())) {
collection->remove(script); collection->remove(script);
} }
#endif
collection->insert(script->webScript()); collection->insert(script->webScript());
} }

View File

@ -19,11 +19,7 @@
#include "plugininterface.h" #include "plugininterface.h"
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <PurposeWidgets/Menu>
#else
#include <Purpose/Menu> #include <Purpose/Menu>
#endif
class KWalletPasswordBackend; class KWalletPasswordBackend;
class KIOSchemeHandler; class KIOSchemeHandler;

View File

@ -24,13 +24,8 @@
#include <kio_version.h> #include <kio_version.h>
#if KIO_VERSION < QT_VERSION_CHECK(5, 240, 0) #include <QNetworkAccessManager>
#include <KIO/AccessManager> Q_GLOBAL_STATIC_WITH_ARGS(QNetworkAccessManager, s_knam, (nullptr))
Q_GLOBAL_STATIC_WITH_ARGS(KIO::Integration::AccessManager, s_knam, (nullptr))
#else
#include <QNetworkAccessManager>
Q_GLOBAL_STATIC_WITH_ARGS(QNetworkAccessManager, s_knam, (nullptr))
#endif
KIOSchemeHandler::KIOSchemeHandler(const QString &protocol, QObject *parent) KIOSchemeHandler::KIOSchemeHandler(const QString &protocol, QObject *parent)
: QWebEngineUrlSchemeHandler(parent) : QWebEngineUrlSchemeHandler(parent)

View File

@ -20,10 +20,8 @@ set(QT_INCLUDE_DIRS
${QT_WEBENGINECORE_INCLUDE_DIRS} ${QT_WEBENGINECORE_INCLUDE_DIRS}
${QT_WEBENGINEWIDGETS_INCLUDE_DIRS} ${QT_WEBENGINEWIDGETS_INCLUDE_DIRS}
) )
if (QT_MAJOR_VERSION STREQUAL "6") get_property(QT_PRINTSUPPORT_INCLUDE_DIRS TARGET Qt${QT_MAJOR_VERSION}::PrintSupport PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(QT_PRINTSUPPORT_INCLUDE_DIRS TARGET Qt${QT_MAJOR_VERSION}::PrintSupport PROPERTY INTERFACE_INCLUDE_DIRECTORIES) list(APPEND QT_INCLUDE_DIRS ${QT_PRINTSUPPORT_INCLUDE_DIRS})
list(APPEND QT_INCLUDE_DIRS ${QT_PRINTSUPPORT_INCLUDE_DIRS})
endif()
set(INCLUDES "") set(INCLUDES "")
foreach(INCLUDE_DIR ${QT_INCLUDE_DIRS}) foreach(INCLUDE_DIR ${QT_INCLUDE_DIRS})
list(APPEND INCLUDES "-I${INCLUDE_DIR}") list(APPEND INCLUDES "-I${INCLUDE_DIR}")
@ -37,11 +35,7 @@ endforeach()
set(GLOBAL_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/pyfalkon_global.h) set(GLOBAL_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/pyfalkon_global.h)
set(TYPESYSTEM_FILE ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_pyfalkon.xml) set(TYPESYSTEM_FILE ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_pyfalkon.xml)
if (QT_MAJOR_VERSION STREQUAL "6") set(API_VERSION "${Qt6_VERSION_MAJOR}.${Qt6_VERSION_MINOR}")
set(API_VERSION "${Qt6_VERSION_MAJOR}.${Qt6_VERSION_MINOR}")
else()
set(API_VERSION "${Qt5_VERSION_MAJOR}.${Qt5_VERSION_MINOR}")
endif()
set(SHIBOKEN_OPTIONS --generator-set=shiboken --enable-parent-ctor-heuristic set(SHIBOKEN_OPTIONS --generator-set=shiboken --enable-parent-ctor-heuristic
--enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero --enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero
@ -144,11 +138,7 @@ set(GENERATED_SOURCES_DEPENDENCIES
${TYPESYSTEM_FILE} ${TYPESYSTEM_FILE}
) )
if (QT_MAJOR_VERSION STREQUAL "6") set(PYSIDE_VERSION "6")
set(PYSIDE_VERSION "6")
else()
set(PYSIDE_VERSION "2")
endif()
# Add custom target to run shiboken. # Add custom target to run shiboken.
add_custom_command(OUTPUT ${GENERATED_SOURCES} add_custom_command(OUTPUT ${GENERATED_SOURCES}

View File

@ -21,11 +21,7 @@
// PYSIDE-711 // PYSIDE-711
#include <QHstsPolicy> #include <QHstsPolicy>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QWebEngineContextMenuData>
#else
#include <QWebEngineContextMenuRequest> #include <QWebEngineContextMenuRequest>
#endif
// 3rdparty // 3rdparty
#include "lineedit.h" #include "lineedit.h"

View File

@ -267,12 +267,8 @@
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, &amp;%6, %7); %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, &amp;%6, %7);
%PYARG_0 = PyTuple_New(2); %PYARG_0 = PyTuple_New(2);
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_)); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
#if (QT_VERSION &lt; QT_VERSION_CHECK(6, 0, 0))
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG6_TYPE](%6));
#else
auto ARG6_PTR = &amp;%6; auto ARG6_PTR = &amp;%6;
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG6_TYPE](ARG6_PTR)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG6_TYPE](ARG6_PTR));
#endif
</template> </template>
<suppress-warning text="Unable to translate type &quot;std::function&lt;QPoint (QSize)&gt;&quot;:*"/> <suppress-warning text="Unable to translate type &quot;std::function&lt;QPoint (QSize)&gt;&quot;:*"/>

View File

@ -23,26 +23,15 @@
#include "browserwindow.h" #include "browserwindow.h"
#include <QMenu> #include <QMenu>
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QNetworkConfigurationManager>
#endif
SBI_NetworkIcon::SBI_NetworkIcon(BrowserWindow* window) SBI_NetworkIcon::SBI_NetworkIcon(BrowserWindow* window)
: SBI_Icon(window) : SBI_Icon(window)
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
, m_networkConfiguration(new QNetworkConfigurationManager(this))
#endif
{ {
setObjectName(QSL("sbi_networkicon")); setObjectName(QSL("sbi_networkicon"));
setCursor(Qt::PointingHandCursor); setCursor(Qt::PointingHandCursor);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) /* TODO rework connection detection */
onlineStateChanged(m_networkConfiguration->isOnline());
connect(m_networkConfiguration, &QNetworkConfigurationManager::onlineStateChanged, this, &SBI_NetworkIcon::onlineStateChanged);
#else
onlineStateChanged(true); onlineStateChanged(true);
#endif
connect(this, &ClickableLabel::clicked, this, &SBI_NetworkIcon::showMenu); connect(this, &ClickableLabel::clicked, this, &SBI_NetworkIcon::showMenu);
} }
@ -105,18 +94,9 @@ void SBI_NetworkIcon::updateToolTip()
{ {
QString tooltip = tr("Shows network status and manages proxy<br/><br/><b>Network:</b><br/>%1<br/><br/><b>Proxy:</b><br/>%2"); QString tooltip = tr("Shows network status and manages proxy<br/><br/><b>Network:</b><br/>%1<br/><br/><b>Proxy:</b><br/>%2");
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (m_networkConfiguration->isOnline()) {
tooltip = tooltip.arg(tr("Connected"));
}
else {
tooltip = tooltip.arg(tr("Offline"));
}
#else
// TODO QT6 - in Qt6 we're always reporting as online, should we just remove this functionality instead? // TODO QT6 - in Qt6 we're always reporting as online, should we just remove this functionality instead?
// Or is there a way to detect network status in Qt6? // Or is there a way to detect network status in Qt6?
tooltip = tooltip.arg(tr("Connected")); tooltip = tooltip.arg(tr("Connected"));
#endif
switch (QNetworkProxy::applicationProxy().type()) { switch (QNetworkProxy::applicationProxy().type()) {
case QNetworkProxy::DefaultProxy: case QNetworkProxy::DefaultProxy:
@ -139,11 +119,7 @@ void SBI_NetworkIcon::updateToolTip()
setToolTip(tooltip); setToolTip(tooltip);
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void SBI_NetworkIcon::enterEvent(QEvent* event)
#else
void SBI_NetworkIcon::enterEvent(QEnterEvent* event) void SBI_NetworkIcon::enterEvent(QEnterEvent* event)
#endif
{ {
updateToolTip(); updateToolTip();

View File

@ -40,16 +40,7 @@ private Q_SLOTS:
private: private:
void updateToolTip(); void updateToolTip();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
void enterEvent(QEvent* event) override;
#else
void enterEvent(QEnterEvent* event) override; void enterEvent(QEnterEvent* event) override;
#endif
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
// TODO QT6 - should we try to replace the online status detection using Qt 6?
QNetworkConfigurationManager* m_networkConfiguration;
#endif
}; };
#endif // SBI_NETWORKICON_H #endif // SBI_NETWORKICON_H

View File

@ -244,11 +244,7 @@ void TabManagerDelegate::viewItemDrawText(QPainter *p, const QStyleOptionViewIte
highlightParts << highlightedPart; highlightParts << highlightedPart;
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
textLayout.setAdditionalFormats(highlightParts);
#else
textLayout.setFormats(highlightParts); textLayout.setFormats(highlightParts);
#endif
} }
} }

View File

@ -34,19 +34,13 @@
#include "tabcontextmenu.h" #include "tabcontextmenu.h"
#include "tabbar.h" #include "tabbar.h"
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QDesktopWidget>
#endif
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QStackedWidget> #include <QStackedWidget>
#include <QDialog> #include <QDialog>
#include <QTimer> #include <QTimer>
#include <QLabel> #include <QLabel>
#include <QMimeData> #include <QMimeData>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#include <QRegExp> #include <QRegExp>
#endif
TLDExtractor* TabManagerWidget::s_tldExtractor = 0; TLDExtractor* TabManagerWidget::s_tldExtractor = 0;
@ -128,11 +122,7 @@ QString TabManagerWidget::domainFromUrl(const QUrl &url, bool useHostName)
return urlString.append(appendString); return urlString.append(appendString);
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (useHostName || host.contains(QRegExp(R"(^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)"))) {
#else
if (useHostName || QRegExp(R"(^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)").indexIn(host) >= 0) { if (useHostName || QRegExp(R"(^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)").indexIn(host) >= 0) {
#endif
if (host.startsWith("www.", Qt::CaseInsensitive)) { if (host.startsWith("www.", Qt::CaseInsensitive)) {
host.remove(0, 4); host.remove(0, 4);
} }
@ -571,11 +561,7 @@ void TabManagerWidget::detachSelectedTabs(const QMultiHash<BrowserWindow*, WebTa
} }
BrowserWindow* newWindow = mApp->createWindow(Qz::BW_OtherRestoredWindow); BrowserWindow* newWindow = mApp->createWindow(Qz::BW_OtherRestoredWindow);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
const QRect &availableGeometryForScreen = mApp->desktop()->availableGeometry(this);
#else
const QRect &availableGeometryForScreen = screen()->availableGeometry(); const QRect &availableGeometryForScreen = screen()->availableGeometry();
#endif
newWindow->move(availableGeometryForScreen.topLeft() + QPoint(30, 30)); newWindow->move(availableGeometryForScreen.topLeft() + QPoint(30, 30));
detachTabsTo(newWindow, tabsHash); detachTabsTo(newWindow, tabsHash);
@ -895,11 +881,7 @@ QStringList TabTreeWidget::mimeTypes() const
return types; return types;
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QMimeData *TabTreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const
#else
QMimeData *TabTreeWidget::mimeData(const QList<QTreeWidgetItem*> &items) const QMimeData *TabTreeWidget::mimeData(const QList<QTreeWidgetItem*> &items) const
#endif
{ {
auto* mimeData = new QMimeData(); auto* mimeData = new QMimeData();
QByteArray encodedData; QByteArray encodedData;

View File

@ -44,11 +44,7 @@ public:
Qt::DropActions supportedDropActions() const override; Qt::DropActions supportedDropActions() const override;
QStringList mimeTypes() const override; QStringList mimeTypes() const override;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QMimeData* mimeData(const QList<QTreeWidgetItem*> items) const override;
#else
QMimeData* mimeData(const QList<QTreeWidgetItem*> &items) const override; QMimeData* mimeData(const QList<QTreeWidgetItem*> &items) const override;
#endif
bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) override; bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) override;
void setEnableDragTabs(bool enable); void setEnableDragTabs(bool enable);

View File

@ -25,11 +25,7 @@
#include "statusbar.h" #include "statusbar.h"
#include "navigationbar.h" #include "navigationbar.h"
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QDesktopWidget>
#else
#include <QScreen> #include <QScreen>
#endif
#include <QAction> #include <QAction>
#include <QStyle> #include <QStyle>
@ -217,11 +213,7 @@ void TabManagerWidgetController::showSideBySide()
return; return;
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
const QRect &availableGeometry = mApp->desktop()->availableGeometry(defaultTabManager());
#else
const QRect &availableGeometry = defaultTabManager()->screen()->availableGeometry(); const QRect &availableGeometry = defaultTabManager()->screen()->availableGeometry();
#endif
static int frameWidth = (defaultTabManager()->frameGeometry().width() - defaultTabManager()->geometry().width()) / 2; static int frameWidth = (defaultTabManager()->frameGeometry().width() - defaultTabManager()->geometry().width()) / 2;
static int titleBarHeight = defaultTabManager()->style()->pixelMetric(QStyle::PM_TitleBarHeight); static int titleBarHeight = defaultTabManager()->style()->pixelMetric(QStyle::PM_TitleBarHeight);

View File

@ -22,10 +22,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QMessageBox> #include <QMessageBox>
#include <QUrl> #include <QUrl>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#include <QRegExp> #include <QRegExp>
#endif
TLDExtractor* TLDExtractor::s_instance = 0; TLDExtractor* TLDExtractor::s_instance = 0;
@ -388,11 +385,7 @@ bool TLDExtractor::test()
continue; continue;
} }
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
line.indexOf(testRegExp);
#else
testRegExp.indexIn(line); testRegExp.indexIn(line);
#endif
const QString hostName = testRegExp.cap(2); const QString hostName = testRegExp.cap(2);
const QString registrableName = testRegExp.cap(4); const QString registrableName = testRegExp.cap(4);

View File

@ -240,11 +240,7 @@ void TabListView::updateVisibility()
void TabListView::updateHeight() void TabListView::updateHeight()
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
setFixedHeight(m_delegate->sizeHint(viewOptions(), QModelIndex()).height());
#else
QStyleOptionViewItem option; QStyleOptionViewItem option;
initViewItemOption(&option); initViewItemOption(&option);
setFixedHeight(m_delegate->sizeHint(option, QModelIndex()).height()); setFixedHeight(m_delegate->sizeHint(option, QModelIndex()).height());
#endif
} }