mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Remove Qt5 support
This commit is contained in:
parent
21ab3bf8b1
commit
e02a8ee664
|
@ -10,6 +10,10 @@ set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_
|
|||
# Project name and 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
|
||||
include(FeatureSummary)
|
||||
find_package(ECM 5.78.0 CONFIG)
|
||||
|
@ -26,15 +30,6 @@ include(ECMSetupVersion)
|
|||
include(ECMAddAppIcon)
|
||||
include(ECMQtDeclareLoggingCategory)
|
||||
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)
|
||||
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
|
||||
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(Qt6WebEngineWidgets ${QT_MIN_VERSION} REQUIRED)
|
||||
else()
|
||||
find_package(Qt5WebEngine ${QT_MIN_VERSION} REQUIRED)
|
||||
find_package(Qt5WebEngineWidgets ${QT_MIN_VERSION} REQUIRED)
|
||||
endif()
|
||||
find_package(Qt6WebEngineCore ${QT_MIN_VERSION} REQUIRED)
|
||||
find_package(Qt6WebEngineWidgets ${QT_MIN_VERSION} REQUIRED)
|
||||
if (BUILD_TESTING)
|
||||
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS Test)
|
||||
endif()
|
||||
|
@ -77,9 +67,6 @@ endif()
|
|||
if (UNIX AND NOT APPLE AND NOT NO_X11)
|
||||
add_definitions(-DQZ_WS_X11)
|
||||
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()
|
||||
if (WIN32)
|
||||
add_definitions(-DW7API)
|
||||
|
@ -108,14 +95,12 @@ if (WIN32)
|
|||
add_definitions(-D_WIN32_WINNT=${ver})
|
||||
endif()
|
||||
|
||||
if (QT_MAJOR_VERSION STREQUAL "6")
|
||||
find_package(Qt6Core5Compat)
|
||||
endif()
|
||||
find_package(Qt6Core5Compat)
|
||||
|
||||
# Mandatory: OpenSSL
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
# Mandatory: KF5/6
|
||||
# Mandatory: KF6
|
||||
find_package(KF${KF_MAJOR_VERSION} REQUIRED COMPONENTS Archive)
|
||||
|
||||
# KF5I18n: Mandatory with downloaded translations (only for ki18n_install)
|
||||
|
@ -152,7 +137,6 @@ endif()
|
|||
# Optional: PySide2
|
||||
option(BUILD_PYTHON_SUPPORT "Support for Python plugins" ON)
|
||||
if (BUILD_PYTHON_SUPPORT)
|
||||
if (QT_MAJOR_VERSION STREQUAL "6")
|
||||
# Optional: PySide6
|
||||
find_package(PySide6 "6.4.0")
|
||||
find_package(Shiboken6 "6.4.0")
|
||||
|
@ -165,18 +149,6 @@ if (BUILD_PYTHON_SUPPORT)
|
|||
if (PySide6_FOUND AND Shiboken6_FOUND AND Shiboken6Tools_FOUND AND Python3_FOUND)
|
||||
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()
|
||||
|
||||
find_package(Intl)
|
||||
|
|
4
src/lib/3rdparty/fancytabwidget.cpp
vendored
4
src/lib/3rdparty/fancytabwidget.cpp
vendored
|
@ -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*)
|
||||
#endif
|
||||
{
|
||||
fadeIn();
|
||||
}
|
||||
|
|
4
src/lib/3rdparty/fancytabwidget.h
vendored
4
src/lib/3rdparty/fancytabwidget.h
vendored
|
@ -86,11 +86,7 @@ public:
|
|||
QString text;
|
||||
|
||||
protected:
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
void enterEvent(QEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent*) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -43,10 +43,7 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QDataStream>
|
||||
#include <QTime>
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QRegExp>
|
||||
#endif
|
||||
|
||||
#include "../config.h"
|
||||
#if defined(Q_OS_LINUX) && !defined(DISABLE_DBUS)
|
||||
|
@ -114,11 +111,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
|
|||
#endif
|
||||
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);
|
||||
#endif
|
||||
prefix.truncate(6);
|
||||
|
||||
QByteArray idc = id.toUtf8();
|
||||
|
|
8
src/lib/3rdparty/stylehelper.cpp
vendored
8
src/lib/3rdparty/stylehelper.cpp
vendored
|
@ -160,11 +160,7 @@ void StyleHelper::verticalGradient(QPainter* painter, const QRect &spanRect, con
|
|||
clipRect.height(), keyColor.rgb());
|
||||
|
||||
QPixmap pixmap;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
if (!QPixmapCache::find(key, pixmap)) {
|
||||
#else
|
||||
if (!QPixmapCache::find(key, &pixmap)) {
|
||||
#endif
|
||||
pixmap = QPixmap(clipRect.size());
|
||||
QPainter p(&pixmap);
|
||||
QRect rect(0, 0, clipRect.width(), clipRect.height());
|
||||
|
@ -187,11 +183,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
|
|||
QPixmap cache;
|
||||
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)) {
|
||||
#endif
|
||||
QPixmap px = icon.pixmap(rect.size(), iconMode);
|
||||
px.setDevicePixelRatio(qApp->devicePixelRatio());
|
||||
cache = QPixmap(px.size() + QSize(radius * 2, radius * 2));
|
||||
|
|
|
@ -577,16 +577,11 @@ qt_add_resources(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)
|
||||
else()
|
||||
get_property(QT_WEBENGINE_INCLUDE_DIRS TARGET Qt::WebEngine PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
|
||||
endif()
|
||||
get_property(QT_WEBENGINE_INCLUDE_DIRS TARGET Qt6::WebEngineCore PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
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::WebEngineWidgets
|
||||
Qt6::Network
|
||||
|
@ -598,20 +593,7 @@ if (QT_MAJOR_VERSION STREQUAL "6")
|
|||
Qt6::Core5Compat
|
||||
KF6::Archive
|
||||
${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)
|
||||
target_include_directories(FalkonPrivate SYSTEM PUBLIC ${Intl_INCLUDE_DIRS})
|
||||
|
@ -621,9 +603,6 @@ endif()
|
|||
if (UNIX AND NOT APPLE)
|
||||
if (NOT NO_X11)
|
||||
target_link_libraries(FalkonPrivate XCB::XCB)
|
||||
if (NOT (QT_MAJOR_VERSION STREQUAL "6"))
|
||||
target_link_libraries(FalkonPrivate Qt::X11Extras)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_target_properties(FalkonPrivate PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION "3")
|
||||
|
|
|
@ -296,11 +296,7 @@ void AdBlockManager::load()
|
|||
}
|
||||
|
||||
QTextStream textStream(&file);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
textStream.setCodec("UTF-8");
|
||||
#else
|
||||
textStream.setEncoding(QStringConverter::Utf8);
|
||||
#endif
|
||||
QString title = textStream.readLine(1024).remove(QLatin1String("Title: "));
|
||||
QUrl url = QUrl(textStream.readLine(1024).remove(QLatin1String("Url: ")));
|
||||
|
||||
|
|
|
@ -53,16 +53,12 @@
|
|||
#include <QWebEnginePage>
|
||||
#include <QWebEngineUrlRequestInfo>
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
/* TODO Qt6 Replace with PUBLIC API */
|
||||
#include <QtCore/private/qurl_p.h>
|
||||
#include <QtNetwork/private/qtldurl_p.h>
|
||||
#endif
|
||||
|
||||
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.
|
||||
// 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
|
||||
|
@ -81,7 +77,6 @@ static QString getTopLevelDomain(const QUrl &url)
|
|||
//return qt_ACE_do(tld, ToAceOnly, AllowLeadingDot, {});
|
||||
// TODO QT6 - QUrl::toAce() uses ForbidLeadingDot, while the old QUrl::topLevelDomain() used AllowLeadingDot. Does this matter?
|
||||
return QString(QUrl::toAce(tld));
|
||||
#endif
|
||||
}
|
||||
|
||||
static QString toSecondLevelDomain(const QUrl &url)
|
||||
|
|
|
@ -103,11 +103,7 @@ void AdBlockSubscription::loadSubscription(const QStringList &disabledRules)
|
|||
}
|
||||
|
||||
QTextStream textStream(&file);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
textStream.setCodec("UTF-8");
|
||||
#else
|
||||
textStream.setEncoding(QStringConverter::Utf8);
|
||||
#endif
|
||||
// Header is on 3rd line
|
||||
textStream.readLine(1024);
|
||||
textStream.readLine(1024);
|
||||
|
@ -310,11 +306,7 @@ void AdBlockCustomList::loadSubscription(const QStringList &disabledRules)
|
|||
|
||||
if (file.open(QFile::WriteOnly | QFile::Append)) {
|
||||
QTextStream stream(&file);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
stream.setCodec("UTF-8");
|
||||
#else
|
||||
stream.setEncoding(QStringConverter::Utf8);
|
||||
#endif
|
||||
|
||||
if (!rules.contains(ddg1 + QL1S("\n")))
|
||||
stream << ddg1 << Qt::endl;
|
||||
|
@ -337,11 +329,7 @@ void AdBlockCustomList::saveSubscription()
|
|||
}
|
||||
|
||||
QTextStream textStream(&file);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
textStream.setCodec("UTF-8");
|
||||
#else
|
||||
textStream.setEncoding(QStringConverter::Utf8);
|
||||
#endif
|
||||
textStream << "Title: " << title() << Qt::endl;
|
||||
textStream << "Url: " << url().toString() << Qt::endl;
|
||||
textStream << "[Adblock Plus 1.1.1]" << Qt::endl;
|
||||
|
|
|
@ -72,9 +72,6 @@
|
|||
#include <QWebEngineHistory>
|
||||
#include <QWebEngineSettings>
|
||||
#include <QMessageBox>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
#include <QToolTip>
|
||||
#include <QScrollArea>
|
||||
#include <QCollator>
|
||||
|
@ -82,9 +79,6 @@
|
|||
#include <QActionGroup>
|
||||
|
||||
#ifdef QZ_WS_X11
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QX11Info>
|
||||
#endif
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xcb_atom.h>
|
||||
#endif
|
||||
|
@ -405,11 +399,7 @@ void BrowserWindow::setupUi()
|
|||
m_statusBar->addButton(downloadsButton);
|
||||
m_navigationToolbar->addToolButton(downloadsButton);
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
QDesktopWidget* desktop = mApp->desktop();
|
||||
#else
|
||||
auto desktop = QGuiApplication::primaryScreen();
|
||||
#endif
|
||||
int windowWidth = desktop->availableGeometry().width() / 1.3;
|
||||
int windowHeight = desktop->availableGeometry().height() / 1.3;
|
||||
|
||||
|
@ -1573,14 +1563,10 @@ void BrowserWindow::closeTab()
|
|||
#ifdef QZ_WS_X11
|
||||
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>();
|
||||
if (x11App == nullptr)
|
||||
return 0;
|
||||
return x11App->connection();
|
||||
#endif
|
||||
}
|
||||
|
||||
int BrowserWindow::getCurrentVirtualDesktop() const
|
||||
|
|
|
@ -62,9 +62,6 @@
|
|||
#include <QDir>
|
||||
#include <QStandardPaths>
|
||||
#include <QWebEngineProfile>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QWebEngineDownloadItem>
|
||||
#endif
|
||||
#include <QWebEngineScriptCollection>
|
||||
#include <QRegularExpression>
|
||||
#include <QtWebEngineWidgetsVersion>
|
||||
|
@ -298,11 +295,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
|||
NetworkManager::registerSchemes();
|
||||
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"));
|
||||
#endif
|
||||
connect(m_webProfile, &QWebEngineProfile::downloadRequested, this, &MainApplication::downloadRequested);
|
||||
|
||||
m_webProfile->setNotificationPresenter([&] (std::unique_ptr<QWebEngineNotification> notification) {
|
||||
|
@ -408,11 +401,9 @@ MainApplication::~MainApplication()
|
|||
delete m_cookieJar;
|
||||
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.
|
||||
delete m_webProfile;
|
||||
m_webProfile = nullptr;
|
||||
#endif
|
||||
|
||||
Settings::syncSettings();
|
||||
}
|
||||
|
@ -946,11 +937,7 @@ void MainApplication::runDeferredPostLaunchActions()
|
|||
checkOptimizeDatabase();
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
void MainApplication::downloadRequested(QWebEngineDownloadItem *download)
|
||||
#else
|
||||
void MainApplication::downloadRequested(QWebEngineDownloadRequest *download)
|
||||
#endif
|
||||
{
|
||||
downloadManager()->download(download);
|
||||
}
|
||||
|
@ -1016,11 +1003,7 @@ void MainApplication::loadSettings()
|
|||
webSettings->setFontSize(QWebEngineSettings::MinimumLogicalFontSize, settings.value(QSL("MinimumLogicalFontSize"), 5).toInt());
|
||||
settings.endGroup();
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
QWebEngineProfile* profile = QWebEngineProfile::defaultProfile();
|
||||
#else
|
||||
QWebEngineProfile* profile = m_webProfile;
|
||||
#endif
|
||||
profile->setPersistentCookiesPolicy(QWebEngineProfile::AllowPersistentCookies);
|
||||
profile->setPersistentStoragePath(DataPaths::currentProfilePath());
|
||||
|
||||
|
@ -1210,17 +1193,9 @@ void MainApplication::setUserStyleSheet(const QString &filePath)
|
|||
userCss += QzTools::readAllFileContents(filePath).remove(QLatin1Char('\n'));
|
||||
|
||||
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)) {
|
||||
m_webProfile->scripts()->remove(oldScript);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (userCss.isEmpty())
|
||||
return;
|
||||
|
|
|
@ -31,11 +31,7 @@ class QMenu;
|
|||
class QWebEngineProfile;
|
||||
class QWebEngineSettings;
|
||||
class QNetworkAccessManager;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
class QWebEngineDownloadItem;
|
||||
#else
|
||||
class QWebEngineDownloadRequest;
|
||||
#endif
|
||||
|
||||
class History;
|
||||
class AutoFill;
|
||||
|
@ -150,11 +146,7 @@ private Q_SLOTS:
|
|||
void onFocusChanged();
|
||||
void runDeferredPostLaunchActions();
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
void downloadRequested(QWebEngineDownloadItem *download);
|
||||
#else
|
||||
void downloadRequested(QWebEngineDownloadRequest *download);
|
||||
#endif
|
||||
|
||||
private:
|
||||
enum PostLaunchAction {
|
||||
|
|
|
@ -249,9 +249,6 @@ QByteArray AutoFill::exportPasswords()
|
|||
QByteArray output;
|
||||
|
||||
QXmlStreamWriter stream(&output);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
stream.setCodec("UTF-8");
|
||||
#endif
|
||||
stream.setAutoFormatting(true);
|
||||
|
||||
stream.writeStartDocument();
|
||||
|
|
|
@ -49,11 +49,7 @@ bool HtmlExporter::exportBookmarks(BookmarkItem* root)
|
|||
}
|
||||
|
||||
QTextStream stream(&file);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
stream.setCodec("UTF-8");
|
||||
#else
|
||||
stream.setEncoding(QStringConverter::Utf8);
|
||||
#endif
|
||||
|
||||
stream << "<!DOCTYPE NETSCAPE-Bookmark-file-1>" << Qt::endl;
|
||||
stream << "<!-- This is an automatically generated file." << Qt::endl;
|
||||
|
|
|
@ -25,11 +25,7 @@
|
|||
OperaImporter::OperaImporter(QObject* parent)
|
||||
: BookmarksImporter(parent)
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
m_stream.setCodec("UTF-8");
|
||||
#else
|
||||
m_stream.setEncoding(QStringConverter::Utf8);
|
||||
#endif
|
||||
}
|
||||
|
||||
QString OperaImporter::description() const
|
||||
|
|
|
@ -256,11 +256,7 @@ QString BookmarksToolbarButton::createTooltip() const
|
|||
return m_bookmark->urlString();
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
void BookmarksToolbarButton::enterEvent(QEvent* event)
|
||||
#else
|
||||
void BookmarksToolbarButton::enterEvent(QEnterEvent* event)
|
||||
#endif
|
||||
{
|
||||
QPushButton::enterEvent(event);
|
||||
|
||||
|
|
|
@ -63,11 +63,7 @@ private:
|
|||
void init();
|
||||
QString createTooltip() const;
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
void enterEvent(QEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
|
|
|
@ -35,11 +35,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QFileIconProvider>
|
||||
#include <QDesktopServices>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QWebEngineDownloadItem>
|
||||
#else
|
||||
#include <QWebEngineDownloadRequest>
|
||||
#endif
|
||||
#include <QtWebEngineWidgetsVersion>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -49,7 +45,7 @@
|
|||
|
||||
//#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()
|
||||
, ui(new Ui::DownloadItem)
|
||||
, m_item(item)
|
||||
|
@ -85,14 +81,9 @@ DownloadItem::DownloadItem(QListWidgetItem *item, Q_WEB_ENGINE_DOWNLOAD_ITEM_CLA
|
|||
|
||||
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::receivedBytesChanged, this, &DownloadItem::receivedOrTotalBytesChanged);
|
||||
connect(m_download, &QWebEngineDownloadRequest::totalBytesChanged, this, &DownloadItem::receivedOrTotalBytesChanged);
|
||||
#endif
|
||||
|
||||
m_downloading = true;
|
||||
if (!m_downTimer.isValid()) {
|
||||
|
@ -133,16 +124,16 @@ void DownloadItem::finished()
|
|||
QString host = m_download->url().host();
|
||||
|
||||
switch (m_download->state()) {
|
||||
case Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::DownloadCompleted:
|
||||
case QWebEngineDownloadRequest::DownloadCompleted:
|
||||
success = true;
|
||||
ui->downloadInfo->setText(tr("Done - %1 (%2)").arg(host, QLocale().toString(QDateTime::currentDateTime(), QLocale::ShortFormat)));
|
||||
break;
|
||||
|
||||
case Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::DownloadInterrupted:
|
||||
case QWebEngineDownloadRequest::DownloadInterrupted:
|
||||
ui->downloadInfo->setText(tr("Error - %1").arg(host));
|
||||
break;
|
||||
|
||||
case Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::DownloadCancelled:
|
||||
case QWebEngineDownloadRequest::DownloadCancelled:
|
||||
ui->downloadInfo->setText(tr("Cancelled - %1").arg(host));
|
||||
break;
|
||||
|
||||
|
@ -164,15 +155,10 @@ void DownloadItem::finished()
|
|||
Q_EMIT downloadFinished(true);
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
void DownloadItem::downloadProgress(qint64 received, qint64 total)
|
||||
{
|
||||
#else
|
||||
void DownloadItem::receivedOrTotalBytesChanged()
|
||||
{
|
||||
qint64 received = m_download->receivedBytes();
|
||||
qint64 total = m_download->totalBytes();
|
||||
#endif
|
||||
#ifdef DOWNMANAGER_DEBUG
|
||||
qDebug() << __FUNCTION__ << received << total;
|
||||
#endif
|
||||
|
|
|
@ -35,13 +35,7 @@ class DownloadItem;
|
|||
}
|
||||
|
||||
class QListWidgetItem;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
class QWebEngineDownloadItem;
|
||||
#define Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS QWebEngineDownloadItem
|
||||
#else
|
||||
class QWebEngineDownloadRequest;
|
||||
#define Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS QWebEngineDownloadRequest
|
||||
#endif
|
||||
|
||||
class DownloadManager;
|
||||
|
||||
|
@ -50,7 +44,7 @@ class FALKON_EXPORT DownloadItem : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
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 isCancelled();
|
||||
QTime remainingTime() const { return m_remTime; }
|
||||
|
@ -75,11 +69,7 @@ Q_SIGNALS:
|
|||
private Q_SLOTS:
|
||||
void parentResized(const QSize &size);
|
||||
void finished();
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
void downloadProgress(qint64 received, qint64 total);
|
||||
#else
|
||||
void receivedOrTotalBytesChanged();
|
||||
#endif
|
||||
void stop();
|
||||
void pauseResume();
|
||||
void openFile();
|
||||
|
@ -96,7 +86,7 @@ private:
|
|||
Ui::DownloadItem* ui;
|
||||
|
||||
QListWidgetItem* m_item;
|
||||
Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS* m_download;
|
||||
QWebEngineDownloadRequest* m_download;
|
||||
QString m_path;
|
||||
QString m_fileName;
|
||||
QElapsedTimer m_downTimer;
|
||||
|
|
|
@ -40,11 +40,7 @@
|
|||
#include <QShortcut>
|
||||
#include <QStandardPaths>
|
||||
#include <QWebEngineHistory>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QWebEngineDownloadItem>
|
||||
#else
|
||||
#include <QWebEngineDownloadRequest>
|
||||
#endif
|
||||
#include <QtWebEngineWidgetsVersion>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -127,11 +123,7 @@ void DownloadManager::keyPressEvent(QKeyEvent* 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
|
||||
#endif
|
||||
{
|
||||
// Attempt to close empty tab that was opened only for loading the download url
|
||||
auto testWebView = [](TabbedWebView *view, const QUrl &url) {
|
||||
|
@ -266,7 +258,7 @@ void DownloadManager::clearList()
|
|||
Q_EMIT downloadsCountChanged();
|
||||
}
|
||||
|
||||
void DownloadManager::download(Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS *downloadItem)
|
||||
void DownloadManager::download(QWebEngineDownloadRequest *downloadItem)
|
||||
{
|
||||
QElapsedTimer downloadTimer;
|
||||
downloadTimer.start();
|
||||
|
@ -276,13 +268,9 @@ void DownloadManager::download(Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS *downloadItem)
|
|||
QString downloadPath;
|
||||
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();
|
||||
#endif
|
||||
|
||||
const bool forceAsk = downloadItem->savePageFormat() != Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::UnknownSaveFormat
|
||||
const bool forceAsk = downloadItem->savePageFormat() != QWebEngineDownloadRequest::UnknownSaveFormat
|
||||
|| downloadItem->isSavePageDownload();
|
||||
|
||||
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 };
|
||||
Result result = Unknown;
|
||||
|
||||
if (downloadItem->savePageFormat() != Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::UnknownSaveFormat) {
|
||||
if (downloadItem->savePageFormat() != QWebEngineDownloadRequest::UnknownSaveFormat) {
|
||||
// Save Page requested
|
||||
result = SavePage;
|
||||
} 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);
|
||||
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) {
|
||||
format = Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::MimeHtmlSaveFormat;
|
||||
format = QWebEngineDownloadRequest::MimeHtmlSaveFormat;
|
||||
} else if (selectedFilter == htmlSingle) {
|
||||
format = Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS::SingleHtmlSaveFormat;
|
||||
format = QWebEngineDownloadRequest::SingleHtmlSaveFormat;
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
@ -373,12 +361,8 @@ void DownloadManager::download(Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS *downloadItem)
|
|||
}
|
||||
|
||||
// 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->setDownloadFileName(QFileInfo(downloadPath).fileName());
|
||||
#endif
|
||||
downloadItem->accept();
|
||||
|
||||
// Create download item
|
||||
|
|
|
@ -32,11 +32,7 @@ class DownloadManager;
|
|||
class QUrl;
|
||||
class QNetworkAccessManager;
|
||||
class QListWidgetItem;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
class QWebEngineDownloadItem;
|
||||
#else
|
||||
class QWebEngineDownloadRequest;
|
||||
#endif
|
||||
class QWinTaskbarButton;
|
||||
|
||||
class DownloadItem;
|
||||
|
@ -69,11 +65,7 @@ public:
|
|||
|
||||
void loadSettings();
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
void download(QWebEngineDownloadItem *downloadItem);
|
||||
#else
|
||||
void download(QWebEngineDownloadRequest *downloadItem);
|
||||
#endif
|
||||
|
||||
int downloadsCount() const;
|
||||
int activeDownloadsCount() const;
|
||||
|
@ -106,11 +98,7 @@ private:
|
|||
void resizeEvent(QResizeEvent* 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;
|
||||
#endif
|
||||
QWinTaskbarButton *taskbarButton();
|
||||
|
||||
Ui::DownloadManager* ui;
|
||||
|
|
|
@ -33,11 +33,7 @@ QVariant DownloadManagerModel::data(const QModelIndex &index, int role) const
|
|||
{
|
||||
if (role == Qt::DisplayRole) {
|
||||
const DownloadItem *item = m_downloads.at(index.row());
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
return item;
|
||||
#else
|
||||
return QVariant::fromValue(item);
|
||||
#endif
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
|
|
@ -21,13 +21,9 @@
|
|||
|
||||
#include <QClipboard>
|
||||
#include <QMimeDatabase>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QWebEngineDownloadItem>
|
||||
#else
|
||||
#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)
|
||||
, ui(new Ui::DownloadOptionsDialog)
|
||||
, m_downloadItem(downloadItem)
|
||||
|
|
|
@ -30,18 +30,14 @@ namespace Ui
|
|||
class DownloadOptionsDialog;
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
class QWebEngineDownloadItem;
|
||||
#else
|
||||
class QWebEngineDownloadRequest;
|
||||
#endif
|
||||
|
||||
class FALKON_EXPORT DownloadOptionsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
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;
|
||||
|
||||
void showExternalManagerOption(bool show);
|
||||
|
@ -61,7 +57,7 @@ Q_SIGNALS:
|
|||
private:
|
||||
Ui::DownloadOptionsDialog* ui;
|
||||
|
||||
Q_WEB_ENGINE_DOWNLOAD_ITEM_CLASS *m_downloadItem;
|
||||
QWebEngineDownloadRequest *m_downloadItem;
|
||||
bool m_signalEmited;
|
||||
};
|
||||
|
||||
|
|
|
@ -324,11 +324,7 @@ int LocationCompleterDelegate::viewItemDrawText(QPainter *p, const QStyleOptionV
|
|||
highlightParts << highlightedPart;
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
textLayout.setFormats(QVector<QTextLayout::FormatRange>::fromList(highlightParts));
|
||||
#else
|
||||
textLayout.setFormats(highlightParts);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,11 +40,7 @@ LocationCompleterRefreshJob::LocationCompleterRefreshJob(const QString &searchSt
|
|||
m_watcher = new QFutureWatcher<void>(this);
|
||||
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);
|
||||
#endif
|
||||
m_watcher->setFuture(future);
|
||||
}
|
||||
|
||||
|
|
|
@ -178,11 +178,7 @@ void WebSearchBar::setupEngines()
|
|||
item.icon = en.icon;
|
||||
item.text = en.name;
|
||||
QVariant v;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
v.setValue<SearchEngine>(en);
|
||||
#else
|
||||
v.setValue(en);
|
||||
#endif
|
||||
item.userData = v;
|
||||
|
||||
m_boxSearchType->addItem(item);
|
||||
|
|
|
@ -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)
|
||||
#endif
|
||||
{
|
||||
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();
|
||||
#endif
|
||||
|
||||
if (m_rejectedSslErrors.contains(host) && m_rejectedSslErrors.value(host) == errorType) {
|
||||
return false;
|
||||
|
@ -93,21 +84,15 @@ bool NetworkManager::certificateError(QWebEngineCertificateError &error, QWidget
|
|||
return true;
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
// Defer loading the URL until the user prompt has completed.
|
||||
if (error.isOverridable())
|
||||
error.defer();
|
||||
#endif
|
||||
|
||||
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 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();
|
||||
#endif
|
||||
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);
|
||||
|
@ -350,11 +335,7 @@ void NetworkManager::registerSchemes()
|
|||
QNetworkReply *NetworkManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
|
||||
{
|
||||
QNetworkRequest req = request;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
// These have either been removed or changed to the default in Qt 6.
|
||||
req.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
|
||||
req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||
#endif
|
||||
/* TODO Use HTTP2 */
|
||||
|
||||
return QNetworkAccessManager::createRequest(op, req, outgoingData);
|
||||
}
|
||||
|
|
|
@ -35,11 +35,7 @@ class FALKON_EXPORT NetworkManager : public QNetworkAccessManager
|
|||
public:
|
||||
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);
|
||||
#endif
|
||||
void authentication(const QUrl &url, QAuthenticator *auth, QWidget *parent = nullptr);
|
||||
void proxyAuthentication(const QString &proxyHost, QAuthenticator *auth, QWidget *parent = nullptr);
|
||||
|
||||
|
@ -62,13 +58,8 @@ private:
|
|||
|
||||
NetworkUrlInterceptor *m_urlInterceptor;
|
||||
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_rejectedSslErrors;
|
||||
#endif
|
||||
QStringList m_ignoredSslHosts;
|
||||
};
|
||||
|
||||
|
|
|
@ -81,11 +81,7 @@ void EditSearchEngine::setShortcut(const QString &shortcut)
|
|||
|
||||
QIcon EditSearchEngine::icon()
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
return QIcon(*ui->icon->pixmap());
|
||||
#else
|
||||
return QIcon(ui->icon->pixmap());
|
||||
#endif
|
||||
}
|
||||
|
||||
void EditSearchEngine::setIcon(const QIcon &icon)
|
||||
|
|
|
@ -173,11 +173,7 @@ SearchEngine SearchEnginesDialog::getEngine(QTreeWidgetItem* item)
|
|||
void SearchEnginesDialog::setEngine(QTreeWidgetItem* item, const SearchEngine &engine)
|
||||
{
|
||||
QVariant v;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
v.setValue<SearchEngine>(engine);
|
||||
#else
|
||||
v.setValue(engine);
|
||||
#endif
|
||||
item->setData(0, EngineRole, v);
|
||||
item->setText(0, engine.name);
|
||||
}
|
||||
|
|
|
@ -28,11 +28,7 @@
|
|||
#include <QUrlQuery>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <KArchive/KZip>
|
||||
#else
|
||||
#include <KZip>
|
||||
#endif
|
||||
|
||||
Q_GLOBAL_STATIC(OcsSupport, qz_ocs_support)
|
||||
|
||||
|
|
|
@ -20,9 +20,7 @@
|
|||
|
||||
QmlUserScript::QmlUserScript(QObject *parent)
|
||||
: QObject(parent)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
, m_isNull(true)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -44,11 +42,7 @@ void QmlUserScript::setWebEngineScript(const QWebEngineScript &script)
|
|||
|
||||
bool QmlUserScript::null() const
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
return m_webEngineScript.isNull();
|
||||
#else
|
||||
return m_isNull;
|
||||
#endif
|
||||
}
|
||||
|
||||
QString QmlUserScript::name() const
|
||||
|
|
|
@ -100,10 +100,8 @@ Q_SIGNALS:
|
|||
void injectionPointChanged(int injectionPoint);
|
||||
private:
|
||||
QWebEngineScript m_webEngineScript;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
bool m_isNull;
|
||||
#endif
|
||||
QBasicTimer m_basicTimer;
|
||||
bool m_isNull;
|
||||
|
||||
bool null() const;
|
||||
QString name() const;
|
||||
|
@ -122,9 +120,7 @@ private:
|
|||
|
||||
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?
|
||||
m_isNull = false;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
|
|
@ -67,26 +67,17 @@ QObject *QmlUserScripts::findScript(const QString &name) const
|
|||
{
|
||||
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);
|
||||
if (!scripts.empty()) {
|
||||
qmlUserScript->setWebEngineScript(scripts.first());
|
||||
}
|
||||
#endif
|
||||
|
||||
return qmlUserScript;
|
||||
}
|
||||
|
||||
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);
|
||||
#endif
|
||||
return toQObjectList(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,11 +92,7 @@ void AutoFillManager::loadPasswords()
|
|||
item->setText(2, "*****");
|
||||
|
||||
QVariant v;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
v.setValue<PasswordEntry>(entry);
|
||||
#else
|
||||
v.setValue(entry);
|
||||
#endif
|
||||
item->setData(0, Qt::UserRole + 10, v);
|
||||
ui->treePass->addTopLevelItem(item);
|
||||
}
|
||||
|
@ -263,11 +259,7 @@ void AutoFillManager::editPass()
|
|||
|
||||
if (mApp->autoFill()->updateEntry(entry)) {
|
||||
QVariant v;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
v.setValue<PasswordEntry>(entry);
|
||||
#else
|
||||
v.setValue(entry);
|
||||
#endif
|
||||
curItem->setData(0, Qt::UserRole + 10, v);
|
||||
|
||||
if (m_passwordsShown) {
|
||||
|
|
|
@ -57,9 +57,6 @@
|
|||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QColorDialog>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
#include <QWebEngineProfile>
|
||||
#include <QWebEngineSettings>
|
||||
#include <QLibraryInfo>
|
||||
|
@ -533,11 +530,7 @@ Preferences::Preferences(BrowserWindow* window)
|
|||
ui->listWidget->setCurrentRow(currentSettingsPage);
|
||||
|
||||
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();
|
||||
#endif
|
||||
if (availableGeometryForScreen.size().width() < s.width()) {
|
||||
s.setWidth(availableGeometryForScreen.size().width() - 50);
|
||||
}
|
||||
|
|
|
@ -1359,9 +1359,6 @@ void TabBarHelper::paintEvent(QPaintEvent *)
|
|||
grabImage.setDevicePixelRatio(devicePixelRatioF());
|
||||
grabImage.fill(Qt::transparent);
|
||||
QStylePainter p(&grabImage, this);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
p.initFrom(this);
|
||||
#endif
|
||||
if (tabDragOffset != 0) {
|
||||
tab.position = QStyleOptionTab::OnlyOneTab;
|
||||
}
|
||||
|
@ -1814,11 +1811,7 @@ QSize CloseButton::sizeHint() const
|
|||
return QSize(width, height);
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
void CloseButton::enterEvent(QEvent* event)
|
||||
#else
|
||||
void CloseButton::enterEvent(QEnterEvent* event)
|
||||
#endif
|
||||
{
|
||||
if (isEnabled()) {
|
||||
update();
|
||||
|
|
|
@ -364,11 +364,7 @@ public:
|
|||
|
||||
QSize sizeHint() const override;
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
void enterEvent(QEvent *event) override;
|
||||
#else
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
#endif
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
};
|
||||
|
|
|
@ -160,11 +160,7 @@ void ButtonWithMenu::generateMenu()
|
|||
|
||||
for (const Item &item : qAsConst(m_items)) {
|
||||
QVariant variant;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
variant.setValue<Item>(item);
|
||||
#else
|
||||
variant.setValue(item);
|
||||
#endif
|
||||
m_menu->addAction(item.icon, item.text, this, SLOT(setCurrentItem()))->setData(variant);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,6 @@ DesktopFile::DesktopFile()
|
|||
DesktopFile::DesktopFile(const QString &fileName)
|
||||
{
|
||||
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"));
|
||||
}
|
||||
|
||||
|
|
|
@ -101,11 +101,7 @@ void HTML5PermissionsNotification::grantPermissions()
|
|||
QTimer::singleShot(0, this, [this]() {
|
||||
// We need to have cursor inside view to correctly grab mouse
|
||||
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);
|
||||
#endif
|
||||
QCursor::setPos(view->mapToGlobal(view->rect().center()));
|
||||
}
|
||||
|
||||
|
|
|
@ -33,11 +33,7 @@ PageThumbnailer::PageThumbnailer(QObject* parent)
|
|||
, m_loadTitle(false)
|
||||
{
|
||||
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")));
|
||||
#endif
|
||||
m_view->rootContext()->setContextProperty(QSL("thumbnailer"), this);
|
||||
m_view->show();
|
||||
}
|
||||
|
|
|
@ -32,11 +32,7 @@
|
|||
#include <QWidget>
|
||||
#include <QApplication>
|
||||
#include <QSslCertificate>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QDesktopWidget>
|
||||
#else
|
||||
#include <QScreen>
|
||||
#endif
|
||||
#include <QUrl>
|
||||
#include <QIcon>
|
||||
#include <QFileIconProvider>
|
||||
|
@ -49,9 +45,6 @@
|
|||
#include <QtGuiVersion>
|
||||
|
||||
#ifdef QZ_WS_X11
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QX11Info>
|
||||
#endif
|
||||
#include <xcb/xcb.h>
|
||||
#endif
|
||||
|
||||
|
@ -121,11 +114,7 @@ QByteArray QzTools::readAllFileByteContents(const QString &filename)
|
|||
|
||||
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();
|
||||
#endif
|
||||
const QRect size = w->geometry();
|
||||
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
|
||||
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>();
|
||||
if (x11App == nullptr)
|
||||
return 0;
|
||||
return x11App->connection();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -18,11 +18,7 @@
|
|||
#include "webhittestresult.h"
|
||||
#include "webpage.h"
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QWebEngineContextMenuData>
|
||||
#else
|
||||
#include <QWebEngineContextMenuRequest>
|
||||
#endif
|
||||
|
||||
WebHitTestResult::WebHitTestResult(const WebPage *page, const QPoint &pos)
|
||||
: m_isNull(true)
|
||||
|
@ -96,13 +92,8 @@ WebHitTestResult::WebHitTestResult(const WebPage *page, const QPoint &pos)
|
|||
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) {
|
||||
return;
|
||||
}
|
||||
|
@ -113,12 +104,12 @@ void WebHitTestResult::updateWithContextMenuData(const Q_WEB_ENGINE_CONTEXT_MENU
|
|||
m_isContentSelected = !data.selectedText().isEmpty();
|
||||
|
||||
switch (data.mediaType()) {
|
||||
case Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS::MediaTypeImage:
|
||||
case QWebEngineContextMenuRequest::MediaTypeImage:
|
||||
m_imageUrl = data.mediaUrl();
|
||||
break;
|
||||
|
||||
case Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS::MediaTypeVideo:
|
||||
case Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS::MediaTypeAudio:
|
||||
case QWebEngineContextMenuRequest::MediaTypeVideo:
|
||||
case QWebEngineContextMenuRequest::MediaTypeAudio:
|
||||
m_mediaUrl = data.mediaUrl();
|
||||
break;
|
||||
|
||||
|
|
|
@ -25,13 +25,7 @@
|
|||
|
||||
#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;
|
||||
#define Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS QWebEngineContextMenuRequest
|
||||
#endif
|
||||
|
||||
class WebPage;
|
||||
|
||||
|
@ -40,7 +34,7 @@ class FALKON_EXPORT WebHitTestResult
|
|||
public:
|
||||
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;
|
||||
QString alternateText() const;
|
||||
|
|
|
@ -89,9 +89,7 @@ WebPage::WebPage(QObject* parent)
|
|||
connect(this, &QWebEnginePage::windowCloseRequested, this, &WebPage::windowCloseRequested);
|
||||
connect(this, &QWebEnginePage::fullScreenRequested, this, &WebPage::fullScreenRequested);
|
||||
connect(this, &QWebEnginePage::renderProcessTerminated, this, &WebPage::renderProcessTerminated);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
connect(this, &QWebEnginePage::certificateError, this, &WebPage::onCertificateError);
|
||||
#endif
|
||||
|
||||
connect(this, &QWebEnginePage::authenticationRequired, this, [this](const QUrl &url, QAuthenticator *auth) {
|
||||
mApp->networkManager()->authentication(url, auth, view());
|
||||
|
@ -140,11 +138,7 @@ WebPage::~WebPage()
|
|||
|
||||
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));
|
||||
#endif
|
||||
}
|
||||
|
||||
bool WebPage::execPrintPage(QPrinter *printer, int timeout)
|
||||
|
@ -153,14 +147,6 @@ bool WebPage::execPrintPage(QPrinter *printer, int timeout)
|
|||
bool result = false;
|
||||
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) {
|
||||
if (loop && loop->isRunning()) {
|
||||
result = res;
|
||||
|
@ -168,7 +154,6 @@ bool WebPage::execPrintPage(QPrinter *printer, int timeout)
|
|||
}
|
||||
});
|
||||
view()->print(printer);
|
||||
#endif
|
||||
|
||||
loop->exec();
|
||||
delete loop;
|
||||
|
@ -454,11 +439,6 @@ bool WebPage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::Navigatio
|
|||
QUrlQuery query(url);
|
||||
mApp->searchEnginesManager()->addEngine(QUrl(query.queryItemValue(QSL("url"))));
|
||||
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;
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
auto mutableError = const_cast<QWebEngineCertificateError&>(error);
|
||||
|
@ -494,7 +468,6 @@ void WebPage::onCertificateError(QWebEngineCertificateError error)
|
|||
else
|
||||
mutableError.rejectCertificate();
|
||||
}
|
||||
#endif
|
||||
|
||||
QStringList WebPage::chooseFiles(QWebEnginePage::FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes)
|
||||
{
|
||||
|
|
|
@ -21,9 +21,7 @@
|
|||
#include <QWebEnginePage>
|
||||
#include <QWebEngineScript>
|
||||
#include <QWebEngineFullScreenRequest>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QPrinter>
|
||||
#endif
|
||||
#include <QVector>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
|
@ -96,15 +94,11 @@ private Q_SLOTS:
|
|||
void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest);
|
||||
void featurePermissionRequested(const QUrl &origin, const QWebEnginePage::Feature &feature);
|
||||
void renderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus terminationStatus, int exitCode);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
void onCertificateError(QWebEngineCertificateError error);
|
||||
#endif
|
||||
|
||||
private:
|
||||
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;
|
||||
QWebEnginePage* createWindow(QWebEnginePage::WebWindowType type) override;
|
||||
|
||||
|
|
|
@ -211,14 +211,9 @@ void WebScrollBarManager::createUserScript(int thickness)
|
|||
|
||||
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"))) {
|
||||
mApp->webProfile()->scripts()->remove(script);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QSize WebScrollBarManager::viewportSize(WebView *view, int thickness) const
|
||||
|
|
|
@ -44,11 +44,7 @@
|
|||
#include <QWebEngineHistory>
|
||||
#include <QClipboard>
|
||||
#include <QMimeData>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QWebEngineContextMenuData>
|
||||
#else
|
||||
#include <QWebEngineContextMenuRequest>
|
||||
#endif
|
||||
#include <QStackedLayout>
|
||||
#include <QScrollBar>
|
||||
#include <QPrintDialog>
|
||||
|
@ -150,9 +146,6 @@ void WebView::setPage(WebPage *page)
|
|||
Q_EMIT m_page->loadFinished(true);
|
||||
}
|
||||
mApp->plugins()->emitWebPageDeleted(m_page);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
m_page->setView(nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
page->setParent(this);
|
||||
|
@ -409,17 +402,10 @@ void WebView::printPage()
|
|||
m_page->printToPdf(dialog->printer()->outputFileName(), dialog->printer()->pageLayout());
|
||||
delete dialog;
|
||||
} 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) {
|
||||
Q_UNUSED(success);
|
||||
delete dialog;
|
||||
});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -683,14 +669,11 @@ void WebView::createContextMenu(QMenu *menu, WebHitTestResult &hitTest)
|
|||
// cppcheck-suppress variableScope
|
||||
int spellCheckActionCount = 0;
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
const Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS &contextMenuData = page()->contextMenuData();
|
||||
#else
|
||||
const Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS *contextMenuDataPtr = lastContextMenuRequest();
|
||||
if (contextMenuDataPtr == NULL)
|
||||
const QWebEngineContextMenuRequest *contextMenuDataPtr = lastContextMenuRequest();
|
||||
if (contextMenuDataPtr == NULL) {
|
||||
return;
|
||||
const Q_WEB_ENGINE_CONTEXT_MENU_DATA_CLASS &contextMenuData = *contextMenuDataPtr;
|
||||
#endif
|
||||
}
|
||||
const QWebEngineContextMenuRequest &contextMenuData = *contextMenuDataPtr;
|
||||
|
||||
hitTest.updateWithContextMenuData(contextMenuData);
|
||||
|
||||
|
@ -1288,11 +1271,7 @@ bool WebView::eventFilter(QObject *obj, QEvent *event)
|
|||
if (obj == this && event->type() == QEvent::ChildAdded) {
|
||||
QPointer<QWidget> child = qobject_cast<QWidget*>(static_cast<QChildEvent*>(event)->child());
|
||||
QTimer::singleShot(0, this, [=]() {
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
if (child && child->inherits("QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget")) {
|
||||
#else
|
||||
if (child) {
|
||||
#endif
|
||||
m_rwhvqt = child;
|
||||
m_rwhvqt->installEventFilter(this);
|
||||
if (auto *w = qobject_cast<QQuickWidget*>(m_rwhvqt)) {
|
||||
|
|
|
@ -121,12 +121,8 @@ void SearchToolBar::searchText(const QString &text)
|
|||
{
|
||||
m_searchRequests++;
|
||||
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) {
|
||||
bool found = result.numberOfMatches() > 0;
|
||||
#endif
|
||||
if (!guard) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -182,13 +182,9 @@ void GM_Manager::disableScript(GM_Script* script)
|
|||
m_disabledScripts.append(script->fullName());
|
||||
|
||||
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())) {
|
||||
collection->remove(script);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GM_Manager::addScript(GM_Script* script)
|
||||
|
@ -216,13 +212,9 @@ bool GM_Manager::removeScript(GM_Script* script, bool removeFile)
|
|||
m_scripts.removeOne(script);
|
||||
|
||||
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())) {
|
||||
collection->remove(script);
|
||||
}
|
||||
#endif
|
||||
|
||||
m_disabledScripts.removeOne(script->fullName());
|
||||
|
||||
|
@ -291,13 +283,9 @@ void GM_Manager::scriptChanged()
|
|||
return;
|
||||
|
||||
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())) {
|
||||
collection->remove(script);
|
||||
}
|
||||
#endif
|
||||
collection->insert(script->webScript());
|
||||
}
|
||||
|
||||
|
|
|
@ -19,11 +19,7 @@
|
|||
|
||||
#include "plugininterface.h"
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <PurposeWidgets/Menu>
|
||||
#else
|
||||
#include <Purpose/Menu>
|
||||
#endif
|
||||
|
||||
class KWalletPasswordBackend;
|
||||
class KIOSchemeHandler;
|
||||
|
|
|
@ -24,13 +24,8 @@
|
|||
|
||||
#include <kio_version.h>
|
||||
|
||||
#if KIO_VERSION < QT_VERSION_CHECK(5, 240, 0)
|
||||
#include <KIO/AccessManager>
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(KIO::Integration::AccessManager, s_knam, (nullptr))
|
||||
#else
|
||||
#include <QNetworkAccessManager>
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QNetworkAccessManager, s_knam, (nullptr))
|
||||
#endif
|
||||
#include <QNetworkAccessManager>
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QNetworkAccessManager, s_knam, (nullptr))
|
||||
|
||||
KIOSchemeHandler::KIOSchemeHandler(const QString &protocol, QObject *parent)
|
||||
: QWebEngineUrlSchemeHandler(parent)
|
||||
|
|
|
@ -20,10 +20,8 @@ set(QT_INCLUDE_DIRS
|
|||
${QT_WEBENGINECORE_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)
|
||||
list(APPEND QT_INCLUDE_DIRS ${QT_PRINTSUPPORT_INCLUDE_DIRS})
|
||||
endif()
|
||||
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})
|
||||
set(INCLUDES "")
|
||||
foreach(INCLUDE_DIR ${QT_INCLUDE_DIRS})
|
||||
list(APPEND INCLUDES "-I${INCLUDE_DIR}")
|
||||
|
@ -37,11 +35,7 @@ endforeach()
|
|||
set(GLOBAL_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/pyfalkon_global.h)
|
||||
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}")
|
||||
else()
|
||||
set(API_VERSION "${Qt5_VERSION_MAJOR}.${Qt5_VERSION_MINOR}")
|
||||
endif()
|
||||
set(API_VERSION "${Qt6_VERSION_MAJOR}.${Qt6_VERSION_MINOR}")
|
||||
|
||||
set(SHIBOKEN_OPTIONS --generator-set=shiboken --enable-parent-ctor-heuristic
|
||||
--enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero
|
||||
|
@ -144,11 +138,7 @@ set(GENERATED_SOURCES_DEPENDENCIES
|
|||
${TYPESYSTEM_FILE}
|
||||
)
|
||||
|
||||
if (QT_MAJOR_VERSION STREQUAL "6")
|
||||
set(PYSIDE_VERSION "6")
|
||||
else()
|
||||
set(PYSIDE_VERSION "2")
|
||||
endif()
|
||||
set(PYSIDE_VERSION "6")
|
||||
|
||||
# Add custom target to run shiboken.
|
||||
add_custom_command(OUTPUT ${GENERATED_SOURCES}
|
||||
|
|
|
@ -21,11 +21,7 @@
|
|||
|
||||
// PYSIDE-711
|
||||
#include <QHstsPolicy>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QWebEngineContextMenuData>
|
||||
#else
|
||||
#include <QWebEngineContextMenuRequest>
|
||||
#endif
|
||||
|
||||
// 3rdparty
|
||||
#include "lineedit.h"
|
||||
|
|
|
@ -267,12 +267,8 @@
|
|||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, &%6, %7);
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG6_TYPE](%6));
|
||||
#else
|
||||
auto ARG6_PTR = &%6;
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG6_TYPE](ARG6_PTR));
|
||||
#endif
|
||||
</template>
|
||||
|
||||
<suppress-warning text="Unable to translate type "std::function<QPoint (QSize)>":*"/>
|
||||
|
|
|
@ -23,26 +23,15 @@
|
|||
#include "browserwindow.h"
|
||||
|
||||
#include <QMenu>
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QNetworkConfigurationManager>
|
||||
#endif
|
||||
|
||||
SBI_NetworkIcon::SBI_NetworkIcon(BrowserWindow* window)
|
||||
: SBI_Icon(window)
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
, m_networkConfiguration(new QNetworkConfigurationManager(this))
|
||||
#endif
|
||||
{
|
||||
setObjectName(QSL("sbi_networkicon"));
|
||||
setCursor(Qt::PointingHandCursor);
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
onlineStateChanged(m_networkConfiguration->isOnline());
|
||||
|
||||
connect(m_networkConfiguration, &QNetworkConfigurationManager::onlineStateChanged, this, &SBI_NetworkIcon::onlineStateChanged);
|
||||
#else
|
||||
/* TODO rework connection detection */
|
||||
onlineStateChanged(true);
|
||||
#endif
|
||||
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");
|
||||
|
||||
#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?
|
||||
// Or is there a way to detect network status in Qt6?
|
||||
tooltip = tooltip.arg(tr("Connected"));
|
||||
#endif
|
||||
|
||||
switch (QNetworkProxy::applicationProxy().type()) {
|
||||
case QNetworkProxy::DefaultProxy:
|
||||
|
@ -139,11 +119,7 @@ void SBI_NetworkIcon::updateToolTip()
|
|||
setToolTip(tooltip);
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
void SBI_NetworkIcon::enterEvent(QEvent* event)
|
||||
#else
|
||||
void SBI_NetworkIcon::enterEvent(QEnterEvent* event)
|
||||
#endif
|
||||
{
|
||||
updateToolTip();
|
||||
|
||||
|
|
|
@ -40,16 +40,7 @@ private Q_SLOTS:
|
|||
|
||||
private:
|
||||
void updateToolTip();
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
void enterEvent(QEvent* event) override;
|
||||
#else
|
||||
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
|
||||
|
|
|
@ -244,11 +244,7 @@ void TabManagerDelegate::viewItemDrawText(QPainter *p, const QStyleOptionViewIte
|
|||
highlightParts << highlightedPart;
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
textLayout.setAdditionalFormats(highlightParts);
|
||||
#else
|
||||
textLayout.setFormats(highlightParts);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,19 +34,13 @@
|
|||
#include "tabcontextmenu.h"
|
||||
#include "tabbar.h"
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
#include <QDialogButtonBox>
|
||||
#include <QStackedWidget>
|
||||
#include <QDialog>
|
||||
#include <QTimer>
|
||||
#include <QLabel>
|
||||
#include <QMimeData>
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QRegExp>
|
||||
#endif
|
||||
|
||||
|
||||
TLDExtractor* TabManagerWidget::s_tldExtractor = 0;
|
||||
|
@ -128,11 +122,7 @@ QString TabManagerWidget::domainFromUrl(const QUrl &url, bool useHostName)
|
|||
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) {
|
||||
#endif
|
||||
if (host.startsWith("www.", Qt::CaseInsensitive)) {
|
||||
host.remove(0, 4);
|
||||
}
|
||||
|
@ -571,11 +561,7 @@ void TabManagerWidget::detachSelectedTabs(const QMultiHash<BrowserWindow*, WebTa
|
|||
}
|
||||
|
||||
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();
|
||||
#endif
|
||||
newWindow->move(availableGeometryForScreen.topLeft() + QPoint(30, 30));
|
||||
|
||||
detachTabsTo(newWindow, tabsHash);
|
||||
|
@ -895,11 +881,7 @@ QStringList TabTreeWidget::mimeTypes() const
|
|||
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
|
||||
#endif
|
||||
{
|
||||
auto* mimeData = new QMimeData();
|
||||
QByteArray encodedData;
|
||||
|
|
|
@ -44,11 +44,7 @@ public:
|
|||
|
||||
Qt::DropActions supportedDropActions() 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;
|
||||
#endif
|
||||
bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) override;
|
||||
|
||||
void setEnableDragTabs(bool enable);
|
||||
|
|
|
@ -25,11 +25,7 @@
|
|||
#include "statusbar.h"
|
||||
#include "navigationbar.h"
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QDesktopWidget>
|
||||
#else
|
||||
#include <QScreen>
|
||||
#endif
|
||||
#include <QAction>
|
||||
#include <QStyle>
|
||||
|
||||
|
@ -217,11 +213,7 @@ void TabManagerWidgetController::showSideBySide()
|
|||
return;
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
const QRect &availableGeometry = mApp->desktop()->availableGeometry(defaultTabManager());
|
||||
#else
|
||||
const QRect &availableGeometry = defaultTabManager()->screen()->availableGeometry();
|
||||
#endif
|
||||
static int frameWidth = (defaultTabManager()->frameGeometry().width() - defaultTabManager()->geometry().width()) / 2;
|
||||
static int titleBarHeight = defaultTabManager()->style()->pixelMetric(QStyle::PM_TitleBarHeight);
|
||||
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QUrl>
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QRegExp>
|
||||
#endif
|
||||
|
||||
TLDExtractor* TLDExtractor::s_instance = 0;
|
||||
|
||||
|
@ -388,11 +385,7 @@ bool TLDExtractor::test()
|
|||
continue;
|
||||
}
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
line.indexOf(testRegExp);
|
||||
#else
|
||||
testRegExp.indexIn(line);
|
||||
#endif
|
||||
|
||||
const QString hostName = testRegExp.cap(2);
|
||||
const QString registrableName = testRegExp.cap(4);
|
||||
|
|
|
@ -240,11 +240,7 @@ void TabListView::updateVisibility()
|
|||
|
||||
void TabListView::updateHeight()
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
setFixedHeight(m_delegate->sizeHint(viewOptions(), QModelIndex()).height());
|
||||
#else
|
||||
QStyleOptionViewItem option;
|
||||
initViewItemOption(&option);
|
||||
setFixedHeight(m_delegate->sizeHint(option, QModelIndex()).height());
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user