[network/konqueror/kf6] /: Start fixing compilation errors with Qt6

Stefano Crocco null at kde.org
Fri Oct 13 16:48:40 BST 2023


Git commit 4767c8e7d174f7663f4b7d9a7f2eddf69185c8fd by Stefano Crocco.
Committed on 01/10/2023 at 09:02.
Pushed by stefanocrocco into branch 'kf6'.

Start fixing compilation errors with Qt6

M  +21   -11   CMakeLists.txt
M  +5    -5    autotests/CMakeLists.txt
M  +1    -1    autotests/konqviewmgrtest.cpp
M  +12   -6    client/CMakeLists.txt
M  +4    -1    client/kfmclient.cpp
M  +1    -1    doc/CMakeLists.txt
R  +0    -0    doc/kcontrol/CMakeLists.txt [from: doc/kcontrol5/CMakeLists.txt - 100% similarity]
R  +0    -0    doc/kcontrol/bookmarks/CMakeLists.txt [from: doc/kcontrol5/bookmarks/CMakeLists.txt - 100% similarity]
R  +0    -0    doc/kcontrol/bookmarks/index.docbook [from: doc/kcontrol5/bookmarks/index.docbook - 100% similarity]
R  +0    -0    doc/kcontrol/filemanager/CMakeLists.txt [from: doc/kcontrol5/filemanager/CMakeLists.txt - 100% similarity]
R  +0    -0    doc/kcontrol/filemanager/index.docbook [from: doc/kcontrol5/filemanager/index.docbook - 100% similarity]
R  +0    -0    doc/kcontrol/history/CMakeLists.txt [from: doc/kcontrol5/history/CMakeLists.txt - 100% similarity]
R  +0    -0    doc/kcontrol/history/index.docbook [from: doc/kcontrol5/history/index.docbook - 100% similarity]
R  +0    -0    doc/kcontrol/kcmcss/CMakeLists.txt [from: doc/kcontrol5/kcmcss/CMakeLists.txt - 100% similarity]
R  +0    -0    doc/kcontrol/kcmcss/index.docbook [from: doc/kcontrol5/kcmcss/index.docbook - 100% similarity]
R  +0    -0    doc/kcontrol/khtml-adblock/CMakeLists.txt [from: doc/kcontrol5/khtml-adblock/CMakeLists.txt - 100% similarity]
R  +0    -0    doc/kcontrol/khtml-adblock/index.docbook [from: doc/kcontrol5/khtml-adblock/index.docbook - 100% similarity]
R  +0    -0    doc/kcontrol/khtml-behavior/CMakeLists.txt [from: doc/kcontrol5/khtml-behavior/CMakeLists.txt - 100% similarity]
R  +0    -0    doc/kcontrol/khtml-behavior/index.docbook [from: doc/kcontrol5/khtml-behavior/index.docbook - 100% similarity]
R  +0    -0    doc/kcontrol/khtml-general/CMakeLists.txt [from: doc/kcontrol5/khtml-general/CMakeLists.txt - 100% similarity]
R  +0    -0    doc/kcontrol/khtml-general/index.docbook [from: doc/kcontrol5/khtml-general/index.docbook - 100% similarity]
R  +0    -0    doc/kcontrol/khtml-java-js/CMakeLists.txt [from: doc/kcontrol5/khtml-java-js/CMakeLists.txt - 100% similarity]
R  +0    -0    doc/kcontrol/khtml-java-js/index.docbook [from: doc/kcontrol5/khtml-java-js/index.docbook - 100% similarity]
R  +0    -0    doc/kcontrol/performance/CMakeLists.txt [from: doc/kcontrol5/performance/CMakeLists.txt - 100% similarity]
R  +0    -0    doc/kcontrol/performance/index.docbook [from: doc/kcontrol5/performance/index.docbook - 100% similarity]
M  +5    -0    kioworkers/bookmarks/kio_bookmarks.cpp
M  +4    -2    libkonq/autotests/konqpopupmenutest.cpp
M  +2    -0    libkonq/src/CMakeLists.txt
M  +0    -1    libkonq/src/browseropenorsavequestion.cpp
M  +0    -2    libkonq/src/interfaces/cookiejar.cpp
M  +1    -2    libkonq/src/interfaces/cookiejar.h
A  +16   -0    libkonq/src/kf5compat.h  *
M  +34   -0    libkonq/src/konq_events.cpp
M  +26   -11   libkonq/src/konq_events.h
M  +0    -1    libkonq/src/konq_popupmenu.cpp
A  +27   -0    libkonq/src/libkonq_utils.cpp     [License: LGPL(v2.0+)]
A  +17   -0    libkonq/src/libkonq_utils.h     [License: LGPL(v2.0+)]
M  +7    -3    plugins/CMakeLists.txt
M  +2    -2    plugins/akregator/konqfeedicon.cpp
M  +3    -2    plugins/akregator/pluginutil.h
M  +3    -3    plugins/babelfish/plugin_babelfish.cpp
M  +1    -1    plugins/dirfilter/dirfilterplugin.cpp
M  +1    -1    plugins/fsview/CMakeLists.txt
M  +41   -29   plugins/fsview/fsview_part.cpp
M  +21   -5    plugins/fsview/fsview_part.h
M  +19   -1    plugins/kimgalleryplugin/imgalleryplugin.cpp
M  +2    -2    plugins/searchbar/searchbar.cpp
M  +1    -1    plugins/shellcmdplugin/kshellcmdexecutor.cpp
M  +1    -1    plugins/uachanger/uachangerplugin.cpp
M  +2    -3    plugins/webarchiver/thumbnailer/CMakeLists.txt
M  +18   -13   plugins/webarchiver/thumbnailer/webarchivecreator.cpp
M  +4    -4    plugins/webarchiver/thumbnailer/webarchivecreator.h
M  +6    -12   settings/bookmarks/bookmarks.cpp
M  +6    -2    settings/bookmarks/bookmarks.h
M  +8    -10   settings/konq/behaviour.cpp
M  +1    -1    settings/konq/behaviour.h
M  +2    -0    settings/konqhtml/CMakeLists.txt
M  +25   -24   settings/konqhtml/appearance.cpp
M  +6    -1    settings/konqhtml/appearance.h
M  +5    -5    settings/konqhtml/cache/cache.cpp
M  +8    -1    settings/konqhtml/cache/cache.h
M  +17   -30   settings/konqhtml/cookies/kcookiesmain.cpp
M  +2    -2    settings/konqhtml/cookies/kcookiesmain.h
M  +8    -13   settings/konqhtml/cookies/kcookiesmanagement.cpp
M  +6    -2    settings/konqhtml/cookies/kcookiesmanagement.h
M  +8    -35   settings/konqhtml/cookies/kcookiespolicies.cpp
M  +6    -2    settings/konqhtml/cookies/kcookiespolicies.h
M  +0    -1    settings/konqhtml/domainlistview.h
M  +22   -23   settings/konqhtml/filteropts.cpp
M  +6    -2    settings/konqhtml/filteropts.h
M  +17   -19   settings/konqhtml/generalopts.cpp
M  +6    -1    settings/konqhtml/generalopts.h
M  +11   -20   settings/konqhtml/htmlopts.cpp
M  +2    -1    settings/konqhtml/htmlopts.h
M  +13   -13   settings/konqhtml/javaopts.cpp
M  +4    -0    settings/konqhtml/javaopts.h
M  +14   -6    settings/konqhtml/jsopts.cpp
M  +4    -0    settings/konqhtml/jsopts.h
M  +16   -22   settings/konqhtml/main.cpp
M  +2    -2    settings/konqhtml/main.h
M  +10   -10   settings/konqhtml/useragent/useragent.cpp
M  +8    -1    settings/konqhtml/useragent/useragent.h
M  +6    -1    settings/performance/CMakeLists.txt
M  +25   -21   settings/performance/kcmperformance.cpp
M  +5    -3    settings/performance/kcmperformance.h
M  +5    -0    sidebar/CMakeLists.txt
M  +1    -1    sidebar/history_module/CMakeLists.txt
M  +10   -16   sidebar/history_module/kcmhistory.cpp
M  +5    -3    sidebar/history_module/kcmhistory.h
M  +2    -2    sidebar/konqsidebarplugin.cpp
M  +17   -6    sidebar/konqsidebarplugin.h
M  +11   -4    sidebar/sidebar_part.cpp
M  +5    -5    sidebar/sidebar_part.h
M  +7    -4    sidebar/sidebar_widget.cpp
M  +3    -4    sidebar/sidebar_widget.h
M  +6    -0    sidebar/trees/bookmark_module/bookmark_module.cpp
M  +6    -6    sidebar/trees/dirtree_module/dirtree_item.cpp
M  +1    -1    sidebar/trees/konq_sidebartree.h
M  +1    -1    sidebar/web_module/web_module.cpp
M  +20   -9    src/CMakeLists.txt
M  +32   -31   src/konqbookmarkmenu.cpp
M  +7    -0    src/konqbookmarkmenu.h
M  +5    -3    src/konqcombo.cpp
M  +0    -1    src/konqextensionmanager.cpp
M  +0    -1    src/konqguiclients.cpp
M  +1    -0    src/konqhistoryview.cpp
M  +93   -74   src/konqmainwindow.cpp
M  +7    -5    src/konqmainwindow.h
M  +4    -5    src/konqmisc.cpp
M  +1    -1    src/konqmisc.h
M  +1    -1    src/konqopenurlrequest.h
M  +1    -0    src/konqpixmapprovider.h
M  +3    -3    src/konqsessionmanager.cpp
M  +1    -0    src/konqundomanager.cpp
M  +21   -0    src/konqutils.cpp
M  +11   -0    src/konqutils.h
M  +27   -27   src/konqview.cpp
M  +6    -4    src/konqview.h
M  +2    -2    src/konqviewmanager.cpp
M  +1    -1    src/ksortfilterproxymodel.cpp
M  +5    -1    src/ktabwidget.cpp
M  +16   -7    src/urlloader.cpp
M  +8    -1    src/urlloader.h
M  +10   -10   webenginepart/autotests/webengine_partapi_test.cpp
M  +9    -2    webenginepart/src/CMakeLists.txt
M  +0    -1    webenginepart/src/about/konq_aboutpage.cpp
M  +12   -3    webenginepart/src/certificateerrordialogmanager.cpp
M  +1    -1    webenginepart/src/choosepagesaveformatdlg.cpp
M  +0    -1    webenginepart/src/choosepagesaveformatdlg.h
M  +1    -0    webenginepart/src/cookies/webenginepartcookiejar6.cpp
M  +0    -1    webenginepart/src/cookies/webenginepartcookiejar6.h
M  +0    -1    webenginepart/src/cookies/webenginepartcookiejar_kio.h
M  +1    -0    webenginepart/src/navigationrecorder.h
M  +3    -2    webenginepart/src/settings/webengine_filter.cpp
M  +36   -31   webenginepart/src/settings/webenginesettings.cpp
M  +1    -1    webenginepart/src/ui/passwordbar.cpp
M  +18   -97   webenginepart/src/webenginepage.cpp
M  +2    -15   webenginepart/src/webenginepage.h
M  +39   -21   webenginepart/src/webenginepart.cpp
M  +10   -3    webenginepart/src/webenginepart.h
M  +118  -116  webenginepart/src/webenginepart_ext.cpp
M  +4    -11   webenginepart/src/webenginepart_ext.h
M  +6    -1    webenginepart/src/webenginepartcertificateerrordlg.cpp
M  +5    -2    webenginepart/src/webenginepartcontrols.cpp
M  +1    -1    webenginepart/src/webenginepartcontrols.h
M  +17   -2    webenginepart/src/webenginepartdownloadmanager.cpp
M  +6    -0    webenginepart/src/webenginepartdownloadmanager.h
M  +2    -2    webenginepart/src/webenginepartfactory.cpp
M  +1    -2    webenginepart/src/webenginepartkiohandler.cpp
M  +97   -70   webenginepart/src/webengineview.cpp
M  +17   -10   webenginepart/src/webengineview.h
M  +0    -13   webenginepart/src/webenginewallet.cpp
M  +0    -7    webenginepart/src/webenginewallet.h
M  +1    -1    webenginepart/src/webfieldsdataview.cpp
M  +4    -3    webenginepart/tests/webenginepart_tester.cpp

The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://invent.kde.org/network/konqueror/-/commit/4767c8e7d174f7663f4b7d9a7f2eddf69185c8fd

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0bc8381640..0be9de41bd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,11 +30,14 @@ include(GenerateExportHeader)
 
 if (QT_MAJOR_VERSION STREQUAL "6")
     set(KF_MAJOR_VERSION "6")
+    #TODO KF6: remove when it builds with KF6
+    set(KDE_QT_MODERNCODE_DEFINITIONS_LEVEL "5.82.0")
 else()
     set(KF_MAJOR_VERSION "5")
     set(KDE_COMPILERSETTINGS_LEVEL "5.82.0")
 endif()
 include(KDECompilerSettings NO_POLICY_SCOPE)
+remove_definitions(-DQT_NO_KEYWORDS)
 
 include(FeatureSummary)
 
@@ -42,14 +45,15 @@ set(KONQUEROR_LIB_VERSION "${RELEASE_SERVICE_VERSION}")
 set(KONQUEROR_VERSION "${KONQUEROR_LIB_VERSION}")
 
 find_package(Qt${KF_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets WebEngineWidgets)
-find_package(KF${KF_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS Parts KCMUtils Archive Crash WindowSystem Init IconThemes DBusAddons GuiAddons)
+find_package(KF${KF_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS Parts KCMUtils Archive Crash WindowSystem IconThemes DBusAddons GuiAddons I18n Sonnet TextWidgets Codecs)
+if (KF_MAJOR_VERSION STRLESS "6")
+    find_package(KF${KF_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS Init)
+endif()
 
 find_package(KF${KF_MAJOR_VERSION} ${KF_MIN_VERSION} COMPONENTS Activities DocTools) # Optional
 
 if (QT_MAJOR_VERSION STRLESS 6)
     find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras)
-else()
-    find_package(Qt6 ${QT_MIN_VERSION} REQUIRED COMPONENTS GuiPrivate)
 endif()
 
 if (QT_MAJOR_VERSION STRLESS 6)
@@ -94,9 +98,10 @@ add_subdirectory( settings )
 add_subdirectory( plugins )
 add_subdirectory( kioworkers )
 
-if (KF${KF_MAJOR_VERSION}DocTools_FOUND)
-    add_subdirectory( doc )
-endif()
+#TODO KF6: make documentation compile
+# if (KF${KF_MAJOR_VERSION}DocTools_FOUND)
+#     add_subdirectory( doc )
+# endif()
 
 set(DEVELOPER_MODE false CACHE BOOL "Enables developer mode, which allows running separate instances of Konqueror")
 
@@ -109,7 +114,11 @@ install(FILES org.kde.konqueror.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODI
 
 # Make sure kfmclient can find konqueror.desktop even if people remove it from the K menu (#62242)
 # This is why konqueror.desktop is installed into services.
-install( FILES org.kde.konqueror.desktop  DESTINATION  ${KDE_INSTALL_KSERVICES5DIR} )
+#TODO KF6: check whether the above comment is still relevant (remove Konqueror from the K menu and check
+#whether kfmclient works correctly. If it doesn't, find out how to make it work in KF6
+if (KF_MAJOR_VERSION STRLESS "6")
+    install( FILES org.kde.konqueror.desktop  DESTINATION  ${KDE_INSTALL_KSERVICES5DIR} )
+endif()
 # On Wayland the icon to use for the main window is read from the desktop file, which needs
 # to be in the applications directory, so it needs to be installed there, too (bug #452149)
 install( FILES org.kde.konqueror.desktop  DESTINATION  ${KDE_INSTALL_APPDIR} )
@@ -118,9 +127,10 @@ install(FILES konqy_preload.desktop DESTINATION ${KDE_INSTALL_AUTOSTARTDIR})
 
 install(FILES konqueror.categories  DESTINATION  ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
 
-ki18n_install(po)
-if (KF${KF_MAJOR_VERSION}DocTools_FOUND)
-    kdoctools_install(po)
-endif()
+#TODO KF6: make documentation compile
+# ki18n_install(po)
+# if (KF${KF_MAJOR_VERSION}DocTools_FOUND)
+#     kdoctools_install(po)
+# endif()
 
 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index 0aa949a500..63087c8281 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -8,7 +8,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/..  )
 ########### konqviewmgrtest ###############
 
 ecm_add_test(konqviewmgrtest.cpp
-    LINK_LIBRARIES kdeinit_konqueror Qt${KF_MAJOR_VERSION}::Core Qt${KF_MAJOR_VERSION}::Gui kwebenginepartlib Qt${KF_MAJOR_VERSION}::WebEngineWidgets Qt${KF_MAJOR_VERSION}::Test)
+    LINK_LIBRARIES konqueror_internal_lib Qt${KF_MAJOR_VERSION}::Core Qt${KF_MAJOR_VERSION}::Gui kwebenginepartlib Qt${KF_MAJOR_VERSION}::WebEngineWidgets Qt${KF_MAJOR_VERSION}::Test)
 
 ########### historymanagertest ###############
 
@@ -18,21 +18,21 @@ ecm_add_test(historymanagertest.cpp
 ########### undomanagertest ###############
 
 ecm_add_test(undomanagertest.cpp
-    LINK_LIBRARIES kdeinit_konqueror Qt${KF_MAJOR_VERSION}::Core Qt${KF_MAJOR_VERSION}::Test)
+    LINK_LIBRARIES konqueror_internal_lib Qt${KF_MAJOR_VERSION}::Core Qt${KF_MAJOR_VERSION}::Test)
 
 ########### konqhtmltest ###############
 
 ecm_add_test(konqhtmltest.cpp
-    LINK_LIBRARIES kdeinit_konqueror kwebenginepartlib Qt${KF_MAJOR_VERSION}::Core Qt${KF_MAJOR_VERSION}::Test)
+    LINK_LIBRARIES konqueror_internal_lib kwebenginepartlib Qt${KF_MAJOR_VERSION}::Core Qt${KF_MAJOR_VERSION}::Test)
 
 ########### konqviewtest ###############
 
 ecm_add_test(konqviewtest.cpp
-    LINK_LIBRARIES kdeinit_konqueror Qt${KF_MAJOR_VERSION}::Core Qt${KF_MAJOR_VERSION}::Test)
+    LINK_LIBRARIES konqueror_internal_lib Qt${KF_MAJOR_VERSION}::Core Qt${KF_MAJOR_VERSION}::Test)
 
 ########### openorsavequestion_unittest ###############
 
 ecm_add_test(openorsavequestion_unittest.cpp
-    LINK_LIBRARIES kdeinit_konqueror Qt${KF_MAJOR_VERSION}::Core Qt${KF_MAJOR_VERSION}::Test)
+    LINK_LIBRARIES konqueror_internal_lib Qt${KF_MAJOR_VERSION}::Core Qt${KF_MAJOR_VERSION}::Test KF${KF_MAJOR_VERSION}::Service)
 
 endif (NOT WIN32)
diff --git a/autotests/konqviewmgrtest.cpp b/autotests/konqviewmgrtest.cpp
index d499ca9207..c8b7345ddb 100644
--- a/autotests/konqviewmgrtest.cpp
+++ b/autotests/konqviewmgrtest.cpp
@@ -850,7 +850,7 @@ void ViewMgrTest::testBrowserArgumentsNewTab()
     KParts::BrowserArguments browserArgs;
     browserArgs.setNewTab(true);
     KonqView *view = mainWindow.currentView();
-    KParts::BrowserExtension *ext = view->browserExtension();
+    KParts::NavigationExtension *ext = view->browserExtension();
     QVERIFY(ext);
     emit ext->openUrlRequest(QUrl(QStringLiteral("data:text/html, <p>Second tab test</p>")), urlArgs, browserArgs);
     QTest::qWait(5000);
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index e11bbf2d7d..7fb6a79d33 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -1,6 +1,5 @@
 ########### kfmclient ###############
 include(ECMMarkNonGuiExecutable)
-find_package(KF${KF_MAJOR_VERSION} REQUIRED Init)
 
 set(kfmclient_SRCS
    kfmclient.cpp
@@ -23,18 +22,25 @@ set(kfmclient_LIBS
    Qt${KF_MAJOR_VERSION}::DBus
 )
 
+if (KF_MAJOR_VERSION STRLESS "6")
+    list(APPEND kfmclient_LIBS Qt5::X11Extras)
+endif()
+
 if (WIN32)
     add_definitions(-Dkdemain=main)
     add_executable(kfmclient ${kfmclient_SRCS})
     target_link_libraries(kfmclient ${kfmclient_LIBS})
 else ()
-    if (KF_MAJOR_VERSION STREQUAL "6")
-        kf6_add_kdeinit_executable( kfmclient NOGUI ${kfmclient_SRCS})
-    else()
+    if (KF_MAJOR_VERSION STRLESS "6")
+        list(APPEND kfmclient_LIBS Qt${KF_MAJOR_VERSION}::X11Extras)
         kf5_add_kdeinit_executable( kfmclient NOGUI ${kfmclient_SRCS})
+        target_link_libraries(kdeinit_kfmclient ${kfmclient_LIBS} )
+        install(TARGETS kdeinit_kfmclient  ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
+    else()
+        list(APPEND kfmclient_LIBS Qt${KF_MAJOR_VERSION}::GuiPrivate)
+        add_executable(kfmclient ${kfmclient_SRCS})
+        target_link_libraries(kfmclient ${kfmclient_LIBS})
     endif()
-    target_link_libraries(kdeinit_kfmclient ${kfmclient_LIBS} Qt${KF_MAJOR_VERSION}::X11Extras)
-    install(TARGETS kdeinit_kfmclient  ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
 endif ()
 
 install(TARGETS kfmclient ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
diff --git a/client/kfmclient.cpp b/client/kfmclient.cpp
index a44fd1ac87..131353f720 100644
--- a/client/kfmclient.cpp
+++ b/client/kfmclient.cpp
@@ -13,7 +13,6 @@
 #include <config-konqueror.h>
 
 #include <kmessagebox.h>
-#include <kmimetypetrader.h>
 #include <kservice.h>
 #include <KIO/CommandLauncherJob>
 #include <KIO/ApplicationLauncherJob>
@@ -48,7 +47,11 @@
 static const char appName[] = "kfmclient";
 static const char version[] = "2.0";
 
+#if QT_VERSION_MAJOR < 6
 extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
+#else
+int main(int argc, char **argv)
+#endif
 {
     QApplication app(argc, argv);
     KLocalizedString::setApplicationDomain("kfmclient");
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index afc9b0afb9..1029fa045f 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,5 +1,5 @@
 ########### install files ###############
 
-add_subdirectory( kcontrol${KF_MAJOR_VERSION} )
+add_subdirectory( kcontrol )
 
 add_subdirectory( konqueror )
diff --git a/doc/kcontrol5/CMakeLists.txt b/doc/kcontrol/CMakeLists.txt
similarity index 100%
rename from doc/kcontrol5/CMakeLists.txt
rename to doc/kcontrol/CMakeLists.txt
diff --git a/doc/kcontrol5/bookmarks/CMakeLists.txt b/doc/kcontrol/bookmarks/CMakeLists.txt
similarity index 100%
rename from doc/kcontrol5/bookmarks/CMakeLists.txt
rename to doc/kcontrol/bookmarks/CMakeLists.txt
diff --git a/doc/kcontrol5/bookmarks/index.docbook b/doc/kcontrol/bookmarks/index.docbook
similarity index 100%
rename from doc/kcontrol5/bookmarks/index.docbook
rename to doc/kcontrol/bookmarks/index.docbook
diff --git a/doc/kcontrol5/filemanager/CMakeLists.txt b/doc/kcontrol/filemanager/CMakeLists.txt
similarity index 100%
rename from doc/kcontrol5/filemanager/CMakeLists.txt
rename to doc/kcontrol/filemanager/CMakeLists.txt
diff --git a/doc/kcontrol5/filemanager/index.docbook b/doc/kcontrol/filemanager/index.docbook
similarity index 100%
rename from doc/kcontrol5/filemanager/index.docbook
rename to doc/kcontrol/filemanager/index.docbook
diff --git a/doc/kcontrol5/history/CMakeLists.txt b/doc/kcontrol/history/CMakeLists.txt
similarity index 100%
rename from doc/kcontrol5/history/CMakeLists.txt
rename to doc/kcontrol/history/CMakeLists.txt
diff --git a/doc/kcontrol5/history/index.docbook b/doc/kcontrol/history/index.docbook
similarity index 100%
rename from doc/kcontrol5/history/index.docbook
rename to doc/kcontrol/history/index.docbook
diff --git a/doc/kcontrol5/kcmcss/CMakeLists.txt b/doc/kcontrol/kcmcss/CMakeLists.txt
similarity index 100%
rename from doc/kcontrol5/kcmcss/CMakeLists.txt
rename to doc/kcontrol/kcmcss/CMakeLists.txt
diff --git a/doc/kcontrol5/kcmcss/index.docbook b/doc/kcontrol/kcmcss/index.docbook
similarity index 100%
rename from doc/kcontrol5/kcmcss/index.docbook
rename to doc/kcontrol/kcmcss/index.docbook
diff --git a/doc/kcontrol5/khtml-adblock/CMakeLists.txt b/doc/kcontrol/khtml-adblock/CMakeLists.txt
similarity index 100%
rename from doc/kcontrol5/khtml-adblock/CMakeLists.txt
rename to doc/kcontrol/khtml-adblock/CMakeLists.txt
diff --git a/doc/kcontrol5/khtml-adblock/index.docbook b/doc/kcontrol/khtml-adblock/index.docbook
similarity index 100%
rename from doc/kcontrol5/khtml-adblock/index.docbook
rename to doc/kcontrol/khtml-adblock/index.docbook
diff --git a/doc/kcontrol5/khtml-behavior/CMakeLists.txt b/doc/kcontrol/khtml-behavior/CMakeLists.txt
similarity index 100%
rename from doc/kcontrol5/khtml-behavior/CMakeLists.txt
rename to doc/kcontrol/khtml-behavior/CMakeLists.txt
diff --git a/doc/kcontrol5/khtml-behavior/index.docbook b/doc/kcontrol/khtml-behavior/index.docbook
similarity index 100%
rename from doc/kcontrol5/khtml-behavior/index.docbook
rename to doc/kcontrol/khtml-behavior/index.docbook
diff --git a/doc/kcontrol5/khtml-general/CMakeLists.txt b/doc/kcontrol/khtml-general/CMakeLists.txt
similarity index 100%
rename from doc/kcontrol5/khtml-general/CMakeLists.txt
rename to doc/kcontrol/khtml-general/CMakeLists.txt
diff --git a/doc/kcontrol5/khtml-general/index.docbook b/doc/kcontrol/khtml-general/index.docbook
similarity index 100%
rename from doc/kcontrol5/khtml-general/index.docbook
rename to doc/kcontrol/khtml-general/index.docbook
diff --git a/doc/kcontrol5/khtml-java-js/CMakeLists.txt b/doc/kcontrol/khtml-java-js/CMakeLists.txt
similarity index 100%
rename from doc/kcontrol5/khtml-java-js/CMakeLists.txt
rename to doc/kcontrol/khtml-java-js/CMakeLists.txt
diff --git a/doc/kcontrol5/khtml-java-js/index.docbook b/doc/kcontrol/khtml-java-js/index.docbook
similarity index 100%
rename from doc/kcontrol5/khtml-java-js/index.docbook
rename to doc/kcontrol/khtml-java-js/index.docbook
diff --git a/doc/kcontrol5/performance/CMakeLists.txt b/doc/kcontrol/performance/CMakeLists.txt
similarity index 100%
rename from doc/kcontrol5/performance/CMakeLists.txt
rename to doc/kcontrol/performance/CMakeLists.txt
diff --git a/doc/kcontrol5/performance/index.docbook b/doc/kcontrol/performance/index.docbook
similarity index 100%
rename from doc/kcontrol5/performance/index.docbook
rename to doc/kcontrol/performance/index.docbook
diff --git a/kioworkers/bookmarks/kio_bookmarks.cpp b/kioworkers/bookmarks/kio_bookmarks.cpp
index fbf8d5c3b7..06cd84c54a 100644
--- a/kioworkers/bookmarks/kio_bookmarks.cpp
+++ b/kioworkers/bookmarks/kio_bookmarks.cpp
@@ -38,7 +38,12 @@ class KIOPluginForMetaData : public QObject
 BookmarksProtocol::BookmarksProtocol( const QByteArray &pool, const QByteArray &app )
     : WorkerBase( "bookmarks", pool, app )
 {
+#if QT_VERSION_MAJOR < 6
     manager = KBookmarkManager::userBookmarksManager();
+#else
+    const QString bookmarksFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/konqueror/bookmarks.xml");
+    manager = KBookmarkManager::managerForFile(bookmarksFile);
+#endif
     cfg = new KConfig( "kiobookmarksrc" );
     config = cfg->group("General");
     cache = new KImageCache("kio_bookmarks", config.readEntry("CacheSize", 5 * 1024) * 1024);
diff --git a/libkonq/autotests/konqpopupmenutest.cpp b/libkonq/autotests/konqpopupmenutest.cpp
index 0e7ebb32c0..7adf6d73b8 100644
--- a/libkonq/autotests/konqpopupmenutest.cpp
+++ b/libkonq/autotests/konqpopupmenutest.cpp
@@ -7,6 +7,7 @@
 #undef QT_NO_CAST_FROM_ASCII
 
 #include "konqpopupmenutest.h"
+#include "libkonq_utils.h"
 
 #include <kconfiggroup.h>
 #include <kbookmarkmanager.h>
@@ -21,6 +22,7 @@
 #include <QStandardPaths>
 #include <QFile>
 #include <QTextStream>
+#include <QActionGroup>
 
 QTEST_MAIN(KonqPopupMenuTest)
 
@@ -494,7 +496,7 @@ void KonqPopupMenuTest::testHtmlLink()
     KonqPopupMenu popup(itemList, viewUrl, m_actionCollection, flags);
     popup.setNewFileMenu(m_newMenu);
     popup.setActionGroups(actionGroups);
-    popup.setBookmarkManager(KBookmarkManager::userBookmarksManager());
+    popup.setBookmarkManager(Konq::userBookmarksManager());
 
     QStringList actions = extractActionNames(popup);
     // Be tolerant with openwith, it could be there once or twice
@@ -546,7 +548,7 @@ void KonqPopupMenuTest::testHtmlPage()
     KonqPopupMenu popup(itemList, viewUrl, m_actionCollection, flags);
     popup.setNewFileMenu(m_newMenu);
     popup.setActionGroups(actionGroups);
-    popup.setBookmarkManager(KBookmarkManager::userBookmarksManager());
+    popup.setBookmarkManager(Konq::userBookmarksManager());
 
     QStringList actions = extractActionNames(popup);
     // Be tolerant with openwith, it could be there once or twice
diff --git a/libkonq/src/CMakeLists.txt b/libkonq/src/CMakeLists.txt
index e99a0a45a3..1b1429ed97 100644
--- a/libkonq/src/CMakeLists.txt
+++ b/libkonq/src/CMakeLists.txt
@@ -20,6 +20,7 @@ set(konq_LIB_SRCS
    interfaces/cookiejar.cpp
    interfaces/common.h
    interfaces/downloaderextension.cpp
+   libkonq_utils.cpp
 )
 
 ecm_qt_declare_logging_category(konq_LIB_SRCS HEADER libkonq_debug.h IDENTIFIER LIBKONQ_LOG CATEGORY_NAME org.kde.libkonq)
@@ -40,6 +41,7 @@ target_link_libraries(KF${KF_MAJOR_VERSION}Konq
     KF${KF_MAJOR_VERSION}::Service
     KF${KF_MAJOR_VERSION}::Parts
     Qt${KF_MAJOR_VERSION}::WebEngineWidgets
+    KF${KF_MAJOR_VERSION}::TextWidgets
     PRIVATE
     KF${KF_MAJOR_VERSION}::Bookmarks
     KF${KF_MAJOR_VERSION}::I18n
diff --git a/libkonq/src/browseropenorsavequestion.cpp b/libkonq/src/browseropenorsavequestion.cpp
index 2af3b4b078..66fcb3094c 100644
--- a/libkonq/src/browseropenorsavequestion.cpp
+++ b/libkonq/src/browseropenorsavequestion.cpp
@@ -27,7 +27,6 @@
 #include <QStyleOption>
 #include <QVBoxLayout>
 
-using namespace KParts;
 Q_DECLARE_METATYPE(KService::Ptr)
 
 class BrowserOpenOrSaveQuestionPrivate : public QDialog
diff --git a/libkonq/src/interfaces/cookiejar.cpp b/libkonq/src/interfaces/cookiejar.cpp
index 04e9d92e4d..c680f76c5c 100644
--- a/libkonq/src/interfaces/cookiejar.cpp
+++ b/libkonq/src/interfaces/cookiejar.cpp
@@ -8,8 +8,6 @@
 
 #include <KConfigGroup>
 
-#include <QNetworkCookie>
-
 using namespace KonqInterfaces;
 
 CookieJar::CookieJar(QObject* parent) : QObject(parent)
diff --git a/libkonq/src/interfaces/cookiejar.h b/libkonq/src/interfaces/cookiejar.h
index ef74196076..edf8ae3f4b 100644
--- a/libkonq/src/interfaces/cookiejar.h
+++ b/libkonq/src/interfaces/cookiejar.h
@@ -13,11 +13,10 @@
 #include <QSet>
 #include <QUrl>
 #include <QVector>
+#include <QNetworkCookie>
 
 class KConfigGroup;
 
-class QNetworkCookie;
-
 namespace KonqInterfaces {
 
 /**
diff --git a/libkonq/src/kf5compat.h b/libkonq/src/kf5compat.h
new file mode 100644
index 0000000000..1bbd147aa0
--- /dev/null
+++ b/libkonq/src/kf5compat.h
@@ -0,0 +1,16 @@
+#ifndef LIBKONQ_KF5COMPAT_H
+#define LIBKONQ_KF5COMPAT_H
+
+#include <QtGlobal>
+#if QT_VERSION_MAJOR < 6
+#include <KParts/BrowserExtension>
+namespace KParts {
+  typedef BrowserExtension NavigationExtension;
+}
+#else
+#include <KParts/NavigationExtension>
+#endif
+
+#endif //LIBKONQ_KF5COMPAT_H
+
+
diff --git a/libkonq/src/konq_events.cpp b/libkonq/src/konq_events.cpp
index 1ae65ea3f0..da4132ef6d 100644
--- a/libkonq/src/konq_events.cpp
+++ b/libkonq/src/konq_events.cpp
@@ -7,11 +7,19 @@
 
 #include "konq_events.h"
 
+#if QT_VERSION_MAJOR < 6
 const char *const KonqFileSelectionEvent::s_fileItemSelectionEventName = "Konqueror/FileSelection";
 const char *const KonqFileMouseOverEvent::s_fileItemMouseOverEventName = "Konqueror/FileMouseOver";
+#endif
+
+const int KonqFileSelectionEventType = QEvent::registerEventType();
 
 KonqFileSelectionEvent::KonqFileSelectionEvent(const KFileItemList &selection, KParts::ReadOnlyPart *part)
+#if QT_VERSION_MAJOR < 6
     : KParts::Event(s_fileItemSelectionEventName), m_selection(selection), m_part(part)
+#else
+    : QEvent(static_cast<QEvent::Type>(KonqFileSelectionEventType))
+#endif
 {
 }
 
@@ -19,11 +27,37 @@ KonqFileSelectionEvent::~KonqFileSelectionEvent()
 {
 }
 
+
+bool KonqFileSelectionEvent::test(const QEvent *event)
+{
+        
+#if QT_VERSION_MAJOR < 6
+        return KParts::Event::test(event, s_fileItemSelectionEventName);
+#else
+        return event->type() == KonqFileSelectionEventType;
+#endif
+}
+
+const int KonqFileMouseOverEventType = QEvent::registerEventType();
 KonqFileMouseOverEvent::KonqFileMouseOverEvent(const KFileItem &item, KParts::ReadOnlyPart *part)
+#if QT_VERSION_MAJOR < 6
     : KParts::Event(s_fileItemMouseOverEventName), m_item(item), m_part(part)
+#else
+    : QEvent(static_cast<QEvent::Type>(KonqFileMouseOverEventType))
+#endif
 {
 }
 
 KonqFileMouseOverEvent::~KonqFileMouseOverEvent()
 {
 }
+
+bool KonqFileMouseOverEvent::test(const QEvent *event)
+{
+        
+#if QT_VERSION_MAJOR < 6
+        return KParts::Event::test(event, s_fileItemMouseOverEventName);
+#else
+        return event->type() == KonqFileMouseOverEventType;
+#endif
+}
diff --git a/libkonq/src/konq_events.h b/libkonq/src/konq_events.h
index b04f41ca53..0463afd482 100644
--- a/libkonq/src/konq_events.h
+++ b/libkonq/src/konq_events.h
@@ -8,19 +8,31 @@
 #ifndef __konq_events_h__
 #define __konq_events_h__
 
-#include <kparts/event.h>
-#include <QList>
 #include <libkonq_export.h>
 #include <kfileitem.h>
 #include <kconfigbase.h>
 
+#include <QList>
+#include <QtGlobal>
+
+#if QT_VERSION_MAJOR < 6
+#include <kparts/event.h>
+#else
+#include <QEvent>
+#endif
+
+
 namespace KParts
 {
 class ReadOnlyPart;
 }
 
 
+#if QT_VERSION_MAJOR < 6
 class LIBKONQ_EXPORT KonqFileSelectionEvent : public KParts::Event
+#else 
+class LIBKONQ_EXPORT KonqFileSelectionEvent : public QEvent
+#endif
 {
 public:
     KonqFileSelectionEvent(const KFileItemList &selection, KParts::ReadOnlyPart *part);
@@ -30,25 +42,29 @@ public:
     {
         return m_selection;
     }
+    
     KParts::ReadOnlyPart *part() const
     {
         return m_part;
     }
-
-    static bool test(const QEvent *event)
-    {
-        return KParts::Event::test(event, s_fileItemSelectionEventName);
-    }
+    
+    static bool test(const QEvent *event);
 
 private:
+#if QT_VERSION_MAJOR < 6
     Q_DISABLE_COPY(KonqFileSelectionEvent)
     static const char *const s_fileItemSelectionEventName;
+#endif
 
     KFileItemList m_selection;
     KParts::ReadOnlyPart *m_part;
 };
 
+#if QT_VERSION_MAJOR < 6
 class LIBKONQ_EXPORT KonqFileMouseOverEvent : public KParts::Event
+#else
+class LIBKONQ_EXPORT KonqFileMouseOverEvent : public QEvent
+#endif
 {
 public:
     KonqFileMouseOverEvent(const KFileItem &item, KParts::ReadOnlyPart *part);
@@ -63,14 +79,13 @@ public:
         return m_part;
     }
 
-    static bool test(const QEvent *event)
-    {
-        return KParts::Event::test(event, s_fileItemMouseOverEventName);
-    }
+    static bool test(const QEvent *event);
 
 private:
+#if QT_VERSION_MAJOR < 6
     Q_DISABLE_COPY(KonqFileMouseOverEvent)
     static const char *const s_fileItemMouseOverEventName;
+#endif
 
     KFileItem m_item;
     KParts::ReadOnlyPart *m_part;
diff --git a/libkonq/src/konq_popupmenu.cpp b/libkonq/src/konq_popupmenu.cpp
index e3cdd30ba3..6384b859a3 100644
--- a/libkonq/src/konq_popupmenu.cpp
+++ b/libkonq/src/konq_popupmenu.cpp
@@ -21,7 +21,6 @@
 #include <KIO/JobUiDelegate>
 #include <kprotocolmanager.h>
 #include <knewfilemenu.h>
-#include <kmimetypetrader.h>
 #include <kconfiggroup.h>
 #include <KSharedConfig>
 #include <kdesktopfile.h>
diff --git a/libkonq/src/libkonq_utils.cpp b/libkonq/src/libkonq_utils.cpp
new file mode 100644
index 0000000000..0cd03d8a5a
--- /dev/null
+++ b/libkonq/src/libkonq_utils.cpp
@@ -0,0 +1,27 @@
+/* This file is part of the KDE project
+    SPDX-FileCopyrightText: 2023 Stefano Crocco <stefano.crocco at alice.it>
+
+    SPDX-License-Identifier: LGPL-2.0-or-later
+*/
+
+#include "libkonq_utils.h"
+
+#include <KBookmarkManager>
+#include <QStandardPaths>
+
+using namespace Konq;
+
+KBookmarkManager * Konq::userBookmarksManager()
+{
+#if QT_VERSION_MAJOR < 6
+    return KBookmarkManager::userBookmarksManager();
+#else
+    static KBookmarkManager *s_manager = nullptr;
+    if (!s_manager) {
+        const QString bookmarksFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/konqueror/bookmarks.xml");
+        s_manager = KBookmarkManager::managerForFile(bookmarksFile);
+    }
+    return s_manager;
+#endif
+}
+
diff --git a/libkonq/src/libkonq_utils.h b/libkonq/src/libkonq_utils.h
new file mode 100644
index 0000000000..6c78d8f706
--- /dev/null
+++ b/libkonq/src/libkonq_utils.h
@@ -0,0 +1,17 @@
+/* This file is part of the KDE project
+    SPDX-FileCopyrightText: 2023 Stefano Crocco <stefano.crocco at alice.it>
+
+    SPDX-License-Identifier: LGPL-2.0-or-later
+*/
+#ifndef LIBKONQ_UTILS_H
+#define LIBKONQ_UTILS_H
+
+#include "libkonq_export.h"
+
+class KBookmarkManager;
+
+namespace LIBKONQ_EXPORT Konq {
+    KBookmarkManager* userBookmarksManager();
+}
+#endif //LIBKONQ_UTILS_H
+
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index 1590b9bc87..a37e789137 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -24,7 +24,14 @@ add_subdirectory( dirfilter )
 add_subdirectory( uachanger )
 add_subdirectory( babelfish )
 add_subdirectory( webarchiver )
+# TODO KF6: after dropping compatibility with KF5, port these plugins to AsyncSelectorInterface and
+# remove the if. Since KParts::SelectorInterface is going away in KF6, supporting them in both versions
+# is too difficult
+if (KF_MAJOR_VERSION STRLESS "6")
 add_subdirectory( kget )
+add_subdirectory( akregator )
+add_subdirectory( searchbar )
+endif()
 
 if (QtTextToSpeech_FOUND)
    add_subdirectory(ttsplugin)
@@ -39,7 +46,4 @@ add_subdirectory( autorefresh )
 if(UNIX)
    add_subdirectory( fsview )
 endif()
-add_subdirectory( searchbar )
-
-add_subdirectory( akregator )
 
diff --git a/plugins/akregator/konqfeedicon.cpp b/plugins/akregator/konqfeedicon.cpp
index 5fba63cf95..ec6912a5ee 100644
--- a/plugins/akregator/konqfeedicon.cpp
+++ b/plugins/akregator/konqfeedicon.cpp
@@ -18,7 +18,7 @@
 #include <kparts/part.h>
 #include <kparts/statusbarextension.h>
 #include <KParts/ReadOnlyPart>
-#include <KParts/BrowserExtension>
+#include "kf5compat.h" //For NavigationExtension
 #include <KParts/SelectorInterface>
 #include <kio/job.h>
 #include <kurllabel.h>
@@ -275,7 +275,7 @@ void Akregator::KonqFeedIcon::copyFeedUrlToClipboard(const QString& url)
 
 void Akregator::KonqFeedIcon::openFeedUrl(const QString& url, const QString &mimeType)
 {
-    KParts::BrowserExtension *ext = KParts::BrowserExtension::childObject(m_part);
+    KParts::NavigationExtension *ext = KParts::NavigationExtension::childObject(m_part);
     if (!ext) {
         return;
     }
diff --git a/plugins/akregator/pluginutil.h b/plugins/akregator/pluginutil.h
index bff3499746..ad5ae13a66 100644
--- a/plugins/akregator/pluginutil.h
+++ b/plugins/akregator/pluginutil.h
@@ -9,8 +9,9 @@
 #ifndef PLUGINUTIL_H
 #define PLUGINUTIL_H
 
-class QString;
-class QStringList;
+#include <QString>
+#include <QStringList>
+
 class QUrl;
 
 namespace Akregator
diff --git a/plugins/babelfish/plugin_babelfish.cpp b/plugins/babelfish/plugin_babelfish.cpp
index 976aa3bf07..f327c72ab3 100644
--- a/plugins/babelfish/plugin_babelfish.cpp
+++ b/plugins/babelfish/plugin_babelfish.cpp
@@ -16,7 +16,7 @@
 #include "plugin_babelfish.h"
 
 #include <kparts/part.h>
-#include <kparts/browserextension.h>
+#include "kf5compat.h" //For NavigationExtension
 
 #include <kwidgetsaddons_version.h>
 #include <kactioncollection.h>
@@ -217,7 +217,7 @@ void PluginBabelFish::slotEnableMenu()
     if (part && textExt) {
         const QString scheme = part->url().scheme();	// always lower case
         if ((scheme == QLatin1String("http")) || (scheme == QLatin1String("https"))) {
-            if (KParts::BrowserExtension::childObject(part)) {
+            if (KParts::NavigationExtension::childObject(part)) {
                 m_menu->setEnabled(true);
                 return;
             }
@@ -240,7 +240,7 @@ void PluginBabelFish::translateURL(QAction *action)
     const QString language = action->objectName();
     const QString engine = grp.readEntry(language, QStringLiteral("google"));
 
-    KParts::BrowserExtension *ext = KParts::BrowserExtension::childObject(parent());
+    KParts::NavigationExtension *ext = KParts::NavigationExtension::childObject(parent());
     if (!ext) {
         return;
     }
diff --git a/plugins/dirfilter/dirfilterplugin.cpp b/plugins/dirfilter/dirfilterplugin.cpp
index a98444907d..4d88b2fdbd 100644
--- a/plugins/dirfilter/dirfilterplugin.cpp
+++ b/plugins/dirfilter/dirfilterplugin.cpp
@@ -25,7 +25,7 @@
 #include <kactioncollection.h>
 #include <KConfigGroup>
 #include <KConfig>
-#include <kparts/browserextension.h>
+#include "kf5compat.h" //For NavigationExtension
 
 
 Q_GLOBAL_STATIC(SessionManager, globalSessionManager)
diff --git a/plugins/fsview/CMakeLists.txt b/plugins/fsview/CMakeLists.txt
index 942ab7c26c..c1e8be10f2 100644
--- a/plugins/fsview/CMakeLists.txt
+++ b/plugins/fsview/CMakeLists.txt
@@ -41,7 +41,7 @@ set(fsviewpart_PART_SRCS fsview_part.cpp ${libfsview_SRCS})
 
 add_library(fsviewpart MODULE ${fsviewpart_PART_SRCS})
 
-target_link_libraries(fsviewpart KF${KF_MAJOR_VERSION}::I18n KF${KF_MAJOR_VERSION}::Parts KF${KF_MAJOR_VERSION}::IconThemes)
+target_link_libraries(fsviewpart KF${KF_MAJOR_VERSION}::I18n KF${KF_MAJOR_VERSION}::Parts KF${KF_MAJOR_VERSION}::IconThemes KF${KF_MAJOR_VERSION}::KIOWidgets)
 
 install(TARGETS fsviewpart DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf${KF_MAJOR_VERSION}/parts)
 
diff --git a/plugins/fsview/fsview_part.cpp b/plugins/fsview/fsview_part.cpp
index d4dba7fb9e..d29e250aec 100644
--- a/plugins/fsview/fsview_part.cpp
+++ b/plugins/fsview/fsview_part.cpp
@@ -24,7 +24,7 @@
 #include <kprotocolmanager.h>
 #include <kio/copyjob.h>
 #include <kio/deletejob.h>
-#include <kio/paste.h>
+#include <KIO/Paste>
 #include <kmessagebox.h>
 #include <kactionmenu.h>
 #include <kactioncollection.h>
@@ -69,21 +69,33 @@ void FSJob::progressSlot(int percent, int dirs, const QString &cDir)
         emitPercent(percent, 100);
         slotInfoMessage(this, i18np("Read 1 folder, in %2",
                                     "Read %1 folders, in %2",
-                                    dirs, cDir), QString());
+                                    dirs, cDir));
     } else {
-        slotInfoMessage(this, i18np("1 folder", "%1 folders", dirs), QString());
+        slotInfoMessage(this, i18np("1 folder", "%1 folders", dirs));
     }
 }
 
+#if QT_VERSION_MAJOR < 6
+void FSJob::slotInfoMessage(KJob* job, const QString& plain, const QString& rich)
+{
+    KCompositeJob::slotInfoMessage(job, plain, rich);
+}
+#endif
+
 // FSViewPart
 
 FSViewPart::FSViewPart(QWidget *parentWidget,
                        QObject *parent,
                        const KPluginMetaData& metaData,
                        const QList<QVariant> & /* args */)
+#if QT_VERSION_MAJOR < 6
     : KParts::ReadOnlyPart(parent)
 {
     setMetaData(metaData);
+#else
+    : KParts::ReadOnlyPart(parent, metaData)
+{
+#endif
     _view = new FSView(new Inode(), parentWidget);
     _view->setWhatsThis(i18n("<p>This is the FSView plugin, a graphical "
                              "browsing mode showing filesystem utilization "
@@ -98,7 +110,7 @@ FSViewPart::FSViewPart(QWidget *parentWidget,
     _view->show();
     setWidget(_view);
 
-    _ext = new FSViewBrowserExtension(this);
+    _ext = new FSViewNavigationExtension(this);
     _job = nullptr;
 
     _areaMenu = new KActionMenu(i18n("Stop at Area"),
@@ -132,10 +144,10 @@ FSViewPart::FSViewPart(QWidget *parentWidget,
     // Both of these click signals are connected.  Whether a single or
     // double click activates an item is checked against the current
     // style setting when the click happens.
-    connect(_view, &FSView::clicked, _ext, &FSViewBrowserExtension::itemSingleClicked);
-    connect(_view, &FSView::doubleClicked, _ext, &FSViewBrowserExtension::itemDoubleClicked);
+    connect(_view, &FSView::clicked, _ext, &FSViewNavigationExtension::itemSingleClicked);
+    connect(_view, &FSView::doubleClicked, _ext, &FSViewNavigationExtension::itemDoubleClicked);
 
-    connect(_view, &TreeMapWidget::returnPressed, _ext, &FSViewBrowserExtension::selected);
+    connect(_view, &TreeMapWidget::returnPressed, _ext, &FSViewNavigationExtension::selected);
     connect(_view, QOverload<>::of(&TreeMapWidget::selectionChanged), this, &FSViewPart::updateActions);
     connect(_view, &TreeMapWidget::contextMenuRequested, this, &FSViewPart::contextMenu);
 
@@ -155,17 +167,17 @@ FSViewPart::FSViewPart(QWidget *parentWidget,
     moveToTrashAction->setText(i18nc("@action:inmenu File", "Move to Trash"));
     moveToTrashAction->setIcon(QIcon::fromTheme(QStringLiteral("user-trash")));
     actionCollection()->setDefaultShortcut(moveToTrashAction, QKeySequence(QKeySequence::Delete));
-    connect(moveToTrashAction, &QAction::triggered, _ext, &FSViewBrowserExtension::trash);
+    connect(moveToTrashAction, &QAction::triggered, _ext, &FSViewNavigationExtension::trash);
 
     QAction *deleteAction = actionCollection()->addAction(QStringLiteral("delete"));
     deleteAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
     deleteAction->setText(i18nc("@action:inmenu File", "Delete"));
     actionCollection()->setDefaultShortcut(deleteAction, QKeySequence(Qt::SHIFT | Qt::Key_Delete));
-    connect(deleteAction, &QAction::triggered, _ext, &FSViewBrowserExtension::del);
+    connect(deleteAction, &QAction::triggered, _ext, &FSViewNavigationExtension::del);
 
     QAction *editMimeTypeAction = actionCollection()->addAction(QStringLiteral("editMimeType"));
     editMimeTypeAction->setText(i18nc("@action:inmenu Edit", "&Edit File Type..."));
-    connect(editMimeTypeAction, &QAction::triggered, _ext, &FSViewBrowserExtension::editMimeType);
+    connect(editMimeTypeAction, &QAction::triggered, _ext, &FSViewNavigationExtension::editMimeType);
 
     QAction *propertiesAction = actionCollection()->addAction(QStringLiteral("properties"));
     propertiesAction->setText(i18nc("@action:inmenu File", "Properties"));
@@ -321,7 +333,7 @@ void FSViewPart::updateActions()
         }
     }
 
-    // Standard KBrowserExtension actions.
+    // Standard KNavigationExtension actions.
     emit _ext->enableAction("copy", canCopy > 0);
     emit _ext->enableAction("cut", canMove > 0);
     // Custom actions.
@@ -381,14 +393,14 @@ void FSViewPart::contextMenu(TreeMapItem * /*item*/, const QPoint &p)
     }
 
     QList<QAction *> editActions;
-    KParts::BrowserExtension::ActionGroupMap actionGroups;
-    KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::ShowUrlOperations |
-            KParts::BrowserExtension::ShowProperties;
+    KParts::NavigationExtension::ActionGroupMap actionGroups;
+    KParts::NavigationExtension::PopupFlags flags = KParts::NavigationExtension::ShowUrlOperations |
+            KParts::NavigationExtension::ShowProperties;
 
     bool addTrash = (canMove > 0);
     bool addDel = false;
     if (canDel == 0) {
-        flags |= KParts::BrowserExtension::NoDeletion;
+        flags |= KParts::NavigationExtension::NoDeletion;
     } else {
         if (!url().isLocalFile()) {
             addDel = true;
@@ -435,18 +447,18 @@ void FSViewPart::slotProperties()
     }
 }
 
-// FSViewBrowserExtension
+// FSViewNavigationExtension
 
-FSViewBrowserExtension::FSViewBrowserExtension(FSViewPart *viewPart)
-    : KParts::BrowserExtension(viewPart)
+FSViewNavigationExtension::FSViewNavigationExtension(FSViewPart *viewPart)
+    : KParts::NavigationExtension(viewPart)
 {
     _view = viewPart->view();
 }
 
-FSViewBrowserExtension::~FSViewBrowserExtension()
+FSViewNavigationExtension::~FSViewNavigationExtension()
 {}
 
-void FSViewBrowserExtension::del()
+void FSViewNavigationExtension::del()
 {
     const QList<QUrl> urls = _view->selectedUrls();
     KJobUiDelegate* baseUiDelegate = KIO::createDefaultJobUiDelegate(KJobUiDelegate::Flags{}, _view);
@@ -457,11 +469,11 @@ void FSViewBrowserExtension::del()
         KIO::Job *job = KIO::del(urls);
         KJobWidgets::setWindow(job, _view);
         job->uiDelegate()->setAutoErrorHandlingEnabled(true);
-        connect(job, &KJob::result, this, &FSViewBrowserExtension::refresh);
+        connect(job, &KJob::result, this, &FSViewNavigationExtension::refresh);
     }
 }
 
-void FSViewBrowserExtension::trash()
+void FSViewNavigationExtension::trash()
 {
     bool deleteNotTrash = ((QGuiApplication::keyboardModifiers() & Qt::ShiftModifier) != 0);
     if (deleteNotTrash) {
@@ -477,12 +489,12 @@ void FSViewBrowserExtension::trash()
             KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, urls, QUrl("trash:/"), job);
             KJobWidgets::setWindow(job, _view);
             job->uiDelegate()->setAutoErrorHandlingEnabled(true);
-            connect(job, &KJob::result, this, &FSViewBrowserExtension::refresh);
+            connect(job, &KJob::result, this, &FSViewNavigationExtension::refresh);
         }
     }
 }
 
-void FSViewBrowserExtension::copySelection(bool move)
+void FSViewNavigationExtension::copySelection(bool move)
 {
     QMimeData *data = new QMimeData;
     data->setUrls(_view->selectedUrls());
@@ -490,7 +502,7 @@ void FSViewBrowserExtension::copySelection(bool move)
     QApplication::clipboard()->setMimeData(data);
 }
 
-void FSViewBrowserExtension::editMimeType()
+void FSViewNavigationExtension::editMimeType()
 {
     Inode *i = (Inode *) _view->selection().first();
     if (i) {
@@ -499,7 +511,7 @@ void FSViewBrowserExtension::editMimeType()
 }
 
 // refresh treemap at end of KIO jobs
-void FSViewBrowserExtension::refresh()
+void FSViewNavigationExtension::refresh()
 {
     // only need to refresh common ancestor for all selected items
     TreeMapItem *commonParent = _view->selection().commonParent();
@@ -521,7 +533,7 @@ void FSViewBrowserExtension::refresh()
     _view->requestUpdate((Inode *)commonParent);
 }
 
-void FSViewBrowserExtension::itemSingleClicked(TreeMapItem *i)
+void FSViewNavigationExtension::itemSingleClicked(TreeMapItem *i)
 {
     if (_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)) {
         selected(i);
@@ -529,14 +541,14 @@ void FSViewBrowserExtension::itemSingleClicked(TreeMapItem *i)
 }
 
 
-void FSViewBrowserExtension::itemDoubleClicked(TreeMapItem *i)
+void FSViewNavigationExtension::itemDoubleClicked(TreeMapItem *i)
 {
     if (!_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)) {
         selected(i);
     }
 }
 
-void FSViewBrowserExtension::selected(TreeMapItem *i)
+void FSViewNavigationExtension::selected(TreeMapItem *i)
 {
     if (!i) {
         return;
diff --git a/plugins/fsview/fsview_part.h b/plugins/fsview/fsview_part.h
index a49d5d5028..d752a13ce5 100644
--- a/plugins/fsview/fsview_part.h
+++ b/plugins/fsview/fsview_part.h
@@ -13,7 +13,18 @@
 
 #include <kparts_version.h>
 #include <kparts/part.h>
-#include <kparts/browserextension.h>
+
+//We don't use kf5compat.h to avoid linking with libkonq
+//TODO KF6: when removing compatibility with KF5, remove #if
+#include <QtGlobal>
+#if QT_VERSION_MAJOR < 6
+#include <KParts/BrowserExtension>
+namespace KParts {
+  typedef BrowserExtension NavigationExtension;
+}
+#else
+#include <KParts/NavigationExtension>
+#endif
 #include <kio/jobclasses.h>
 
 #include "fsview.h"
@@ -22,13 +33,13 @@ class KActionMenu;
 
 class FSViewPart;
 
-class FSViewBrowserExtension : public KParts::BrowserExtension
+class FSViewNavigationExtension : public KParts::NavigationExtension
 {
     Q_OBJECT
 
 public:
-    explicit FSViewBrowserExtension(FSViewPart *viewPart);
-    ~FSViewBrowserExtension() override;
+    explicit FSViewNavigationExtension(FSViewPart *viewPart);
+    ~FSViewNavigationExtension() override;
 
 public slots:
     void selected(TreeMapItem *);
@@ -68,6 +79,11 @@ public:
 public slots:
     void progressSlot(int percent, int dirs, const QString &lastDir);
 
+#if QT_VERSION_MAJOR < 6
+protected slots:
+    void slotInfoMessage(KJob * job, const QString & plain, const QString & rich=QString()) override;
+#endif
+
 private:
     FSView *_view;
 };
@@ -125,7 +141,7 @@ private:
 
     FSView *_view;
     FSJob *_job;
-    FSViewBrowserExtension *_ext;
+    FSViewNavigationExtension *_ext;
     KActionMenu *_visMenu, *_areaMenu, *_depthMenu, *_colorMenu;
 };
 
diff --git a/plugins/kimgalleryplugin/imgalleryplugin.cpp b/plugins/kimgalleryplugin/imgalleryplugin.cpp
index 7841990964..4f7ca8c38e 100644
--- a/plugins/kimgalleryplugin/imgalleryplugin.cpp
+++ b/plugins/kimgalleryplugin/imgalleryplugin.cpp
@@ -13,7 +13,9 @@
 #include <QDateTime>
 #include <QPixmap>
 #include <QImage>
+#if QT_VERSION_MAJOR < 6
 #include <QTextCodec>
+#endif
 #include <QApplication>
 #include <QDesktopServices>
 #include <QImageReader>
@@ -121,7 +123,14 @@ bool KImGalleryPlugin::createDirectory(const QDir &dir, const QString &imgGaller
 
 void KImGalleryPlugin::createHead(QTextStream &stream)
 {
-    const QString chsetName = QTextCodec::codecForLocale()->name();
+    const QString chsetName =
+//TODO KF6: in Qt6, QTextCodec doesn't exist anymore and its "replacement", QStringConverter, only supports a
+//small number of encodigs. For the time being, use the default (UTF-8).
+#if QT_VERSION_MAJOR < 6
+    QTextCodec::codecForLocale()->name();
+#else
+    QStringLiteral("UTF-8");
+#endif
 
     stream << "<?xml version=\"1.0\" encoding=\"" +  chsetName + "\" ?>" << endl;
     stream << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">" << endl;
@@ -327,7 +336,11 @@ bool KImGalleryPlugin::createHtml(const QUrl &url, const QString &sourceDirName,
 
     if (imageDir.exists() && file.open(QIODevice::WriteOnly)) {
         QTextStream stream(&file);
+//TODO KF6: in Qt6, QTextCodec doesn't exist anymore and its "replacement", QStringConverter, only supports a
+//small number of encodigs. For the time being, use the default (UTF-8).
+#if QT_VERSION_MAJOR < 6
         stream.setCodec(QTextCodec::codecForLocale());
+#endif
 
         createHead(stream);
         createBody(stream, sourceDirName, subDirList, imageDir, url, imageFormat); //ugly
@@ -401,7 +414,12 @@ void KImGalleryPlugin::loadCommentFile()
         qCDebug(IMAGEGALLERY_LOG) << "File opened.";
 
         QTextStream *m_textStream = new QTextStream(&file);
+
+//TODO KF6: in Qt6, QTextCodec doesn't exist anymore and its "replacement", QStringConverter, only supports a
+//small number of encodigs. For the time being, use the default (UTF-8).
+#if QT_VERSION_MAJOR < 6
         m_textStream->setCodec(QTextCodec::codecForLocale());
+#endif
 
         delete m_commentMap;
         m_commentMap = new CommentMap;
diff --git a/plugins/searchbar/searchbar.cpp b/plugins/searchbar/searchbar.cpp
index 329c7d7714..160ee16bf3 100644
--- a/plugins/searchbar/searchbar.cpp
+++ b/plugins/searchbar/searchbar.cpp
@@ -20,7 +20,7 @@
 #include <KIO/CommandLauncherJob>
 #include <KMainWindow>
 #include <KParts/Part>
-#include <KParts/BrowserExtension>
+#include "kf5compat.h" //For NavigationExtension
 #include <KParts/SelectorInterface>
 #include <KParts/PartActivateEvent>
 #include <KLocalizedString>
@@ -210,7 +210,7 @@ void SearchBarPlugin::startSearch(const QString &search)
             return;
         }
 
-        KParts::BrowserExtension *ext = KParts::BrowserExtension::childObject(m_part);
+        KParts::NavigationExtension *ext = KParts::NavigationExtension::childObject(m_part);
         if (QApplication::keyboardModifiers() & Qt::ControlModifier) {
             KParts::OpenUrlArguments arguments;
             KParts::BrowserArguments browserArguments;
diff --git a/plugins/shellcmdplugin/kshellcmdexecutor.cpp b/plugins/shellcmdplugin/kshellcmdexecutor.cpp
index 3cb9bd920c..ccdfd09d82 100644
--- a/plugins/shellcmdplugin/kshellcmdexecutor.cpp
+++ b/plugins/shellcmdplugin/kshellcmdexecutor.cpp
@@ -15,7 +15,7 @@
 #include <QInputDialog>
 #include <QFontDatabase>
 
-#include <kdesu/process.h>
+#include <KDESu/PtyProcess>
 #include <KLocalizedString>
 
 
diff --git a/plugins/uachanger/uachangerplugin.cpp b/plugins/uachanger/uachangerplugin.cpp
index f5ba4e1f64..d6cd5dc7c7 100644
--- a/plugins/uachanger/uachangerplugin.cpp
+++ b/plugins/uachanger/uachangerplugin.cpp
@@ -13,10 +13,10 @@
 #include <QWebEngineProfile>
 #include <QApplication>
 #include <QMetaObject>
+#include <QActionGroup>
 
 #include <kwidgetsaddons_version.h>
 #include <kactionmenu.h>
-#include <kservicetypetrader.h>
 #include <klocalizedstring.h>
 #include <kservice.h>
 #include <kconfiggroup.h>
diff --git a/plugins/webarchiver/thumbnailer/CMakeLists.txt b/plugins/webarchiver/thumbnailer/CMakeLists.txt
index cfe22183df..9bd9f69f38 100644
--- a/plugins/webarchiver/thumbnailer/CMakeLists.txt
+++ b/plugins/webarchiver/thumbnailer/CMakeLists.txt
@@ -5,7 +5,7 @@ if (THUMBNAIL_USE_WEBKIT)
   find_package(Qt${KF_MAJOR_VERSION} REQUIRED WebKit WebKitWidgets)
   add_definitions(-DTHUMBNAIL_USE_WEBKIT)
 else ()
-  find_package(Qt${KF_MAJOR_VERSION} REQUIRED COMPONENTS WebEngine WebEngineWidgets)
+  find_package(Qt${KF_MAJOR_VERSION} REQUIRED COMPONENTS WebEngineCore WebEngineWidgets)
 endif ()
 
 find_package(KF${KF_MAJOR_VERSION} REQUIRED COMPONENTS KIO Archive)
@@ -24,10 +24,9 @@ target_link_libraries(webarchivethumbnail
 if (THUMBNAIL_USE_WEBKIT)
   target_link_libraries(webarchivethumbnail Qt${KF_MAJOR_VERSION}::WebKit Qt${KF_MAJOR_VERSION}::WebKitWidgets)
 else ()
-  target_link_libraries(webarchivethumbnail Qt${KF_MAJOR_VERSION}::WebEngine Qt${KF_MAJOR_VERSION}::WebEngineWidgets)
+  target_link_libraries(webarchivethumbnail Qt${KF_MAJOR_VERSION}::WebEngineCore Qt${KF_MAJOR_VERSION}::WebEngineWidgets)
 endif ()
 
 ########### install files ###############
 
 install(TARGETS webarchivethumbnail  DESTINATION ${KDE_INSTALL_PLUGINDIR} )
-install(FILES webarchivethumbnail.desktop  DESTINATION  ${KDE_INSTALL_KSERVICESDIR} )
diff --git a/plugins/webarchiver/thumbnailer/webarchivecreator.cpp b/plugins/webarchiver/thumbnailer/webarchivecreator.cpp
index de35d57ad8..73d017f3b1 100644
--- a/plugins/webarchiver/thumbnailer/webarchivecreator.cpp
+++ b/plugins/webarchiver/thumbnailer/webarchivecreator.cpp
@@ -38,6 +38,7 @@
 
 #undef SHOW_RENDER_WINDOW
 
+//TODO KF6: remove all instances of THUMBNAIL_USE_WEBKIT
 
 // This is an time limit for the entire thumbnail generation process
 // (page loading and rendering).  If it expires then it is assumed
@@ -62,16 +63,16 @@ static const double c_renderScale = 0.5;
 
 extern "C"
 {
-    Q_DECL_EXPORT ThumbCreator *new_creator()
+    Q_DECL_EXPORT KIO::ThumbnailCreator *new_creator()
     {
-        return (new WebArchiveCreator);
+        return (new WebArchiveCreator{nullptr, {}});
     }
 }
 
-
-WebArchiveCreator::WebArchiveCreator()
-    : ThumbCreator()
+WebArchiveCreator::WebArchiveCreator(QObject *parent, const QVariantList &va)
+    : KIO::ThumbnailCreator(parent, va)
 {
+    qDebug() << "WEBARCHIVECREATOR CREATED";
     m_tempDir = nullptr;
 }
 
@@ -89,9 +90,15 @@ static bool disallowWebEngineCookies(const QWebEngineCookieStore::FilterRequest
 }
 #endif // THUMBNAIL_USE_WEBKIT
 
-
-bool WebArchiveCreator::create(const QString &path, int width, int height, QImage &img)
+KIO::ThumbnailResult WebArchiveCreator::create(const KIO::ThumbnailRequest& request)
 {
+    // QImage img;
+    // bool success = create(request.url().path(), request.targetSize().width(), request.targetSize().height(), img);
+    // return success ? KIO::ThumbnailResult::pass(img) : KIO::ThumbnailResult::fail();
+    QString path = request.url().path();
+    int width = request.targetSize().width();
+    int height = request.targetSize().height();
+
     QMimeDatabase db;
     // Only use the file path to look up its MIME type.  Web archives are
     // gzip-compressed tar files, so if the content detection has to be
@@ -129,7 +136,7 @@ bool WebArchiveCreator::create(const QString &path, int width, int height, QImag
         if (path.isEmpty())
         {
             qCWarning(WEBARCHIVERPLUGIN_LOG) << "Cannot create temporary directory";
-            return (false);
+            return (KIO::ThumbnailResult::fail());
         }
 
         qCDebug(WEBARCHIVERPLUGIN_LOG) << "extracting to tempPath" << tempPath;
@@ -165,7 +172,7 @@ bool WebArchiveCreator::create(const QString &path, int width, int height, QImag
         if (indexHtml.isEmpty())
         {
             qCWarning(WEBARCHIVERPLUGIN_LOG) << "No HTML file found in archive";
-            return (false);
+            return (KIO::ThumbnailResult::fail());
         }
 
         qCDebug(WEBARCHIVERPLUGIN_LOG) << "identified index file" << indexHtml;
@@ -239,7 +246,7 @@ bool WebArchiveCreator::create(const QString &path, int width, int height, QImag
     QTimer::singleShot(c_completionTimeout, this, &WebArchiveCreator::slotProcessingTimeout);
     while (!m_error && !m_rendered) qApp->processEvents(QEventLoop::WaitForMoreEvents);
     qCDebug(WEBARCHIVERPLUGIN_LOG) << "finished loop error?" << m_error;
-    if (m_error) return (false);			// load error or timeout
+    if (m_error) return (KIO::ThumbnailResult::fail());			// load error or timeout
 
     // Render the HTML page on a bigger pixmap and leave the scaling to the
     // caller.  Looks better than directly scaling with the QPainter (malte).
@@ -267,11 +274,9 @@ bool WebArchiveCreator::create(const QString &path, int width, int height, QImag
 #endif // QT_VERSION
 #endif // THUMBNAIL_USE_WEBKIT
 
-    img = pix.toImage();				// return the rendered thumbnail
-    return (true);
+    return KIO::ThumbnailResult::pass(pix.toImage());
 }
 
-
 void WebArchiveCreator::slotLoadFinished(bool ok)
 {
     qCDebug(WEBARCHIVERPLUGIN_LOG) << "ok?" << ok;
diff --git a/plugins/webarchiver/thumbnailer/webarchivecreator.h b/plugins/webarchiver/thumbnailer/webarchivecreator.h
index 368b446c41..251175f061 100644
--- a/plugins/webarchiver/thumbnailer/webarchivecreator.h
+++ b/plugins/webarchiver/thumbnailer/webarchivecreator.h
@@ -13,21 +13,21 @@
 #include <QNetworkCookieJar>
 #endif // THUMBNAIL_USE_WEBKIT
 
-#include <kio/thumbcreator.h>
+#include <KIO/ThumbnailCreator>
 
 
 class QTemporaryDir;
 
 
-class WebArchiveCreator : public QObject, public ThumbCreator
+class WebArchiveCreator : public KIO::ThumbnailCreator
 {
     Q_OBJECT
 
 public:
-    WebArchiveCreator();
+    WebArchiveCreator(QObject *parent, const QVariantList &va);
     ~WebArchiveCreator() override;
 
-    bool create(const QString &path, int width, int height, QImage &img) override;
+    KIO::ThumbnailResult create(const KIO::ThumbnailRequest & request) override;
 
 private slots:
     void slotLoadFinished(bool ok);
diff --git a/settings/bookmarks/bookmarks.cpp b/settings/bookmarks/bookmarks.cpp
index 22b47150e9..83caede782 100644
--- a/settings/bookmarks/bookmarks.cpp
+++ b/settings/bookmarks/bookmarks.cpp
@@ -20,10 +20,10 @@
 
 K_PLUGIN_CLASS_WITH_JSON(BookmarksConfigModule, "kcm_bookmarks.json")
 
-BookmarksConfigModule::BookmarksConfigModule(QWidget *parent, const QVariantList &)
-    : KCModule(parent)
+BookmarksConfigModule::BookmarksConfigModule(QObject *parent, const KPluginMetaData &md, const QVariantList &)
+    : KCModule(parent, md)
 {
-    ui.setupUi(this);
+    ui.setupUi(widget());
 }
 
 BookmarksConfigModule::~BookmarksConfigModule()
@@ -58,7 +58,7 @@ void BookmarksConfigModule::load()
     connect(ui.clearCacheButton, &QAbstractButton::clicked, this, &BookmarksConfigModule::clearCache);
 
     delete c;
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void BookmarksConfigModule::save()
@@ -74,7 +74,7 @@ void BookmarksConfigModule::save()
 
     c->sync();
     delete c;
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void BookmarksConfigModule::defaults()
@@ -87,15 +87,9 @@ void BookmarksConfigModule::defaults()
     ui.sbCacheSize->setValue(5 * 1024);
 }
 
-QString BookmarksConfigModule::quickHelp() const
-{
-    return i18n("<h1>My Bookmarks</h1><p>This module lets you configure the bookmarks home page.</p>"
-                "<p>The bookmarks home page is accessible at <a href=\"bookmarks:/\">bookmarks:/</a>.</p>");
-}
-
 void BookmarksConfigModule::configChanged()
 {
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 #include "bookmarks.moc"
diff --git a/settings/bookmarks/bookmarks.h b/settings/bookmarks/bookmarks.h
index 932eaab148..2b2c6a25eb 100644
--- a/settings/bookmarks/bookmarks.h
+++ b/settings/bookmarks/bookmarks.h
@@ -18,13 +18,17 @@ class BookmarksConfigModule : public KCModule
     Q_OBJECT
 
 public:
-    BookmarksConfigModule(QWidget *parent, const QVariantList &args);
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
+    BookmarksConfigModule(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
     ~BookmarksConfigModule() override;
 
     void load() override;
     void save() override;
     void defaults() override;
-    QString quickHelp() const override;
+
+#if QT_VERSION_MAJOR < 6
+    void setNeedsSave(bool needs) {emit changed(needs);}
+#endif
 
 private Q_SLOTS:
     void clearCache();
diff --git a/settings/konq/behaviour.cpp b/settings/konq/behaviour.cpp
index 9c675a2983..34c1afa363 100644
--- a/settings/konq/behaviour.cpp
+++ b/settings/konq/behaviour.cpp
@@ -28,25 +28,23 @@
 
 K_PLUGIN_CLASS_WITH_JSON(KBehaviourOptions, "filebehavior.json")
 
-KBehaviourOptions::KBehaviourOptions(QWidget *parent, const QVariantList &)
-    : KCModule(parent)
+KBehaviourOptions::KBehaviourOptions(QObject *parent, const KPluginMetaData &md, const QVariantList &)
+    : KCModule(parent, md)
     , g_pConfig(KSharedConfig::openConfig(QStringLiteral("konquerorrc"), KConfig::IncludeGlobals))
     , groupname(QStringLiteral("FMSettings"))
 {
-    setQuickHelp(i18n("<h1>Konqueror Behavior</h1> You can configure how Konqueror behaves as a file manager here."));
+    QVBoxLayout *mainLayout = new QVBoxLayout(widget());
 
-    QVBoxLayout *mainLayout = new QVBoxLayout(this);
-
-    QGroupBox *miscGb = new QGroupBox(i18n("Misc Options"), this);
+    QGroupBox *miscGb = new QGroupBox(i18n("Misc Options"), widget());
     QHBoxLayout *miscHLayout = new QHBoxLayout;
     QVBoxLayout *miscLayout = new QVBoxLayout;
 
-    winPixmap = new QLabel(this);
+    winPixmap = new QLabel(widget());
     winPixmap->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
     winPixmap->setPixmap(QPixmap(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kcontrol/pics/onlyone.png"))));
     winPixmap->setFixedSize(winPixmap->sizeHint());
 
-    cbNewWin = new QCheckBox(i18n("Open folders in separate &windows"), this);
+    cbNewWin = new QCheckBox(i18n("Open folders in separate &windows"), widget());
     cbNewWin->setToolTip(i18n("If this option is checked, Konqueror will open a new window when "
                                 "you open a folder, rather than showing that folder's contents in the current window."));
     connect(cbNewWin, &QAbstractButton::toggled, this, &KBehaviourOptions::markAsChanged);
@@ -55,7 +53,7 @@ KBehaviourOptions::KBehaviourOptions(QWidget *parent, const QVariantList &)
     miscLayout->addWidget(cbNewWin);
 
     QHBoxLayout *previewLayout = new QHBoxLayout;
-    QWidget *spacer = new QWidget(this);
+    QWidget *spacer = new QWidget(widget());
     spacer->setMinimumSize(20, 0);
     spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
 
@@ -70,7 +68,7 @@ KBehaviourOptions::KBehaviourOptions(QWidget *parent, const QVariantList &)
 
     mainLayout->addWidget(miscGb);
 
-    cbShowDeleteCommand = new QCheckBox(i18n("Show 'Delete' me&nu entries which bypass the trashcan"), this);
+    cbShowDeleteCommand = new QCheckBox(i18n("Show 'Delete' me&nu entries which bypass the trashcan"), widget());
     mainLayout->addWidget(cbShowDeleteCommand);
     connect(cbShowDeleteCommand, &QAbstractButton::toggled, this, &KBehaviourOptions::markAsChanged);
 
diff --git a/settings/konq/behaviour.h b/settings/konq/behaviour.h
index d1fd70946d..4001b2678f 100644
--- a/settings/konq/behaviour.h
+++ b/settings/konq/behaviour.h
@@ -19,7 +19,7 @@ class KBehaviourOptions : public KCModule
 {
     Q_OBJECT
 public:
-    explicit KBehaviourOptions(QWidget *parent, const QVariantList &args = QVariantList());
+    explicit KBehaviourOptions(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
     ~KBehaviourOptions() override;
     void load() override;
     void save() override;
diff --git a/settings/konqhtml/CMakeLists.txt b/settings/konqhtml/CMakeLists.txt
index 6739c5b1ab..3aa42c22d3 100644
--- a/settings/konqhtml/CMakeLists.txt
+++ b/settings/konqhtml/CMakeLists.txt
@@ -49,9 +49,11 @@ add_library(kcm_konqhtml_static STATIC ${kcm_konqhtml_PART_SRCS})
 target_link_libraries(kcm_konqhtml_static
     KF${KF_MAJOR_VERSION}::I18n
     KF${KF_MAJOR_VERSION}::ConfigWidgets
+    KF${KF_MAJOR_VERSION}::KCMUtils
     KF${KF_MAJOR_VERSION}::TextWidgets
     KF${KF_MAJOR_VERSION}::Parts
     KF${KF_MAJOR_VERSION}::ItemViews
+    KF${KF_MAJOR_VERSION}::Codecs
     Qt${KF_MAJOR_VERSION}::WebEngineWidgets
     KF${KF_MAJOR_VERSION}::Konq)
 
diff --git a/settings/konqhtml/appearance.cpp b/settings/konqhtml/appearance.cpp
index 3a3d7d11af..dea7a5c120 100644
--- a/settings/konqhtml/appearance.cpp
+++ b/settings/konqhtml/appearance.cpp
@@ -25,22 +25,26 @@ enum SmoothScrollingType { SmoothScrollingAlways = 0, SmoothScrollingNever = 1,
 
 enum UnderlineLinkType { UnderlineAlways = 0, UnderlineNever = 1, UnderlineHover = 2 };
 
-KAppearanceOptions::KAppearanceOptions(QWidget *parent, const QVariantList &)
-    : KCModule(parent), m_groupname(QStringLiteral("HTML Settings")),
+KAppearanceOptions::KAppearanceOptions(QObject *parent, const KPluginMetaData &md, const QVariantList &)
+    : KCModule(parent, md), m_groupname(QStringLiteral("HTML Settings")),
       fSize(10), fMinSize(HTML_DEFAULT_MIN_FONT_SIZE)
 
 {
-    QVBoxLayout *l = new QVBoxLayout(this);
-    QTabWidget *tabWidget = new QTabWidget(this);
+    QVBoxLayout *l = new QVBoxLayout(widget());
+    QTabWidget *tabWidget = new QTabWidget(widget());
     l->addWidget(tabWidget);
-    QWidget *mainTab = new QWidget(this);
-    QWidget *fontsTab = new QWidget(this);
-    cssConfig = new CSSConfig(this);
+    QWidget *mainTab = new QWidget(widget());
+    QWidget *fontsTab = new QWidget(widget());
+    cssConfig = new CSSConfig(widget());
     tabWidget->addTab(mainTab, i18nc("@title:tab", "General"));
     tabWidget->addTab(fontsTab, i18nc("@title:tab", "Fonts"));
     tabWidget->addTab(cssConfig, i18nc("@title:tab", "Stylesheets"));
 
+#if QT_VERSION_MAJOR < 6
     connect(cssConfig, &CSSConfig::changed, this, &KAppearanceOptions::markAsChanged);
+#else
+    connect(cssConfig, &CSSConfig::changed, this, [this](){setNeedsSave(true);});
+#endif
 
     l = new QVBoxLayout(mainTab);
 
@@ -49,7 +53,7 @@ KAppearanceOptions::KAppearanceOptions(QWidget *parent, const QVariantList &)
     l->addWidget(box);
     QFormLayout *fl = new QFormLayout(box);
 
-    m_pAutoLoadImagesCheckBox = new QCheckBox(i18n("A&utomatically load images"), this);
+    m_pAutoLoadImagesCheckBox = new QCheckBox(i18n("A&utomatically load images"), widget());
     m_pAutoLoadImagesCheckBox->setToolTip(i18n("<html>If this box is checked, Konqueror will"
                                                " automatically load any images that are embedded in a web page."
                                                " Otherwise, it will display placeholders for the images, and"
@@ -60,7 +64,7 @@ KAppearanceOptions::KAppearanceOptions(QWidget *parent, const QVariantList &)
     connect(m_pAutoLoadImagesCheckBox, &QAbstractButton::toggled, this, &KAppearanceOptions::markAsChanged);
     fl->addRow(m_pAutoLoadImagesCheckBox);
 
-    m_pUnfinishedImageFrameCheckBox = new QCheckBox(i18n("Dra&w frame around not completely loaded images"), this);
+    m_pUnfinishedImageFrameCheckBox = new QCheckBox(i18n("Dra&w frame around not completely loaded images"), widget());
     m_pUnfinishedImageFrameCheckBox->setToolTip(i18n("<html>If this box is checked, Konqueror will draw"
                                                      " a frame as a placeholder around images embedded in a web page that are"
                                                      " not yet fully loaded.<br />You will probably want to check this box to"
@@ -69,7 +73,7 @@ KAppearanceOptions::KAppearanceOptions(QWidget *parent, const QVariantList &)
     connect(m_pUnfinishedImageFrameCheckBox, &QAbstractButton::toggled, this, &KAppearanceOptions::markAsChanged);
     fl->addRow(m_pUnfinishedImageFrameCheckBox);
 
-    m_pAnimationsCombo = new QComboBox(this);
+    m_pAnimationsCombo = new QComboBox(widget());
     m_pAnimationsCombo->setEditable(false);
     m_pAnimationsCombo->insertItem(AnimationsAlways, i18nc("animations", "Enabled"));
     m_pAnimationsCombo->insertItem(AnimationsNever, i18nc("animations", "Disabled"));
@@ -85,7 +89,7 @@ KAppearanceOptions::KAppearanceOptions(QWidget *parent, const QVariantList &)
     box = new QGroupBox(i18nc("@title:group", "Miscellaneous"), mainTab);
     l->addWidget(box);
     fl = new QFormLayout(box);
-    m_pUnderlineCombo = new QComboBox(this);
+    m_pUnderlineCombo = new QComboBox(widget());
     m_pUnderlineCombo->setEditable(false);
     m_pUnderlineCombo->insertItem(UnderlineAlways, i18nc("underline", "Enabled"));
     m_pUnderlineCombo->insertItem(UnderlineNever, i18nc("underline", "Disabled"));
@@ -100,7 +104,7 @@ KAppearanceOptions::KAppearanceOptions(QWidget *parent, const QVariantList &)
                                       "</ul><br /><i>Note: The site's CSS definitions can override this value.</i></html>"));
     connect(m_pUnderlineCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &KAppearanceOptions::markAsChanged);
 
-    m_pSmoothScrollingCombo = new QComboBox(this);
+    m_pSmoothScrollingCombo = new QComboBox(widget());
     m_pSmoothScrollingCombo->setEditable(false);
     m_pSmoothScrollingCombo->insertItem(SmoothScrollingWhenEfficient, i18n("When Efficient"));
     m_pSmoothScrollingCombo->insertItem(SmoothScrollingAlways, i18nc("smooth scrolling", "Always"));
@@ -116,9 +120,6 @@ KAppearanceOptions::KAppearanceOptions(QWidget *parent, const QVariantList &)
     l->addStretch(5);
 
     m_pConfig = KSharedConfig::openConfig(QStringLiteral("konquerorrc"), KConfig::NoGlobals);
-    setQuickHelp(i18n("<h1>Konqueror Fonts</h1>On this page, you can configure "
-                      "which fonts Konqueror should use to display the web "
-                      "pages you view.") + "<br /><br />" + cssConfig->whatsThis());
 
     QString empty;
     //initialise fonts list otherwise it crashs
@@ -166,22 +167,22 @@ KAppearanceOptions::KAppearanceOptions(QWidget *parent, const QVariantList &)
     m_pFonts[1]->setToolTip(i18n("This is the font used to display fixed-width (i.e. non-proportional) text."));
     connect(m_pFonts[1], &QFontComboBox::currentFontChanged, this, &KAppearanceOptions::slotFixedFont);
 
-    m_pFonts[2] = new QFontComboBox(this);
+    m_pFonts[2] = new QFontComboBox(widget());
     fl->addRow(i18n("S&erif font:"),  m_pFonts[2]);
     m_pFonts[2]->setToolTip(i18n("This is the font used to display text that is marked up as serif."));
     connect(m_pFonts[2], &QFontComboBox::currentFontChanged, this, &KAppearanceOptions::slotSerifFont);
 
-    m_pFonts[3] = new QFontComboBox(this);
+    m_pFonts[3] = new QFontComboBox(widget());
     fl->addRow(i18n("Sa&ns serif font:"),  m_pFonts[3]);
     m_pFonts[3]->setToolTip(i18n("This is the font used to display text that is marked up as sans-serif."));
     connect(m_pFonts[3], &QFontComboBox::currentFontChanged, this, &KAppearanceOptions::slotSansSerifFont);
 
-    m_pFonts[4] = new QFontComboBox(this);
+    m_pFonts[4] = new QFontComboBox(widget());
     fl->addRow(i18n("C&ursive font:"),  m_pFonts[4]);
     m_pFonts[4]->setToolTip(i18n("This is the font used to display text that is marked up as italic."));
     connect(m_pFonts[4], &QFontComboBox::currentFontChanged, this, &KAppearanceOptions::slotCursiveFont);
 
-    m_pFonts[5] = new QFontComboBox(this);
+    m_pFonts[5] = new QFontComboBox(widget());
     fl->addRow(i18n("Fantas&y font:"), m_pFonts[5]);
     m_pFonts[5]->setToolTip(i18n("This is the font used to display text that is marked up as a fantasy font."));
     connect(m_pFonts[5], &QFontComboBox::currentFontChanged, this, &KAppearanceOptions::slotFantasyFont);
@@ -189,7 +190,7 @@ KAppearanceOptions::KAppearanceOptions(QWidget *parent, const QVariantList &)
     for (int i = 0; i < 6; ++i)
         connect(m_pFonts[i], &QFontComboBox::currentFontChanged, this, &KAppearanceOptions::markAsChanged);
 
-    m_pFontSizeAdjust = new QSpinBox(this);
+    m_pFontSizeAdjust = new QSpinBox(widget());
     m_pFontSizeAdjust->setRange(-5, 5);
     m_pFontSizeAdjust->setSingleStep(1);
     fl->addRow(i18n("Font &size adjustment for this encoding:"), m_pFontSizeAdjust);
@@ -197,7 +198,7 @@ KAppearanceOptions::KAppearanceOptions(QWidget *parent, const QVariantList &)
     connect(m_pFontSizeAdjust, QOverload<int>::of(&QSpinBox::valueChanged), this, &KAppearanceOptions::slotFontSizeAdjust);
     connect(m_pFontSizeAdjust, QOverload<int>::of(&QSpinBox::valueChanged), this, &KAppearanceOptions::markAsChanged);
 
-    m_pEncoding = new QComboBox(this);
+    m_pEncoding = new QComboBox(widget());
     m_pEncoding->setEditable(false);
     encodings = KCharsets::charsets()->availableEncodingNames();
     encodings.prepend(i18n("Use Language Encoding"));
@@ -346,7 +347,7 @@ void KAppearanceOptions::load()
     cssConfig->load();
 
     updateGUI();
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void KAppearanceOptions::defaults()
@@ -357,7 +358,7 @@ void KAppearanceOptions::defaults()
     m_pConfig->setReadDefaults(old);
 
     cssConfig->defaults();
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 void KAppearanceOptions::updateGUI()
@@ -419,6 +420,6 @@ void KAppearanceOptions::save()
         QDBusMessage::createSignal(QStringLiteral("/KonqMain"), QStringLiteral("org.kde.Konqueror.Main"), QStringLiteral("reparseConfiguration"));
     QDBusConnection::sessionBus().send(message);
 
-    emit changed(false);
+    setNeedsSave(false);
 }
 
diff --git a/settings/konqhtml/appearance.h b/settings/konqhtml/appearance.h
index dbb571a5fc..9fc1323c4e 100644
--- a/settings/konqhtml/appearance.h
+++ b/settings/konqhtml/appearance.h
@@ -33,13 +33,18 @@ class KAppearanceOptions : public KCModule
 {
     Q_OBJECT
 public:
-    KAppearanceOptions(QWidget *parent, const QVariantList &);
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
+    KAppearanceOptions(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
     ~KAppearanceOptions() override;
 
     void load() override;
     void save() override;
     void defaults() override;
 
+#if QT_VERSION_MAJOR < 6
+    void setNeedsSave(bool needs) {emit changed(needs);}
+#endif
+
 public Q_SLOTS:
     void slotFontSize(int);
     void slotMinimumFontSize(int);
diff --git a/settings/konqhtml/cache/cache.cpp b/settings/konqhtml/cache/cache.cpp
index db36c13f13..1f92f01d73 100644
--- a/settings/konqhtml/cache/cache.cpp
+++ b/settings/konqhtml/cache/cache.cpp
@@ -16,11 +16,11 @@
 
 int constexpr conversionFactor = 1000000;
 
-Cache::Cache(QWidget* parent, const QVariantList& ): KCModule(parent),
+Cache::Cache(QObject *parent, const KPluginMetaData &md, const QVariantList &): KCModule(parent, md),
     m_ui(new Ui::Cache),
     m_config(KSharedConfig::openConfig(QString(), KConfig::NoGlobals))
 {
-    m_ui->setupUi(this);
+    m_ui->setupUi(widget());
     connect(m_ui->memoryCache, &QCheckBox::toggled, this, &Cache::toggleMemoryCache);
     connect(m_ui->cacheSize, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int){markAsChanged();});
     auto changedBoolArg = [this](bool){markAsChanged();};
@@ -41,7 +41,7 @@ void Cache::defaults()
     m_ui->cacheSize->setValue(0);
     m_ui->useCustomCacheDir->setChecked(false);
     m_ui->customCacheDir->setUrl(QUrl());
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 void Cache::load()
@@ -56,7 +56,7 @@ void Cache::load()
     QString path = grp.readEntry("CustomCacheDir", QString());
     m_ui->useCustomCacheDir->setChecked(!path.isEmpty());
     m_ui->customCacheDir->setUrl(QUrl::fromLocalFile(path));
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void Cache::save()
@@ -74,7 +74,7 @@ void Cache::save()
     QDBusMessage message =
         QDBusMessage::createSignal(QStringLiteral("/KonqMain"), QStringLiteral("org.kde.Konqueror.Main"), QStringLiteral("reparseConfiguration"));
     QDBusConnection::sessionBus().send(message);
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void Cache::toggleMemoryCache(bool on)
diff --git a/settings/konqhtml/cache/cache.h b/settings/konqhtml/cache/cache.h
index 1274f146c8..047ecc8b5a 100644
--- a/settings/konqhtml/cache/cache.h
+++ b/settings/konqhtml/cache/cache.h
@@ -28,12 +28,15 @@ class Cache: public KCModule
     Q_OBJECT
 
 public:
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
     /**
      * @brief Constructor
      *
      * @param parent the parent widget
+     * @param md as in `KCModule` constructor
+     * @param args as in `KCModule` constructor
      */
-    Cache(QWidget* parent, const QVariantList&);
+    Cache(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
 
     /**
      * @brief Destructor
@@ -56,6 +59,10 @@ public:
      */
     void save() override;
 
+#if QT_VERSION_MAJOR < 6
+    void setNeedsSave(bool needs) {emit changed(needs);}
+#endif
+
 private slots:
 
     /**
diff --git a/settings/konqhtml/cookies/kcookiesmain.cpp b/settings/konqhtml/cookies/kcookiesmain.cpp
index 71c1790433..eb466dcb04 100644
--- a/settings/konqhtml/cookies/kcookiesmain.cpp
+++ b/settings/konqhtml/cookies/kcookiesmain.cpp
@@ -22,22 +22,30 @@
 #include <KLocalizedString>
 #include <KPluginFactory>
 
-KCookiesMain::KCookiesMain(QWidget *parent, const QVariantList &args)
-    : KCModule(parent, args)
+KCookiesMain::KCookiesMain(QObject *parent, const KPluginMetaData &md, const QVariantList &)
+    : KCModule(parent, md)
 {
     management = nullptr;
 
-    QVBoxLayout *layout = new QVBoxLayout(this);
-    tab = new QTabWidget(this);
+    QVBoxLayout *layout = new QVBoxLayout(widget());
+    tab = new QTabWidget(widget());
     layout->addWidget(tab);
 
-    policies = new KCookiesPolicies(this, args);
-    tab->addTab(policies, i18n("&Policy"));
+    policies = new KCookiesPolicies(widget(), md);
+    tab->addTab(policies->widget(), i18n("&Policy"));
+#if QT_VERSION_MAJOR < 6
     connect(policies, QOverload<bool>::of(&KCModule::changed), this, QOverload<bool>::of(&KCModule::changed));
+#else
+    connect(policies, &KCModule::needsSaveChanged, this, &KCModule::needsSaveChanged);
+#endif
 
-    management = new KCookiesManagement(this, args);
-    tab->addTab(management, i18n("&Management"));
+    management = new KCookiesManagement(widget(), md);
+    tab->addTab(management->widget(), i18n("&Management"));
+#if QT_VERSION_MAJOR < 6
     connect(management, QOverload<bool>::of(&KCModule::changed), this, QOverload<bool>::of(&KCModule::changed));
+#else
+    connect(management, &KCModule::needsSaveChanged, this, &KCModule::needsSaveChanged);
+#endif
 }
 
 KCookiesMain::~KCookiesMain()
@@ -62,30 +70,9 @@ void KCookiesMain::load()
 
 void KCookiesMain::defaults()
 {
-    KCModule *module = static_cast<KCModule *>(tab->currentWidget());
-
-    if (module == policies) {
+    if (tab->currentWidget() == policies->widget()) {
         policies->defaults();
     } else if (management) {
         management->defaults();
     }
 }
-
-QString KCookiesMain::quickHelp() const
-{
-    return i18n(
-        "<h1>Cookies</h1><p>Cookies contain information that KDE applications"
-        " using the HTTP protocol (like Konqueror) store on your"
-        " computer, initiated by a remote Internet server. This means that"
-        " a web server can store information about you and your browsing activities"
-        " on your machine for later use. You might consider this an invasion of"
-        " privacy.</p><p> However, cookies are useful in certain situations. For example, they"
-        " are often used by Internet shops, so you can 'put things into a shopping basket'."
-        " Some sites require you have a browser that supports cookies.</p><p>"
-        " Because most people want a compromise between privacy and the benefits cookies offer,"
-        " the HTTP KIO worker offers you the ability to customize the way it handles cookies. So you might want"
-        " to set the default policy to ask you whenever a server wants to set a cookie,"
-        " allowing you to decide. For your favorite shopping web sites that you trust, you might"
-        " want to set the policy to accept, then you can access the web sites without being prompted"
-        " every time a cookie is received.</p>");
-}
diff --git a/settings/konqhtml/cookies/kcookiesmain.h b/settings/konqhtml/cookies/kcookiesmain.h
index 2e031f4c9d..b50de9156f 100644
--- a/settings/konqhtml/cookies/kcookiesmain.h
+++ b/settings/konqhtml/cookies/kcookiesmain.h
@@ -20,7 +20,8 @@ class KCookiesMain : public KCModule
 {
     Q_OBJECT
 public:
-    KCookiesMain(QWidget *parent, const QVariantList &args);
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
+    KCookiesMain(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
     ~KCookiesMain() override;
 
     KCookiesPolicies *policyDlg()
@@ -31,7 +32,6 @@ public:
     void save() override;
     void load() override;
     void defaults() override;
-    QString quickHelp() const override;
 
 private:
     QTabWidget *tab;
diff --git a/settings/konqhtml/cookies/kcookiesmanagement.cpp b/settings/konqhtml/cookies/kcookiesmanagement.cpp
index 2d9b3c027f..b7227007b6 100644
--- a/settings/konqhtml/cookies/kcookiesmanagement.cpp
+++ b/settings/konqhtml/cookies/kcookiesmanagement.cpp
@@ -100,12 +100,12 @@ CookieProp *CookieListViewItem::leaveCookie()
     return ret;
 }
 
-KCookiesManagement::KCookiesManagement(QWidget *parent, const QVariantList &args)
-    : KCModule(parent, args)
+KCookiesManagement::KCookiesManagement(QObject *parent, const KPluginMetaData &md, const QVariantList &)
+    : KCModule(parent, md)
     , mDeleteAllFlag(false)
-    , mMainWidget(parent)
+    , mMainWidget(qobject_cast<QWidget*>(parent))
 {
-    mUi.setupUi(this);
+    mUi.setupUi(widget());
     mUi.searchLineEdit->setTreeWidget(mUi.cookiesTreeWidget);
     mUi.cookiesTreeWidget->setColumnWidth(0, 150);
 
@@ -159,7 +159,7 @@ void KCookiesManagement::save()
         }
     }
     mDeletedCookies.clear();
-    Q_EMIT changed(false);
+    setNeedsSave(false);
 }
 
 void KCookiesManagement::defaults()
@@ -194,11 +194,6 @@ void KCookiesManagement::clearCookieDetails()
     mUi.secureLineEdit->clear();
 }
 
-QString KCookiesManagement::quickHelp() const
-{
-    return i18n("<h1>Cookie Management Quick Help</h1>");
-}
-
 QSet<QNetworkCookie> KCookiesManagement::getCookies()
 {
     Browser *browser = Browser::browser(qApp);
@@ -232,7 +227,7 @@ void KCookiesManagement::reload()
     // are there any cookies?
     mUi.deleteAllButton->setEnabled(mUi.cookiesTreeWidget->topLevelItemCount() > 0);
     mUi.cookiesTreeWidget->sortItems(0, Qt::AscendingOrder);
-    Q_EMIT changed(false);
+    setNeedsSave(false);
 }
 
 Q_DECLARE_METATYPE(QList<int>)
@@ -361,12 +356,12 @@ void KCookiesManagement::deleteCurrent()
 
     mUi.deleteAllButton->setEnabled(mUi.cookiesTreeWidget->topLevelItemCount() > 0);
 
-    Q_EMIT changed(true);
+    setNeedsSave(true);
 }
 
 void KCookiesManagement::deleteAll()
 {
     mDeleteAllFlag = true;
     reset(true);
-    Q_EMIT changed(true);
+    setNeedsSave(true);
 }
diff --git a/settings/konqhtml/cookies/kcookiesmanagement.h b/settings/konqhtml/cookies/kcookiesmanagement.h
index ab2e22a1f8..af3f18e7bd 100644
--- a/settings/konqhtml/cookies/kcookiesmanagement.h
+++ b/settings/konqhtml/cookies/kcookiesmanagement.h
@@ -58,13 +58,17 @@ class KCookiesManagement : public KCModule
     Q_OBJECT
 
 public:
-    explicit KCookiesManagement(QWidget *parent, const QVariantList &args);
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
+    explicit KCookiesManagement(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
     ~KCookiesManagement() override;
 
     void load() override;
     void save() override;
     void defaults() override;
-    QString quickHelp() const override;
+
+#if QT_VERSION_MAJOR < 6
+    void setNeedsSave(bool needs) {emit changed(needs);}
+#endif
 
 private Q_SLOTS:
     void deleteCurrent();
diff --git a/settings/konqhtml/cookies/kcookiespolicies.cpp b/settings/konqhtml/cookies/kcookiespolicies.cpp
index 3a637a83ef..4ebde2e135 100644
--- a/settings/konqhtml/cookies/kcookiespolicies.cpp
+++ b/settings/konqhtml/cookies/kcookiespolicies.cpp
@@ -64,11 +64,11 @@ static QByteArray tolerantToAce(const QString &_domain)
     return ret;
 }
 
-KCookiesPolicies::KCookiesPolicies(QWidget *parent, const QVariantList &args)
-    : KCModule(parent, args)
+KCookiesPolicies::KCookiesPolicies(QObject *parent, const KPluginMetaData &md, const QVariantList &)
+    : KCModule(parent, md)
     , mSelectedItemsCount(0)
 {
-    mUi.setupUi(this);
+    mUi.setupUi(widget());
     mUi.kListViewSearchLine->setTreeWidget(mUi.policyTreeWidget);
     QList<int> columns;
     columns.append(0);
@@ -109,7 +109,7 @@ KCookiesPolicies::~KCookiesPolicies()
 void KCookiesPolicies::configChanged()
 {
     // kDebug() << "KCookiesPolicies::configChanged...";
-    Q_EMIT changed(true);
+    setNeedsSave(true);
 }
 
 void KCookiesPolicies::cookiesEnabled(bool enable)
@@ -153,7 +153,7 @@ void KCookiesPolicies::changePressed(QTreeWidgetItem *item, bool state)
     Q_ASSERT(item);
     const QString oldDomain(item->text(0));
 
-    KCookiesPolicySelectionDlg pdlg(this);
+    KCookiesPolicySelectionDlg pdlg(widget());
     pdlg.setWindowTitle(i18nc("@title:window", "Change Cookie Policy"));
     pdlg.setPolicy(mDomainPolicyMap.value(oldDomain));
     pdlg.setEnableHostEdit(state, oldDomain);
@@ -172,7 +172,7 @@ void KCookiesPolicies::changePressed(QTreeWidgetItem *item, bool state)
 
 void KCookiesPolicies::addPressed(const QString &domain, bool state)
 {
-    KCookiesPolicySelectionDlg pdlg(this);
+    KCookiesPolicySelectionDlg pdlg(widget());
     pdlg.setWindowTitle(i18nc("@title:window", "New Cookie Policy"));
     pdlg.setEnableHostEdit(state, domain);
 
@@ -205,7 +205,7 @@ bool KCookiesPolicies::handleDuplicate(const QString &domain, CookieJar::CookieA
     QTreeWidgetItem *item = mUi.policyTreeWidget->topLevelItem(0);
     while (item != nullptr) {
         if (item->text(0) == domain) {
-            const int res = KMessageBox::warningContinueCancel(this,
+            const int res = KMessageBox::warningContinueCancel(widget(),
                                                                i18n("<qt>A policy already exists for"
                                                                     "<center><b>%1</b></center>"
                                                                     "Do you want to replace it?</qt>",
@@ -372,7 +372,7 @@ void KCookiesPolicies::save()
     QDBusMessage message =
         QDBusMessage::createSignal(QStringLiteral("/KonqMain"), QStringLiteral("org.kde.Konqueror.Main"), QStringLiteral("reparseConfiguration"));
     QDBusConnection::sessionBus().send(message);
-    Q_EMIT changed(false);
+    setNeedsSave(false);
 }
 
 void KCookiesPolicies::defaults()
@@ -403,30 +403,3 @@ void KCookiesPolicies::splitDomainAdvice(const QString &cfg, QString &domain, Co
     domain = cfg.left(sepPos);
     advice = KCookieAdvice::strToAdvice(cfg.mid(sepPos + 1));
 }
-
-QString KCookiesPolicies::quickHelp() const
-{
-    return i18n(
-        "<h1>Cookies</h1><p>Cookies contain information that KDE"
-        " application using the HTTP protocol (like Konqueror) stores"
-        " on your computer from a remote Internet server. This means"
-        " that a web server can store information about you and your"
-        " browsing activities on your machine for later use. You might"
-        " consider this an invasion of privacy.</p><p>However, cookies are"
-        " useful in certain situations. For example, they are often used"
-        " by Internet shops, so you can 'put things into a shopping"
-        " basket'. Some sites require you have a browser that supports"
-        " cookies.</p><p>Because most people want a compromise between privacy"
-        " and the benefits cookies offer, KDE offers you the ability to"
-        " customize the way it handles cookies. You might, for example"
-        " want to set KDE's default policy to ask you whenever a server"
-        " wants to set a cookie or simply reject or accept everything."
-        " For example, you might choose to accept all cookies from your"
-        " favorite shopping web site. For this all you have to do is"
-        " either browse to that particular site and when you are presented"
-        " with the cookie dialog box, click on <i> This domain </i> under"
-        " the 'apply to' tab and choose accept or simply specify the name"
-        " of the site in the <i> Domain Specific Policy </i> tab and set"
-        " it to accept. This enables you to receive cookies from trusted"
-        " web sites without being asked every time KDE receives a cookie.</p>");
-}
diff --git a/settings/konqhtml/cookies/kcookiespolicies.h b/settings/konqhtml/cookies/kcookiespolicies.h
index dcb5c7650b..bbec73c4ed 100644
--- a/settings/konqhtml/cookies/kcookiespolicies.h
+++ b/settings/konqhtml/cookies/kcookiespolicies.h
@@ -27,16 +27,20 @@ class KCookiesPolicies : public KCModule
     Q_OBJECT
 
 public:
-    explicit KCookiesPolicies(QWidget *parent, const QVariantList &args);
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
+    explicit KCookiesPolicies(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
     ~KCookiesPolicies() override;
 
     void load() override;
     void save() override;
     void defaults() override;
-    QString quickHelp() const override;
 
     void setPolicy(const QString &domain);
 
+#if QT_VERSION_MAJOR < 6
+    void setNeedsSave(bool needs) {emit changed(needs);}
+#endif
+
 protected Q_SLOTS:
     void cookiesEnabled(bool);
     void configChanged();
diff --git a/settings/konqhtml/domainlistview.h b/settings/konqhtml/domainlistview.h
index 5432921f04..cc65c2ac8a 100644
--- a/settings/konqhtml/domainlistview.h
+++ b/settings/konqhtml/domainlistview.h
@@ -17,7 +17,6 @@
 
 class QTreeWidgetItem;
 class QPushButton;
-class QStringList;
 
 class QTreeWidget;
 
diff --git a/settings/konqhtml/filteropts.cpp b/settings/konqhtml/filteropts.cpp
index 4ac0e58b25..5e1d959860 100644
--- a/settings/konqhtml/filteropts.cpp
+++ b/settings/konqhtml/filteropts.cpp
@@ -34,8 +34,8 @@
 #include <KConfigGroup>
 #include <KSharedConfig>
 
-KCMFilter::KCMFilter(QWidget *parent, const QVariantList &)
-    : KCModule(parent),
+KCMFilter::KCMFilter(QObject *parent, const KPluginMetaData &md, const QVariantList &)
+    : KCModule(parent, md),
       mGroupname(QStringLiteral("Filter Settings")),
       mSelCount(0),
       mOriginalString(QString())
@@ -43,15 +43,15 @@ KCMFilter::KCMFilter(QWidget *parent, const QVariantList &)
     mConfig = KSharedConfig::openConfig(QStringLiteral("khtmlrc"), KConfig::NoGlobals);
     setButtons(Default | Apply | Help);
 
-    QVBoxLayout *topLayout = new QVBoxLayout(this);
+    QVBoxLayout *topLayout = new QVBoxLayout(widget());
 
-    mEnableCheck = new QCheckBox(i18n("Enable filters"), this);
+    mEnableCheck = new QCheckBox(i18n("Enable filters"), widget());
     topLayout->addWidget(mEnableCheck);
 
-    mKillCheck = new QCheckBox(i18n("Hide filtered images"), this);
+    mKillCheck = new QCheckBox(i18n("Hide filtered images"), widget());
     topLayout->addWidget(mKillCheck);
 
-    mFilterWidget = new QTabWidget(this);
+    mFilterWidget = new QTabWidget(widget());
     topLayout->addWidget(mFilterWidget);
 
     QWidget *container = new QWidget(mFilterWidget);
@@ -81,7 +81,7 @@ KCMFilter::KCMFilter(QWidget *parent, const QVariantList &)
 
     vbox->addWidget(mListBox);
 
-    QLabel *exprLabel = new QLabel(i18n("<qt>Filter expression (e.g. <tt>http://www.example.com/ad/*</tt>, <a href=\"filterhelp\">more information</a>):"), this);
+    QLabel *exprLabel = new QLabel(i18n("<qt>Filter expression (e.g. <tt>http://www.example.com/ad/*</tt>, <a href=\"filterhelp\">more information</a>):"), widget());
     connect(exprLabel, &QLabel::linkActivated, this, &KCMFilter::slotInfoLinkActivated);
     vbox->addWidget(exprLabel);
 
@@ -114,7 +114,11 @@ KCMFilter::KCMFilter(QWidget *parent, const QVariantList &)
     mRefreshFreqSpinBox->setSuffix(ki18np(" day", " days"));
 
     /** connect signals and slots */
+#if QT_VERSION_MAJOR < 6
     connect(&mAutomaticFilterModel, &AutomaticFilterModel::changed, this, QOverload<bool>::of(&KCModule::changed));
+#else
+    connect(&mAutomaticFilterModel, &AutomaticFilterModel::changed, this, [this](bool changed){setNeedsSave(changed);});
+#endif
     connect(mRefreshFreqSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &KCMFilter::spinBoxChanged);
 
     mInsertButton = new QPushButton(QIcon::fromTheme(QStringLiteral("list-add")), i18n("Insert"), buttonBox);
@@ -192,13 +196,13 @@ void KCMFilter::slotInfoLinkActivated(const QString &url)
 
 void KCMFilter::slotKillChecked()
 {
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 void KCMFilter::slotEnableChecked()
 {
     updateButton();
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 void KCMFilter::slotItemSelected()
@@ -253,7 +257,7 @@ void KCMFilter::updateButton()
 
 void KCMFilter::importFilters()
 {
-    QString inFile = QFileDialog::getOpenFileName(this, i18n("Import Filters"));
+    QString inFile = QFileDialog::getOpenFileName(widget(), i18n("Import Filters"));
     if (!inFile.isEmpty()) {
         QFile f(inFile);
         if (f.open(QIODevice::ReadOnly)) {
@@ -290,20 +294,22 @@ void KCMFilter::importFilters()
             f.close();
 
             mListBox->addItems(paths);
-            emit changed(true);
+            setNeedsSave(true);
         }
     }
 }
 
 void KCMFilter::exportFilters()
 {
-    QString outFile = QFileDialog::getSaveFileName(this, i18n("Export Filters"));
+    QString outFile = QFileDialog::getSaveFileName(widget(), i18n("Export Filters"));
     if (!outFile.isEmpty()) {
 
         QFile f(outFile);
         if (f.open(QIODevice::WriteOnly)) {
             QTextStream ts(&f);
+#if QT_VERSION_MAJOR < 6
             ts.setCodec("UTF-8");
+#endif
             ts << "[AdBlock]" << Qt::endl;
 
             int nbLine =  mListBox->count();
@@ -402,7 +408,7 @@ void KCMFilter::insertFilter()
         }
 
         updateButton();
-        emit changed(true);
+        setNeedsSave(true);
     }
 }
 
@@ -414,7 +420,7 @@ void KCMFilter::removeFilter()
         }
     }
     mString->clear();
-    emit changed(true);
+    setNeedsSave(true);
     updateButton();
 }
 
@@ -424,22 +430,15 @@ void KCMFilter::updateFilter()
         int index = mListBox->currentRow();
         if (index >= 0) {
             mListBox->item(index)->setText(mString->text());
-            emit changed(true);
+            setNeedsSave(true);
         }
     }
     updateButton();
 }
 
-QString KCMFilter::quickHelp() const
-{
-    return i18n("<h1>Konqueror AdBlocK</h1> Konqueror AdBlocK allows you to create a list of filters"
-                " that are checked against linked images and frames. URL's that match are either discarded or"
-                " replaced with a placeholder image. ");
-}
-
 void KCMFilter::spinBoxChanged(int)
 {
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 AutomaticFilterModel::AutomaticFilterModel(QObject *parent)
diff --git a/settings/konqhtml/filteropts.h b/settings/konqhtml/filteropts.h
index c0b2a8b3da..4a2d707e6b 100644
--- a/settings/konqhtml/filteropts.h
+++ b/settings/konqhtml/filteropts.h
@@ -60,13 +60,13 @@ class KCMFilter : public KCModule
 {
     Q_OBJECT
 public:
-    KCMFilter(QWidget *parent, const QVariantList &);
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
+    KCMFilter(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
     ~KCMFilter() override;
 
     void load() override;
     void save() override;
     void defaults() override;
-    QString quickHelp() const override;
 
 protected Q_SLOTS:
     void insertFilter();
@@ -83,6 +83,10 @@ protected Q_SLOTS:
 
     void spinBoxChanged(int);
 
+#if QT_VERSION_MAJOR < 6
+    void setNeedsSave(bool needs) {emit changed(needs);}
+#endif
+
 private:
     QListWidget *mListBox;
     KListWidgetSearchLine *mSearchLine;
diff --git a/settings/konqhtml/generalopts.cpp b/settings/konqhtml/generalopts.cpp
index 2d6b3a8982..57a4b822b9 100644
--- a/settings/konqhtml/generalopts.cpp
+++ b/settings/konqhtml/generalopts.cpp
@@ -23,8 +23,6 @@
 
 // KDE
 #include <kbuildsycocaprogressdialog.h>
-// #include <kmimetypetrader.h>
-// #include <kservice.h>
 #include <KConfigGroup>
 #include <KSharedConfig>
 #include <KMessageWidget>
@@ -41,11 +39,11 @@ enum StartPage { ShowAboutPage, ShowStartUrlPage, ShowBlankPage, ShowBookmarksPa
 
 //-----------------------------------------------------------------------------
 
-KKonqGeneralOptions::KKonqGeneralOptions(QWidget *parent, const QVariantList &)
-    : KCModule(parent), m_emptyStartUrlWarning(new KMessageWidget(this))
+KKonqGeneralOptions::KKonqGeneralOptions(QObject *parent, const KPluginMetaData &md, const QVariantList &)
+    : KCModule(parent, md), m_emptyStartUrlWarning(new KMessageWidget(widget()))
 {
     m_pConfig = KSharedConfig::openConfig(QStringLiteral("konquerorrc"), KConfig::NoGlobals);
-    QVBoxLayout *lay = new QVBoxLayout(this);
+    QVBoxLayout *lay = new QVBoxLayout(widget());
     lay->setContentsMargins(0, 0, 0, 0);
 
     addHomeUrlWidgets(lay);
@@ -68,7 +66,7 @@ KKonqGeneralOptions::KKonqGeneralOptions(QWidget *parent, const QVariantList &)
 
     lay->addWidget(tabsGroup);
 
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void KKonqGeneralOptions::addHomeUrlWidgets(QVBoxLayout *lay)
@@ -82,14 +80,14 @@ void KKonqGeneralOptions::addHomeUrlWidgets(QVBoxLayout *lay)
     m_emptyStartUrlWarning->hide();
     formLayout->addRow(m_emptyStartUrlWarning);
 
-    QLabel *startLabel = new QLabel(i18nc("@label:listbox", "When a new &Tab is created"), this);
+    QLabel *startLabel = new QLabel(i18nc("@label:listbox", "When a new &Tab is created"), widget());
 
-    QWidget *containerWidget = new QWidget(this);
+    QWidget *containerWidget = new QWidget(widget());
     QHBoxLayout *hboxLayout = new QHBoxLayout(containerWidget);
     hboxLayout->setContentsMargins(0, 0, 0, 0);
     formLayout->addRow(startLabel, containerWidget);
 
-    m_startCombo = new QComboBox(this);
+    m_startCombo = new QComboBox(widget());
     m_startCombo->setEditable(false);
     m_startCombo->addItem(i18nc("@item:inlistbox", "Show Introduction Page"), ShowAboutPage);
     m_startCombo->addItem(i18nc("@item:inlistbox", "Show My Start Page"), ShowStartUrlPage);
@@ -99,7 +97,7 @@ void KKonqGeneralOptions::addHomeUrlWidgets(QVBoxLayout *lay)
     connect(m_startCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &KKonqGeneralOptions::slotChanged);
     hboxLayout->addWidget(m_startCombo);
 
-    startURL = new QLineEdit(this);
+    startURL = new QLineEdit(widget());
     startURL->setWindowTitle(i18nc("@title:window", "Select Start Page"));
     hboxLayout->addWidget(startURL);
     connect(startURL, &QLineEdit::textChanged, this, &KKonqGeneralOptions::displayEmpytStartPageWarningIfNeeded);
@@ -116,9 +114,9 @@ void KKonqGeneralOptions::addHomeUrlWidgets(QVBoxLayout *lay)
 
     ////
 
-    QLabel *label = new QLabel(i18n("Home page:"), this);
+    QLabel *label = new QLabel(i18n("Home page:"), widget());
 
-    homeURL = new QLineEdit(this);
+    homeURL = new QLineEdit(widget());
     homeURL->setWindowTitle(i18nc("@title:window", "Select Home Page"));
     formLayout->addRow(label, homeURL);
     connect(homeURL, &QLineEdit::textChanged, this, &KKonqGeneralOptions::slotChanged);
@@ -132,9 +130,9 @@ void KKonqGeneralOptions::addHomeUrlWidgets(QVBoxLayout *lay)
 
     ////
 
-    QLabel *webLabel = new QLabel(i18n("Default web browser engine:"), this);
+    QLabel *webLabel = new QLabel(i18n("Default web browser engine:"), widget());
 
-    m_webEngineCombo = new QComboBox(this);
+    m_webEngineCombo = new QComboBox(widget());
     m_webEngineCombo->setEditable(false);
     m_webEngineCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
     formLayout->addRow(webLabel, m_webEngineCombo);
@@ -142,7 +140,7 @@ void KKonqGeneralOptions::addHomeUrlWidgets(QVBoxLayout *lay)
     connect(m_webEngineCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &KKonqGeneralOptions::slotChanged);
 
     QLabel *splitLabel = new QLabel(i18n("When splitting a view"));
-    m_splitBehaviour = new QComboBox(this);
+    m_splitBehaviour = new QComboBox(widget());
     //Keep items order in sync with KonqMainWindow::SplitBehaviour
     m_splitBehaviour->addItems({
         i18n("Always duplicate current view"),
@@ -152,7 +150,7 @@ void KKonqGeneralOptions::addHomeUrlWidgets(QVBoxLayout *lay)
     formLayout->addRow(splitLabel, m_splitBehaviour);
     connect(m_splitBehaviour, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &KKonqGeneralOptions::slotChanged);
 
-    m_restoreLastState = new QCheckBox(i18n("When starting up, restore state from last time"), this);
+    m_restoreLastState = new QCheckBox(i18n("When starting up, restore state from last time"), widget());
     connect(m_restoreLastState, &QCheckBox::stateChanged, this, &KKonqGeneralOptions::slotChanged);
     formLayout->addRow(m_restoreLastState);
 }
@@ -298,7 +296,7 @@ void KKonqGeneralOptions::save()
         profile->sync();
 
         // kbuildsycoca is the one reading mimeapps.list, so we need to run it now
-        KBuildSycocaProgressDialog::rebuildKSycoca(this);
+        KBuildSycocaProgressDialog::rebuildKSycoca(widget());
     }
 
     KConfigGroup cg(m_pConfig, "FMSettings");
@@ -325,11 +323,11 @@ void KKonqGeneralOptions::save()
         QDBusMessage::createSignal(QStringLiteral("/KonqMain"), QStringLiteral("org.kde.Konqueror.Main"), QStringLiteral("reparseConfiguration"));
     QDBusConnection::sessionBus().send(message);
 
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void KKonqGeneralOptions::slotChanged()
 {
-    emit changed(true);
+    setNeedsSave(true);
 }
 
diff --git a/settings/konqhtml/generalopts.h b/settings/konqhtml/generalopts.h
index bfdc996d45..ac49f6da9f 100644
--- a/settings/konqhtml/generalopts.h
+++ b/settings/konqhtml/generalopts.h
@@ -26,12 +26,17 @@ class KKonqGeneralOptions : public KCModule
     Q_OBJECT
 
 public:
-    KKonqGeneralOptions(QWidget *parent, const QVariantList &);
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
+    KKonqGeneralOptions(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
     ~KKonqGeneralOptions() override;
     void load() override;
     void save() override;
     void defaults() override;
 
+#if QT_VERSION_MAJOR < 6
+    void setNeedsSave(bool needs) {emit changed(needs);}
+#endif
+
 private Q_SLOTS:
     void slotChanged();
     void displayEmpytStartPageWarningIfNeeded();
diff --git a/settings/konqhtml/htmlopts.cpp b/settings/konqhtml/htmlopts.cpp
index aa84553c4c..a9a13b7ab6 100644
--- a/settings/konqhtml/htmlopts.cpp
+++ b/settings/konqhtml/htmlopts.cpp
@@ -26,20 +26,11 @@
 
 //-----------------------------------------------------------------------------
 
-KMiscHTMLOptions::KMiscHTMLOptions(QWidget *parent, const QVariantList &)
-    : KCModule(parent), m_groupname(QStringLiteral("HTML Settings"))
+KMiscHTMLOptions::KMiscHTMLOptions(QObject *parent, const KPluginMetaData &md, const QVariantList &)
+    : KCModule(parent, md), m_groupname(QStringLiteral("HTML Settings"))
 {
     m_pConfig = KSharedConfig::openConfig(QStringLiteral("konquerorrc"), KConfig::NoGlobals);
-    QVBoxLayout *lay = new QVBoxLayout(this);
-
-    // Bookmarks
-    setQuickHelp(i18n("<h1>Konqueror Browser</h1> Here you can configure Konqueror's browser "
-                      "functionality. Please note that the file manager "
-                      "functionality has to be configured using the \"File Manager\" "
-                      "configuration module. You can make some "
-                      "settings how Konqueror should handle the HTML code in "
-                      "the web pages it loads. It is usually not necessary to "
-                      "change anything here."));
+    QVBoxLayout *lay = new QVBoxLayout(widget());
 
     QGroupBox *bgBookmarks = new QGroupBox(i18n("Boo&kmarks"));
     QVBoxLayout *laygroup1 = new QVBoxLayout;
@@ -62,7 +53,7 @@ KMiscHTMLOptions::KMiscHTMLOptions(QWidget *parent, const QVariantList &)
     lay->addWidget(bgBookmarks);
 
     // Form completion
-    m_pFormCompletionCheckBox = new QGroupBox(i18n("Form Com&pletion"), this);
+    m_pFormCompletionCheckBox = new QGroupBox(i18n("Form Com&pletion"), widget());
     m_pFormCompletionCheckBox->setCheckable(true);
     QFormLayout *laygroup2 = new QFormLayout(m_pFormCompletionCheckBox);
 
@@ -70,7 +61,7 @@ KMiscHTMLOptions::KMiscHTMLOptions(QWidget *parent, const QVariantList &)
                                             " the data you enter in web forms and suggest it in similar fields for all forms."));
     connect(m_pFormCompletionCheckBox, &QGroupBox::toggled, this, &KMiscHTMLOptions::markAsChanged);
 
-    m_pMaxFormCompletionItems = new QSpinBox(this);
+    m_pMaxFormCompletionItems = new QSpinBox(widget());
     m_pMaxFormCompletionItems->setRange(0, 100);
     laygroup2->addRow(i18n("&Maximum completions:"), m_pMaxFormCompletionItems);
     m_pMaxFormCompletionItems->setToolTip(
@@ -110,24 +101,24 @@ KMiscHTMLOptions::KMiscHTMLOptions(QWidget *parent, const QVariantList &)
     QGroupBox *bgMisc = new QGroupBox(i18nc("@title:group", "Miscellaneous"));
     QFormLayout *fl = new QFormLayout(bgMisc);
 
-    m_pAutoRedirectCheckBox = new QCheckBox(i18n("Allow automatic delayed &reloading/redirecting"), this);
+    m_pAutoRedirectCheckBox = new QCheckBox(i18n("Allow automatic delayed &reloading/redirecting"), widget());
     m_pAutoRedirectCheckBox->setToolTip(i18n("Some web pages request an automatic reload or redirection after"
                                           " a certain period of time. By unchecking this box Konqueror will ignore these requests."));
     connect(m_pAutoRedirectCheckBox, QOverload<bool>::of(&QAbstractButton::toggled), this, &KMiscHTMLOptions::markAsChanged);
     fl->addRow(m_pAutoRedirectCheckBox);
 
     // Checkbox to enable/disable Access Key activation through the Ctrl key.
-    m_pAccessKeys = new QCheckBox(i18n("Enable Access Ke&y activation with Ctrl key"), this);
+    m_pAccessKeys = new QCheckBox(i18n("Enable Access Ke&y activation with Ctrl key"), widget());
     m_pAccessKeys->setToolTip(i18n("Pressing the Ctrl key when viewing webpages activates Access Keys. Unchecking this box will disable this accessibility feature. (Konqueror needs to be restarted for this change to take effect.)"));
     connect(m_pAccessKeys, QOverload<bool>::of(&QAbstractButton::toggled), this, &KMiscHTMLOptions::markAsChanged);
     fl->addRow(m_pAccessKeys);
 
-    m_pDoNotTrack = new QCheckBox(i18n("Send the DNT header to tell web sites you do not want to be tracked"), this);
+    m_pDoNotTrack = new QCheckBox(i18n("Send the DNT header to tell web sites you do not want to be tracked"), widget());
     m_pDoNotTrack->setToolTip(i18n("Check this box if you want to inform a web site that you do not want your web browsing habits tracked."));
     connect(m_pDoNotTrack, QOverload<bool>::of(&QAbstractButton::toggled), this, &KMiscHTMLOptions::markAsChanged);
     fl->addRow(m_pDoNotTrack);
 
-    m_pOfferToSaveWebsitePassword = new QCheckBox(i18n("Offer to save website passwords"), this);
+    m_pOfferToSaveWebsitePassword = new QCheckBox(i18n("Offer to save website passwords"), widget());
     m_pOfferToSaveWebsitePassword->setToolTip(i18n("Uncheck this box to prevent being prompted to save website passwords"));
     connect(m_pOfferToSaveWebsitePassword, QOverload<bool>::of(&QAbstractButton::toggled), this, &KMiscHTMLOptions::markAsChanged);
     fl->addRow(m_pOfferToSaveWebsitePassword);
@@ -140,7 +131,7 @@ KMiscHTMLOptions::KMiscHTMLOptions(QWidget *parent, const QVariantList &)
     lay->addWidget(bgMisc);
     lay->addStretch(5);
 
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 KMiscHTMLOptions::~KMiscHTMLOptions()
@@ -228,5 +219,5 @@ void KMiscHTMLOptions::save()
     sessionBus.send(QDBusMessage::createSignal(QStringLiteral("/KBookmarkManager/konqueror"), QStringLiteral("org.kde.KIO.KBookmarkManager"), QStringLiteral("bookmarkConfigChanged")));
     sessionBus.send(QDBusMessage::createSignal(QStringLiteral("/KIO/Scheduler"), QStringLiteral("org.kde.KIO.Scheduler"), QStringLiteral("reparseSlaveConfiguration")));
 
-    emit changed(false);
+    setNeedsSave(false);
 }
diff --git a/settings/konqhtml/htmlopts.h b/settings/konqhtml/htmlopts.h
index b4a4ba4235..4bbebb7be1 100644
--- a/settings/konqhtml/htmlopts.h
+++ b/settings/konqhtml/htmlopts.h
@@ -28,7 +28,8 @@ class KMiscHTMLOptions : public KCModule
     Q_OBJECT
 
 public:
-    KMiscHTMLOptions(QWidget *parent, const QVariantList &);
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
+    KMiscHTMLOptions(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
     ~KMiscHTMLOptions() override;
     void load() override;
     void save() override;
diff --git a/settings/konqhtml/javaopts.cpp b/settings/konqhtml/javaopts.cpp
index eda33f997a..a1a12686fd 100644
--- a/settings/konqhtml/javaopts.cpp
+++ b/settings/konqhtml/javaopts.cpp
@@ -70,12 +70,12 @@ KJavaOptions::KJavaOptions(const KSharedConfig::Ptr &config, const QString &grou
       java_global_policies(config, group, true),
       _removeJavaDomainSettings(false)
 {
-    QVBoxLayout *toplevel = new QVBoxLayout(this);
+    QVBoxLayout *toplevel = new QVBoxLayout(widget());
 
     /***************************************************************************
      ********************* Global Settings *************************************
      **************************************************************************/
-    enableJavaGloballyCB = new QCheckBox(i18n("Enable Ja&va globally"), this);
+    enableJavaGloballyCB = new QCheckBox(i18n("Enable Ja&va globally"), widget());
     connect(enableJavaGloballyCB, &QAbstractButton::clicked, this, &KJavaOptions::slotChanged);
     connect(enableJavaGloballyCB, &QAbstractButton::clicked, this, &KJavaOptions::toggleJavaControls);
     toplevel->addWidget(enableJavaGloballyCB);
@@ -83,26 +83,26 @@ KJavaOptions::KJavaOptions(const KSharedConfig::Ptr &config, const QString &grou
     /***************************************************************************
      ***************** Domain Specific Settings ********************************
      **************************************************************************/
-    domainSpecific = new JavaDomainListView(m_pConfig, m_groupname, this, this);
+    domainSpecific = new JavaDomainListView(m_pConfig, m_groupname, this, widget());
     connect(domainSpecific, &DomainListView::changed, this, &KJavaOptions::slotChanged);
     toplevel->addWidget(domainSpecific, 2);
 
     /***************************************************************************
      ***************** Java Runtime Settings ***********************************
      **************************************************************************/
-    QGroupBox *javartGB = new QGroupBox(i18n("Java Runtime Settings"), this);
+    QGroupBox *javartGB = new QGroupBox(i18n("Java Runtime Settings"), widget());
     QFormLayout *laygroup1 = new QFormLayout(javartGB);
     toplevel->addWidget(javartGB);
 
-    javaSecurityManagerCB = new QCheckBox(i18n("&Use security manager"), this);
+    javaSecurityManagerCB = new QCheckBox(i18n("&Use security manager"), widget());
     laygroup1->addRow(javaSecurityManagerCB);
     connect(javaSecurityManagerCB, &QAbstractButton::toggled, this, &KJavaOptions::slotChanged);
 
-    useKioCB = new QCheckBox(i18n("Use &KIO"), this);
+    useKioCB = new QCheckBox(i18n("Use &KIO"), widget());
     laygroup1->addRow(useKioCB);
     connect(useKioCB, &QAbstractButton::toggled, this, &KJavaOptions::slotChanged);
 
-    enableShutdownCB = new QCheckBox(i18n("Shu&tdown applet server when inactive for more than"), this);
+    enableShutdownCB = new QCheckBox(i18n("Shu&tdown applet server when inactive for more than"), widget());
     connect(enableShutdownCB, &QAbstractButton::toggled, this, &KJavaOptions::slotChanged);
     connect(enableShutdownCB, &QAbstractButton::clicked, this, &KJavaOptions::toggleJavaControls);
     QWidget *secondsHB = new QWidget(javartGB);
@@ -118,11 +118,11 @@ KJavaOptions::KJavaOptions(const KSharedConfig::Ptr &config, const QString &grou
     connect(serverTimeoutSB, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](){ slotChanged(); });
     laygroup1->addRow(enableShutdownCB, serverTimeoutSB);
 
-    pathED = new  KUrlRequester(this);
+    pathED = new  KUrlRequester(widget());
     connect(pathED, &KUrlRequester::textChanged, this, &KJavaOptions::slotChanged);
     laygroup1->addRow(i18n("&Path to Java executable, or 'java':"), pathED);
 
-    addArgED = new QLineEdit(this);
+    addArgED = new QLineEdit(widget());
     connect(addArgED, &QLineEdit::textChanged, this, &KJavaOptions::slotChanged);
     laygroup1->addRow(i18n("Additional Java a&rguments:"), addArgED);
 
@@ -223,7 +223,7 @@ void KJavaOptions::load()
     serverTimeoutSB->setValue(serverTimeout);
 
     toggleJavaControls();
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void KJavaOptions::defaults()
@@ -237,7 +237,7 @@ void KJavaOptions::defaults()
     enableShutdownCB->setChecked(true);
     serverTimeoutSB->setValue(60);
     toggleJavaControls();
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 void KJavaOptions::save()
@@ -259,12 +259,12 @@ void KJavaOptions::save()
 
     // sync moved to KJSParts::save
 //    m_pConfig->sync();
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void KJavaOptions::slotChanged()
 {
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 void KJavaOptions::toggleJavaControls()
diff --git a/settings/konqhtml/javaopts.h b/settings/konqhtml/javaopts.h
index 37a6e669b5..ba54ff082b 100644
--- a/settings/konqhtml/javaopts.h
+++ b/settings/konqhtml/javaopts.h
@@ -90,6 +90,10 @@ public:
 
     bool _removeJavaScriptDomainAdvice;
 
+#if QT_VERSION_MAJOR < 6
+    void setNeedsSave(bool needs) {emit changed(needs);}
+#endif
+
 private Q_SLOTS:
     void slotChanged();
     void toggleJavaControls();
diff --git a/settings/konqhtml/jsopts.cpp b/settings/konqhtml/jsopts.cpp
index e8e2f2123a..0029017d9e 100644
--- a/settings/konqhtml/jsopts.cpp
+++ b/settings/konqhtml/jsopts.cpp
@@ -45,7 +45,7 @@ KJavaScriptOptions::KJavaScriptOptions(KSharedConfig::Ptr config, const QString
     js_global_policies(config, group, true, QString()),
     _removeECMADomainSettings(false)
 {
-    QVBoxLayout *toplevel = new QVBoxLayout(this);
+    QVBoxLayout *toplevel = new QVBoxLayout(widget());
 
     enableJavaScriptGloballyCB = new QCheckBox(i18n("Ena&ble JavaScript globally"));
     enableJavaScriptGloballyCB->setToolTip(i18n("Enables the execution of scripts written in ECMA-Script "
@@ -72,8 +72,12 @@ KJavaScriptOptions::KJavaScriptOptions(KSharedConfig::Ptr config, const QString
     hbox->addWidget(reportErrorsCB);
 
     // the domain-specific listview
-    domainSpecific = new JSDomainListView(m_pConfig, m_groupname, this, this);
+    domainSpecific = new JSDomainListView(m_pConfig, m_groupname, this, widget());
+#if QT_VERSION_MAJOR < 6
     connect(domainSpecific, &DomainListView::changed, this, &KJavaScriptOptions::markAsChanged);
+#else
+    connect(domainSpecific, &DomainListView::changed, this, [this](bool changed){setNeedsSave(changed);});
+#endif
     toplevel->addWidget(domainSpecific, 2);
 
     domainSpecific->setToolTip(i18n("Here you can set specific JavaScript policies for any particular "
@@ -102,9 +106,13 @@ KJavaScriptOptions::KJavaScriptOptions(KSharedConfig::Ptr config, const QString
 
     // the frame containing the JavaScript policies settings
     js_policies_frame = new JSPoliciesFrame(&js_global_policies,
-                                            i18n("Global JavaScript Policies"), this);
+                                            i18n("Global JavaScript Policies"), widget());
     toplevel->addWidget(js_policies_frame);
+#if QT_VERSION_MAJOR < 6
     connect(js_policies_frame, &JSPoliciesFrame::changed, this, &KJavaScriptOptions::markAsChanged);
+#else
+    connect(js_policies_frame, &JSPoliciesFrame::changed, this, [this](){setNeedsSave(true);});
+#endif
 
 }
 
@@ -129,7 +137,7 @@ void KJavaScriptOptions::load()
     reportErrorsCB->setChecked(cg.readEntry("ReportJavaScriptErrors", false));
     jsDebugWindow->setChecked(cg.readEntry("EnableJavaScriptDebug", false));
 //    js_popup->setButton( m_pConfig->readUnsignedNumEntry("WindowOpenPolicy", 0) );
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void KJavaScriptOptions::defaults()
@@ -139,7 +147,7 @@ void KJavaScriptOptions::defaults()
         js_global_policies.isFeatureEnabled());
     reportErrorsCB->setChecked(false);
     jsDebugWindow->setChecked(false);
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 void KJavaScriptOptions::save()
@@ -158,7 +166,7 @@ void KJavaScriptOptions::save()
 
     // sync moved to KJSParts::save
 //    cg.sync();
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void KJavaScriptOptions::slotChangeJSEnabled()
diff --git a/settings/konqhtml/jsopts.h b/settings/konqhtml/jsopts.h
index 4655a1fff9..5f875c5509 100644
--- a/settings/konqhtml/jsopts.h
+++ b/settings/konqhtml/jsopts.h
@@ -58,6 +58,10 @@ public:
 
     bool _removeJavaScriptDomainAdvice;
 
+#if QT_VERSION_MAJOR < 6
+    void setNeedsSave(bool needs) {emit changed(needs);}
+#endif
+
 private Q_SLOTS:
     void slotChangeJSEnabled();
 
diff --git a/settings/konqhtml/main.cpp b/settings/konqhtml/main.cpp
index ed5f273487..3c0866e585 100644
--- a/settings/konqhtml/main.cpp
+++ b/settings/konqhtml/main.cpp
@@ -35,23 +35,31 @@
 #include "filteropts.h"
 #include "generalopts.h"
 
-KJSParts::KJSParts(QWidget *parent, const QVariantList &)
-    : KCModule(parent)
+KJSParts::KJSParts(QObject *parent, const KPluginMetaData &md, const QVariantList &)
+    : KCModule(parent, md)
 {
     mConfig = KSharedConfig::openConfig(QStringLiteral("konquerorrc"), KConfig::NoGlobals);
 
-    QVBoxLayout *layout = new QVBoxLayout(this);
-    tab = new QTabWidget(this);
+    QVBoxLayout *layout = new QVBoxLayout(widget());
+    tab = new QTabWidget(widget());
     layout->addWidget(tab);
 
     // ### the groupname is duplicated in KJSParts::save
-    java = new KJavaOptions(mConfig, QStringLiteral("Java/JavaScript Settings"), this);
-    tab->addTab(java, i18n("&Java"));
+    java = new KJavaOptions(mConfig, QStringLiteral("Java/JavaScript Settings"), widget());
+    tab->addTab(java->widget(), i18n("&Java"));
+#if QT_VERSION_MAJOR < 6
     connect(java, QOverload<bool>::of(&KJavaOptions::changed), this, &KJSParts::markAsChanged);
+#else
+    connect(java, &KJavaOptions::needsSaveChanged, this, &KJSParts::needsSaveChanged);
+#endif
 
-    javascript = new KJavaScriptOptions(mConfig, QStringLiteral("Java/JavaScript Settings"), this);
-    tab->addTab(javascript, i18n("Java&Script"));
+    javascript = new KJavaScriptOptions(mConfig, QStringLiteral("Java/JavaScript Settings"), widget());
+    tab->addTab(javascript->widget(), i18n("Java&Script"));
+#if QT_VERSION_MAJOR < 6
     connect(javascript, QOverload<bool>::of(&KJavaScriptOptions::changed), this, &KJSParts::markAsChanged);
+#else
+    connect(javascript, &KJavaScriptOptions::needsSaveChanged, this, &KJSParts::needsSaveChanged);
+#endif
 }
 
 void KJSParts::load()
@@ -87,17 +95,3 @@ void KJSParts::defaults()
     javascript->defaults();
     java->defaults();
 }
-
-QString KJSParts::quickHelp() const
-{
-    return i18n("<h2>JavaScript</h2>On this page, you can configure "
-                "whether JavaScript programs embedded in web pages should "
-                "be allowed to be executed by Konqueror."
-                "<h2>Java</h2>On this page, you can configure "
-                "whether Java applets embedded in web pages should "
-                "be allowed to be executed by Konqueror."
-                "<br /><br /><b>Note:</b> Active content is always a "
-                "security risk, which is why Konqueror allows you to specify very "
-                "fine-grained from which hosts you want to execute Java and/or "
-                "JavaScript programs.");
-}
diff --git a/settings/konqhtml/main.h b/settings/konqhtml/main.h
index a8dc43acf2..bbffa49b5d 100644
--- a/settings/konqhtml/main.h
+++ b/settings/konqhtml/main.h
@@ -27,12 +27,12 @@ class KJSParts : public KCModule
 
 public:
 
-    KJSParts(QWidget *parent, const QVariantList &);
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
+    KJSParts(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
 
     void load() override;
     void save() override;
     void defaults() override;
-    QString quickHelp() const override;
 
 private:
     QTabWidget   *tab;
diff --git a/settings/konqhtml/useragent/useragent.cpp b/settings/konqhtml/useragent/useragent.cpp
index c0619b4507..6e76356490 100644
--- a/settings/konqhtml/useragent/useragent.cpp
+++ b/settings/konqhtml/useragent/useragent.cpp
@@ -20,18 +20,18 @@
 #include <QDir>
 
 
-UserAgent::UserAgent(QWidget* parent, const QVariantList& ): KCModule(parent),
+UserAgent::UserAgent(QObject *parent, const KPluginMetaData &md, const QVariantList &): KCModule(parent, md),
     m_ui(new Ui::UserAgent),
     m_config(KSharedConfig::openConfig(QString(), KConfig::NoGlobals)),
     m_templatesConfig(KSharedConfig::openConfig("useragenttemplatesrc"))
 {
-    m_ui->setupUi(this);
+    m_ui->setupUi(widget());
     fillTemplateWidget(m_templatesConfig->group("Templates").entryMap());
     connect(m_ui->useTemplateBtn, &QPushButton::clicked, this, &UserAgent::useSelectedTemplate);
     connect(m_ui->templates, &QTreeWidget::itemDoubleClicked, this, &UserAgent::useDblClickedTemplate);
     connect(m_ui->templates, &QTreeWidget::itemSelectionChanged, this, &UserAgent::templateSelectionChanged);
     connect(m_ui->useDefaultUA, &QCheckBox::toggled, this, [this](bool on){toggleCustomUA(!on);});
-    connect(m_ui->userAgentString, &QLineEdit::textChanged, this, [this](){emit changed(true);});
+    connect(m_ui->userAgentString, &QLineEdit::textChanged, this, [this](){setNeedsSave(true);});
     connect(m_ui->editTemplateBtn, &QPushButton::clicked, this, &UserAgent::editTemplate);
     connect(m_ui->newTemplateBtn, &QPushButton::clicked, this, &UserAgent::createNewTemplate);
     connect(m_ui->duplicateTemplateBtn, &QPushButton::clicked, this, &UserAgent::duplicateTemplate);
@@ -73,7 +73,7 @@ void UserAgent::defaults()
 
     m_ui->useDefaultUA->setChecked(true);
     m_ui->userAgentString->setText(QString());
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 void UserAgent::load()
@@ -83,7 +83,7 @@ void UserAgent::load()
     m_ui->useDefaultUA->setChecked(grp.readEntry("UseDefaultUserAgent", true));
     toggleCustomUA(useCustomUserAgent());
     m_ui->invalidTemplateNameWidget->hide(); //There can't be problems when loading
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void UserAgent::save()
@@ -96,7 +96,7 @@ void UserAgent::save()
     QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KonqMain"), QStringLiteral("org.kde.Konqueror.Main"),
                                                       QStringLiteral("reparseConfiguration"));
     QDBusConnection::sessionBus().send(message);
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void UserAgent::saveTemplates()
@@ -125,7 +125,7 @@ void UserAgent::toggleCustomUA(bool on)
     m_ui->userAgentString->setEnabled(on);
     m_ui->customUABox->setEnabled(on);
     enableDisableUseSelectedTemplateBtn();
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 QTreeWidgetItem * UserAgent::selectedTemplate() const
@@ -187,7 +187,7 @@ void UserAgent::duplicateTemplate()
 QTreeWidgetItem* UserAgent::createNewTemplateInternal()
 {
     bool ok = false;
-    QString name = QInputDialog::getText(this, i18nc("@title:window Title of dialog to choose name to given to new User Agent", "Choose User Agent name"),
+    QString name = QInputDialog::getText(widget(), i18nc("@title:window Title of dialog to choose name to given to new User Agent", "Choose User Agent name"),
                                          i18nc("Name of the new User Agent", "User Agent name"), QLineEdit::Normal, QString(), &ok);
     if (!ok) {
         return nullptr;
@@ -209,7 +209,7 @@ void UserAgent::deleteTemplate()
     QTreeWidgetItem *it = selectedTemplate();
     if (it) {
         delete it;
-        emit changed(true);
+        setNeedsSave(true);
     }
 }
 
@@ -234,7 +234,7 @@ void UserAgent::templateChanged(QTreeWidgetItem*, int col)
     if (col == 0) {
         checkTemplatesValidity();
     }
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 UserAgent::TemplateMap UserAgent::templatesFromUI() const
diff --git a/settings/konqhtml/useragent/useragent.h b/settings/konqhtml/useragent/useragent.h
index 540284a4da..b06af42b7e 100644
--- a/settings/konqhtml/useragent/useragent.h
+++ b/settings/konqhtml/useragent/useragent.h
@@ -33,18 +33,25 @@ class UserAgent : public KCModule
     Q_OBJECT
 
 public:
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
     /**
      * @brief Constructor
      *
      * @param parent the parent widget
+     * @param md as in `KCModule` constructor
+     * @param args as in `KCModule` constructor
      */
-    UserAgent(QWidget* parent, const QVariantList&);
+    UserAgent(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
 
     /**
      * @brief Destructor
      */
     ~UserAgent();
 
+#if QT_VERSION_MAJOR < 6
+    void setNeedsSave(bool needs) {emit changed(needs);}
+#endif
+
 public slots:
 
     /**
diff --git a/settings/performance/CMakeLists.txt b/settings/performance/CMakeLists.txt
index ca2fdd89a0..c19c5505e7 100644
--- a/settings/performance/CMakeLists.txt
+++ b/settings/performance/CMakeLists.txt
@@ -9,4 +9,9 @@ ki18n_wrap_ui(kcm_performance_PART_SRCS konqueror_ui.ui system_ui.ui )
 
 kcoreaddons_add_plugin(kcm_performance SOURCES ${kcm_performance_PART_SRCS} INSTALL_NAMESPACE "konqueror_kcms")
 
-target_link_libraries(kcm_performance  KF${KF_MAJOR_VERSION}::ConfigWidgets KF${KF_MAJOR_VERSION}::KIOWidgets KF${KF_MAJOR_VERSION}::I18n Qt${KF_MAJOR_VERSION}::DBus )
+target_link_libraries(kcm_performance
+  KF${KF_MAJOR_VERSION}::ConfigWidgets
+  KF${KF_MAJOR_VERSION}::KCMUtils
+  KF${KF_MAJOR_VERSION}::KIOWidgets
+  KF${KF_MAJOR_VERSION}::I18n
+  Qt${KF_MAJOR_VERSION}::DBus)
diff --git a/settings/performance/kcmperformance.cpp b/settings/performance/kcmperformance.cpp
index f43f6734bd..2b7c7e0e6f 100644
--- a/settings/performance/kcmperformance.cpp
+++ b/settings/performance/kcmperformance.cpp
@@ -22,19 +22,24 @@ K_PLUGIN_FACTORY_WITH_JSON(KCMPerformanceConfigFactory, "kcmperformance.json", r
 namespace KCMPerformance
 {
 
-Config::Config(QWidget *parent_P, const QVariantList &)
-    : KCModule(parent_P)
+Config::Config(QObject *parent, const KPluginMetaData &md, const QVariantList &)
+    : KCModule(parent, md)
 {
-    setQuickHelp(i18n("<h1>KDE Performance</h1>"
-                      " You can configure settings that improve KDE performance here."));
-
-    QVBoxLayout *topLayout = new QVBoxLayout(this);
-    QTabWidget *tabs = new QTabWidget(this);
+    QVBoxLayout *topLayout = new QVBoxLayout(widget());
+    QTabWidget *tabs = new QTabWidget(widget());
     konqueror_widget = new Konqueror;
+#if QT_VERSION_MAJOR < 6
     connect(konqueror_widget, &Konqueror::changed, this, &Config::markAsChanged);
+#else
+    connect(konqueror_widget, &Konqueror::changed, this, [this](){setNeedsSave(true);});
+#endif
     tabs->addTab(konqueror_widget, i18n("Konqueror"));
     system_widget = new SystemWidget;
+#if QT_VERSION_MAJOR < 6
     connect(system_widget, &SystemWidget::changed, this, &Config::markAsChanged);
+#else
+    connect(system_widget, &SystemWidget::changed, this, [this](){setNeedsSave(true);});
+#endif
     tabs->addTab(system_widget, i18n("System"));
     topLayout->addWidget(tabs);
 }
@@ -57,34 +62,33 @@ void Config::defaults()
     system_widget->defaults();
 }
 
-KonquerorConfig::KonquerorConfig(QWidget *parent_P, const QVariantList &)
-    : KCModule(parent_P)
+KonquerorConfig::KonquerorConfig(QObject *parent, const KPluginMetaData &md, const QVariantList &)
+    : KCModule(parent, md)
 {
-    setQuickHelp(i18n("<h1>Konqueror Performance</h1>"
-                      " You can configure several settings that improve Konqueror performance here."
-                      " These include options for reusing already running instances"
-                      " and for keeping instances preloaded."));
-
-    QVBoxLayout *topLayout = new QVBoxLayout(this);
+    QVBoxLayout *topLayout = new QVBoxLayout(widget());
     topLayout->setContentsMargins(0, 0, 0, 0);
-    widget = new Konqueror(this);
-    connect(widget, &Konqueror::changed, this, &KonquerorConfig::markAsChanged);
-    topLayout->addWidget(widget);
+    m_widget = new Konqueror(widget());
+#if QT_VERSION_MAJOR < 6
+    connect(m_widget, &Konqueror::changed, this, &KonquerorConfig::markAsChanged);
+#else
+    connect(m_widget, &Konqueror::changed, this, [this](){setNeedsSave(true);});
+#endif
+    topLayout->addWidget(m_widget);
 }
 
 void KonquerorConfig::load()
 {
-    widget->load();
+    m_widget->load();
 }
 
 void KonquerorConfig::save()
 {
-    widget->save();
+    m_widget->save();
 }
 
 void KonquerorConfig::defaults()
 {
-    widget->defaults();
+    m_widget->defaults();
 }
 
 } // namespace
diff --git a/settings/performance/kcmperformance.h b/settings/performance/kcmperformance.h
index 06a00ab726..e0f53e1511 100644
--- a/settings/performance/kcmperformance.h
+++ b/settings/performance/kcmperformance.h
@@ -20,7 +20,8 @@ class Config
 {
     Q_OBJECT
 public:
-    Config(QWidget *parent_P, const QVariantList &args);
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
+    Config(QObject *parent_P, const KPluginMetaData &md={}, const QVariantList &args={});
     void load() override;
     void save() override;
     void defaults() override;
@@ -34,12 +35,13 @@ class KonquerorConfig
 {
     Q_OBJECT
 public:
-    KonquerorConfig(QWidget *parent_P, const QVariantList &args);
+    //TODO KF6: when dropping compatibility with KF5, remove QVariantList argument
+    KonquerorConfig(QObject *parent, const KPluginMetaData &md={}, const QVariantList &args={});
     void load() override;
     void save() override;
     void defaults() override;
 private:
-    Konqueror *widget;
+    Konqueror *m_widget;
 };
 
 } // namespace
diff --git a/sidebar/CMakeLists.txt b/sidebar/CMakeLists.txt
index 876840428d..54c348936a 100644
--- a/sidebar/CMakeLists.txt
+++ b/sidebar/CMakeLists.txt
@@ -54,8 +54,13 @@ target_link_libraries(konq_sidebar
     KF${KF_MAJOR_VERSION}::Konq
     KF${KF_MAJOR_VERSION}::KCMUtils
     KF${KF_MAJOR_VERSION}::IconThemes
+    KF${KF_MAJOR_VERSION}::KIOFileWidgets
     konqsidebarplugin)
 
+if (KF_MAJOR_VERSION STRGREATER "5")
+    target_link_libraries(konq_sidebar KF${KF_MAJOR_VERSION}::IconWidgets)
+endif()
+
 install(TARGETS konq_sidebar DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf${KF_MAJOR_VERSION}/parts)
 
 ########### install files ###############
diff --git a/sidebar/history_module/CMakeLists.txt b/sidebar/history_module/CMakeLists.txt
index 5b64ac6015..9f90d2e69d 100644
--- a/sidebar/history_module/CMakeLists.txt
+++ b/sidebar/history_module/CMakeLists.txt
@@ -17,4 +17,4 @@ ki18n_wrap_ui(kcm_history_SRCS history_dlg.ui )
 kcoreaddons_add_plugin(kcm_history SOURCES ${kcm_history_SRCS} INSTALL_NAMESPACE konqueror_kcms)
 
 # konquerorprivate is only needed for konqhistorysettings...
-target_link_libraries(kcm_history konquerorprivate KF${KF_MAJOR_VERSION}::Konq KF${KF_MAJOR_VERSION}::Parts)
+target_link_libraries(kcm_history konquerorprivate KF${KF_MAJOR_VERSION}::Konq KF${KF_MAJOR_VERSION}::Parts KF${KF_MAJOR_VERSION}::KCMUtils)
diff --git a/sidebar/history_module/kcmhistory.cpp b/sidebar/history_module/kcmhistory.cpp
index b623964725..5fc0a4e8b4 100644
--- a/sidebar/history_module/kcmhistory.cpp
+++ b/sidebar/history_module/kcmhistory.cpp
@@ -33,8 +33,8 @@
 
 K_PLUGIN_CLASS_WITH_JSON(HistorySidebarConfig, "kcmhistory.json")
 
-HistorySidebarConfig::HistorySidebarConfig(QWidget *parent, const QVariantList &)
-    : KCModule(parent, QVariantList())
+HistorySidebarConfig::HistorySidebarConfig(QObject *parent, const KPluginMetaData& md, const QVariantList &list)
+    : KCModule(parent, md)
 {
     m_settings = KonqHistorySettings::self();
 
@@ -42,8 +42,8 @@ HistorySidebarConfig::HistorySidebarConfig(QWidget *parent, const QVariantList &
         new KonqHistoryProvider(this);
     }
 
-    QVBoxLayout *topLayout = new QVBoxLayout(this);
-    dialog = new KonqSidebarHistoryDlg(this);
+    QVBoxLayout *topLayout = new QVBoxLayout(widget());
+    dialog = new KonqSidebarHistoryDlg(widget());
 
     dialog->comboDefaultAction->addItem(i18nc("Automatically decide which action to perform", "Auto"));
     dialog->comboDefaultAction->addItem(i18nc("Open URL in new tab", "Open in new tab"));
@@ -101,7 +101,7 @@ HistorySidebarConfig::HistorySidebarConfig(QWidget *parent, const QVariantList &
 
 void HistorySidebarConfig::configChanged()
 {
-    emit changed(true);
+    setNeedsSave(true);
 }
 
 void HistorySidebarConfig::load()
@@ -133,7 +133,7 @@ void HistorySidebarConfig::load()
     slotNewerChanged(dialog->spinNewer->value());
     slotOlderChanged(dialog->spinOlder->value());
 
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void HistorySidebarConfig::save()
@@ -159,7 +159,7 @@ void HistorySidebarConfig::save()
 
     m_settings->applySettings();
 
-    emit changed(false);
+    setNeedsSave(false);
 }
 
 void HistorySidebarConfig::defaults()
@@ -183,12 +183,6 @@ void HistorySidebarConfig::defaults()
     m_fontOlder = QFont();
 }
 
-QString HistorySidebarConfig::quickHelp() const
-{
-    return i18n("<h1>History Sidebar</h1>"
-                " You can configure the history sidebar here.");
-}
-
 void HistorySidebarConfig::slotExpireChanged()
 {
     configChanged();
@@ -227,7 +221,7 @@ void HistorySidebarConfig::slotOlderChanged(int value)
 void HistorySidebarConfig::slotGetFontNewer()
 {
     bool ok = false;
-    m_fontNewer = QFontDialog::getFont(&ok, m_fontNewer, this);
+    m_fontNewer = QFontDialog::getFont(&ok, m_fontNewer, widget());
     if (ok) {
         configChanged();
     }
@@ -236,7 +230,7 @@ void HistorySidebarConfig::slotGetFontNewer()
 void HistorySidebarConfig::slotGetFontOlder()
 {
     bool ok = false;
-    m_fontOlder = QFontDialog::getFont(&ok, m_fontOlder, this);
+    m_fontOlder = QFontDialog::getFont(&ok, m_fontOlder, widget());
     if (ok) {
         configChanged();
     }
@@ -246,7 +240,7 @@ void HistorySidebarConfig::slotClearHistory()
 {
     KGuiItem guiitem = KStandardGuiItem::clear();
     guiitem.setIcon(QIcon::fromTheme("edit-clear-history"));
-    if (KMessageBox::warningContinueCancel(this,
+    if (KMessageBox::warningContinueCancel(widget(),
                                            i18n("Do you really want to clear "
                                                    "the entire history?"),
                                            i18nc("@title:window", "Clear History?"), guiitem)
diff --git a/sidebar/history_module/kcmhistory.h b/sidebar/history_module/kcmhistory.h
index 2420d1b96b..b9ae9726bc 100644
--- a/sidebar/history_module/kcmhistory.h
+++ b/sidebar/history_module/kcmhistory.h
@@ -10,7 +10,7 @@
 #ifndef __kcmhistory_h__
 #define __kcmhistory_h__
 
-#include <kcmodule.h>
+#include <KCModule>
 #include "ui_history_dlg.h"
 
 class KonqHistoryManager;
@@ -31,13 +31,15 @@ class HistorySidebarConfig : public KCModule
     Q_OBJECT
 
 public:
-    explicit HistorySidebarConfig(QWidget *parent = nullptr, const QVariantList &list = QVariantList());
+    explicit HistorySidebarConfig(QObject *parent = nullptr, const KPluginMetaData& md={}, const QVariantList &list = {});
 
     void load() override;
     void save() override;
     void defaults() override;
 
-    QString quickHelp() const override;
+#if QT_VERSION_MAJOR < 6
+    void setNeedSave(bool needs){emit changed(needs);}
+#endif
 
 private Q_SLOTS:
     void configChanged();
diff --git a/sidebar/konqsidebarplugin.cpp b/sidebar/konqsidebarplugin.cpp
index 5cd762e093..bcdd4c837f 100644
--- a/sidebar/konqsidebarplugin.cpp
+++ b/sidebar/konqsidebarplugin.cpp
@@ -89,8 +89,8 @@ bool KonqSidebarModule::isPasteEnabled() const
 void KonqSidebarModule::showPopupMenu(const QPoint &global, const KFileItemList &items,
                                       const KParts::OpenUrlArguments &args,
                                       const KParts::BrowserArguments &browserArgs,
-                                      KParts::BrowserExtension::PopupFlags flags,
-                                      const KParts::BrowserExtension::ActionGroupMap &actionGroups)
+                                      KParts::NavigationExtension::PopupFlags flags,
+                                      const KParts::NavigationExtension::ActionGroupMap &actionGroups)
 {
     emit popupMenu(this, global, items, args, browserArgs, flags, actionGroups);
 }
diff --git a/sidebar/konqsidebarplugin.h b/sidebar/konqsidebarplugin.h
index 8a533d5c66..67121575ed 100644
--- a/sidebar/konqsidebarplugin.h
+++ b/sidebar/konqsidebarplugin.h
@@ -11,7 +11,18 @@
 #include <QWidget>
 
 #include <kparts/part.h>
-#include <kparts/browserextension.h>
+
+//We don't use kf5compat.h to avoid linking with libkonq
+//TODO KF6: when removing compatibility with KF5, remove #if
+#include <QtGlobal>
+#if QT_VERSION_MAJOR < 6
+#include <KParts/BrowserExtension>
+namespace KParts {
+  typedef BrowserExtension NavigationExtension;
+}
+#else
+#include <KParts/NavigationExtension>
+#endif
 #include <kio/job.h>
 #include <kfileitem.h>
 
@@ -48,7 +59,7 @@ public:
 
     /**
      * Enable/disable a standard konqueror action (cut, copy, paste, print)
-     * See KParts::BrowserExtension::enableAction
+     * See KParts::NavigationExtension::enableAction
      */
     void enableCopy(bool enabled);
     void enableCut(bool enabled);
@@ -60,8 +71,8 @@ public:
     void showPopupMenu(const QPoint &global, const KFileItemList &items,
                        const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
                        const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments(),
-                       KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems,
-                       const KParts::BrowserExtension::ActionGroupMap &actionGroups = KParts::BrowserExtension::ActionGroupMap());
+                       KParts::NavigationExtension::PopupFlags flags = KParts::NavigationExtension::DefaultPopupItems,
+                       const KParts::NavigationExtension::ActionGroupMap &actionGroups = KParts::NavigationExtension::ActionGroupMap());
 
 protected:
     /**
@@ -109,8 +120,8 @@ Q_SIGNALS:
                    const QPoint &global, const KFileItemList &items,
                    const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
                    const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments(),
-                   KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems,
-                   const KParts::BrowserExtension::ActionGroupMap &actionGroups = KParts::BrowserExtension::ActionGroupMap());
+                   KParts::NavigationExtension::PopupFlags flags = KParts::NavigationExtension::DefaultPopupItems,
+                   const KParts::NavigationExtension::ActionGroupMap &actionGroups = KParts::NavigationExtension::ActionGroupMap());
 
     // TODO
     void submitFormRequest(const char *, const QString &, const QByteArray &, const QString &, const QString &, const QString &);
diff --git a/sidebar/sidebar_part.cpp b/sidebar/sidebar_part.cpp
index ea7c2412bb..169d887e1e 100644
--- a/sidebar/sidebar_part.cpp
+++ b/sidebar/sidebar_part.cpp
@@ -13,23 +13,30 @@
 #include <konq_events.h>
 #include <kacceleratormanager.h>
 #include <KLocalizedString>
+#include <KPluginFactory>
 
 K_PLUGIN_CLASS_WITH_JSON(KonqSidebarPart, "konq_sidebartng.json")
 
 KonqSidebarPart::KonqSidebarPart(QWidget *parentWidget, QObject *parent, const KPluginMetaData& metaData, const QVariantList &)
+#if QT_VERSION_MAJOR < 6
     : KParts::ReadOnlyPart(parent)
+#else
+    : KParts::ReadOnlyPart(parent, metaData)
+#endif
 {
+#if QT_VERSION_MAJOR < 6
     setMetaData(metaData);
+#endif
 
     QString currentProfile = parentWidget->window()->property("currentProfile").toString();
     if (currentProfile.isEmpty()) {
         currentProfile = "default";
     }
     m_widget = new Sidebar_Widget(parentWidget, this, currentProfile);
-    m_extension = new KonqSidebarBrowserExtension(this, m_widget);
+    m_extension = new KonqSidebarNavigationExtension(this, m_widget);
     connect(m_widget, &Sidebar_Widget::started, this, &KParts::ReadOnlyPart::started);
     connect(m_widget, &Sidebar_Widget::completed, this, QOverload<>::of(&KParts::ReadOnlyPart::completed));
-    connect(m_extension, &KonqSidebarBrowserExtension::addWebSideBar, m_widget, &Sidebar_Widget::addWebSideBar);
+    connect(m_extension, &KonqSidebarNavigationExtension::addWebSideBar, m_widget, &Sidebar_Widget::addWebSideBar);
     KAcceleratorManager::setNoAccel(m_widget);
     setWidget(m_widget);
 }
@@ -60,8 +67,8 @@ void KonqSidebarPart::customEvent(QEvent *ev)
 
 ////
 
-KonqSidebarBrowserExtension::KonqSidebarBrowserExtension(KonqSidebarPart *part, Sidebar_Widget *widget_)
-    : KParts::BrowserExtension(part), widget(widget_)
+KonqSidebarNavigationExtension::KonqSidebarNavigationExtension(KonqSidebarPart *part, Sidebar_Widget *widget_)
+    : KParts::NavigationExtension(part), widget(widget_)
 {
 }
 
diff --git a/sidebar/sidebar_part.h b/sidebar/sidebar_part.h
index dc4895c4bd..1f4faa2e80 100644
--- a/sidebar/sidebar_part.h
+++ b/sidebar/sidebar_part.h
@@ -8,18 +8,18 @@
 
 #include <kparts_version.h>
 #include <kparts/part.h>
-#include <kparts/browserextension.h>
+#include "kf5compat.h" //For NavigationExtension
 #include <QPointer>
 #include "sidebar_widget.h"
 
 class KonqSidebarPart;
 
-class KonqSidebarBrowserExtension : public KParts::BrowserExtension
+class KonqSidebarNavigationExtension : public KParts::NavigationExtension
 {
     Q_OBJECT
 public:
-    KonqSidebarBrowserExtension(KonqSidebarPart *part, Sidebar_Widget *widget);
-    ~KonqSidebarBrowserExtension() override {}
+    KonqSidebarNavigationExtension(KonqSidebarPart *part, Sidebar_Widget *widget);
+    ~KonqSidebarNavigationExtension() override {}
 
 protected:
     QPointer<Sidebar_Widget> widget;
@@ -81,7 +81,7 @@ protected:
     /**
      * This must be implemented by each part
      */
-    KonqSidebarBrowserExtension *m_extension;
+    KonqSidebarNavigationExtension *m_extension;
     bool openFile() override;
 
     void customEvent(QEvent *ev) override;
diff --git a/sidebar/sidebar_widget.cpp b/sidebar/sidebar_widget.cpp
index 83c165401d..12b55b3a62 100644
--- a/sidebar/sidebar_widget.cpp
+++ b/sidebar/sidebar_widget.cpp
@@ -52,6 +52,8 @@ void Sidebar_Widget::aboutToShowAddMenu()
         existingGroups.append(m_buttons[i].configFile->group("Desktop Entry"));
     }
 
+//TODO KF6: remove version check and replace with code using json
+#if QT_VERSION_MAJOR < 6
     // We need to instantiate all available plugins
     // And since the web module isn't in the default entries at all, we can't just collect
     // the plugins there.
@@ -80,6 +82,7 @@ void Sidebar_Widget::aboutToShowAddMenu()
     m_addMenu->addSeparator();
     m_addMenu->addAction(KStandardGuiItem::defaults().icon(), i18n("Restore All Removed Default Buttons"), this, &Sidebar_Widget::slotRestoreDeletedButtons);
     m_addMenu->addAction(KStandardGuiItem::defaults().icon(), i18n("Rollback to System Default"), this, &Sidebar_Widget::slotRollback);
+#endif
 }
 
 void Sidebar_Widget::triggeredAddMenu(QAction *action)
@@ -608,9 +611,9 @@ KonqSidebarModule *Sidebar_Widget::loadModule(QWidget *parent, const QString &de
     return plugin->createModule(parent, configGroup, desktopName, QVariant());
 }
 
-KParts::BrowserExtension *Sidebar_Widget::getExtension()
+KParts::NavigationExtension *Sidebar_Widget::getExtension()
 {
-    return KParts::BrowserExtension::childObject(m_partParent);
+    return KParts::NavigationExtension::childObject(m_partParent);
 }
 
 bool Sidebar_Widget::createView(ButtonInfo &buttonInfo)
@@ -855,8 +858,8 @@ void Sidebar_Widget::slotPopupMenu(KonqSidebarModule *module,
                                    const QPoint &global, const KFileItemList &items,
                                    const KParts::OpenUrlArguments &args,
                                    const KParts::BrowserArguments &browserArgs,
-                                   KParts::BrowserExtension::PopupFlags flags,
-                                   const KParts::BrowserExtension::ActionGroupMap &actionGroups)
+                                   KParts::NavigationExtension::PopupFlags flags,
+                                   const KParts::NavigationExtension::ActionGroupMap &actionGroups)
 {
     m_activeModule = module;
     doEnableActions();
diff --git a/sidebar/sidebar_widget.h b/sidebar/sidebar_widget.h
index a84e28590e..889a5513cc 100644
--- a/sidebar/sidebar_widget.h
+++ b/sidebar/sidebar_widget.h
@@ -26,7 +26,6 @@ class KonqSidebarPlugin;
 class QMenu;
 class QHBoxLayout;
 class QSplitter;
-class QStringList;
 
 class ButtonInfo
 {
@@ -76,7 +75,7 @@ public:
     bool openUrl(const QUrl &url);
     void stdAction(const char *handlestd);
 
-    KParts::BrowserExtension *getExtension();
+    KParts::NavigationExtension *getExtension();
     QSize sizeHint() const override;
 
 public Q_SLOTS:
@@ -166,8 +165,8 @@ private Q_SLOTS:
     void slotPopupMenu(KonqSidebarModule *, const QPoint &global, const KFileItemList &items,
                        const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
                        const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments(),
-                       KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems,
-                       const KParts::BrowserExtension::ActionGroupMap &actionGroups = KParts::BrowserExtension::ActionGroupMap());
+                       KParts::NavigationExtension::PopupFlags flags = KParts::NavigationExtension::DefaultPopupItems,
+                       const KParts::NavigationExtension::ActionGroupMap &actionGroups = KParts::NavigationExtension::ActionGroupMap());
 
     void slotStatResult(KJob *job);
 
diff --git a/sidebar/trees/bookmark_module/bookmark_module.cpp b/sidebar/trees/bookmark_module/bookmark_module.cpp
index d01ceabcac..e91b924792 100644
--- a/sidebar/trees/bookmark_module/bookmark_module.cpp
+++ b/sidebar/trees/bookmark_module/bookmark_module.cpp
@@ -17,6 +17,7 @@
 #include <QMenu>
 #include <QIcon>
 #include <QAction>
+#include <QStandardPaths>
 
 // KDE
 #include <k3bookmarkdrag.h>
@@ -38,7 +39,12 @@ KonqSidebarBookmarkModule::KonqSidebarBookmarkModule(KonqSidebarTree *parentTree
       m_topLevelItem(0L), m_ignoreOpenChange(true)
 {
     if (!s_bookmarkManager) {
+#if QT_VERSION_MAJOR < 6
         s_bookmarkManager = KBookmarkManager::userBookmarksManager();
+#else
+        const QString bookmarksFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/konqueror/bookmarks.xml");
+        s_manager = KBookmarkManager::managerForFile(bookmarksFile);
+#endif
     }
 
     // formats handled by K3BookmarkDrag:
diff --git a/sidebar/trees/dirtree_module/dirtree_item.cpp b/sidebar/trees/dirtree_module/dirtree_item.cpp
index 86ce0d5f56..9974a682cc 100644
--- a/sidebar/trees/dirtree_module/dirtree_item.cpp
+++ b/sidebar/trees/dirtree_module/dirtree_item.cpp
@@ -197,10 +197,10 @@ void KonqSidebarDirTreeItem::middleButtonClicked()
 
 void KonqSidebarDirTreeItem::rightButtonPressed()
 {
-    KParts::BrowserExtension::PopupFlags popupFlags = KParts::BrowserExtension::DefaultPopupItems
-            | KParts::BrowserExtension::ShowProperties
-            | KParts::BrowserExtension::ShowUrlOperations;
-    KParts::BrowserExtension::ActionGroupMap actionGroups;
+    KParts::NavigationExtension::PopupFlags popupFlags = KParts::NavigationExtension::DefaultPopupItems
+            | KParts::NavigationExtension::ShowProperties
+            | KParts::NavigationExtension::ShowUrlOperations;
+    KParts::NavigationExtension::ActionGroupMap actionGroups;
     QList<QAction *> editActions;
     KActionCollection *actionCollection = tree()->actionCollection();
 
@@ -213,7 +213,7 @@ void KonqSidebarDirTreeItem::rightButtonPressed()
     bool supportsDeleting = capabilities.supportsDeleting();
     bool supportsMoving = capabilities.supportsMoving();
     if (!supportsDeleting) {
-        popupFlags |= KParts::BrowserExtension::NoDeletion;
+        popupFlags |= KParts::NavigationExtension::NoDeletion;
     }
 
     Q_ASSERT(actionCollection->action("rename"));
@@ -249,7 +249,7 @@ void KonqSidebarDirTreeItem::rightButtonPressed()
     // Normally KonqPopupMenu only shows the "Create new" submenu in the current view
     // since otherwise the created file would not be visible.
     // But in treeview mode we should allow it.
-    popupFlags |= KParts::BrowserExtension::ShowCreateDirectory;
+    popupFlags |= KParts::NavigationExtension::ShowCreateDirectory;
 
     actionGroups.insert("editactions", editActions);
 
diff --git a/sidebar/trees/konq_sidebartree.h b/sidebar/trees/konq_sidebartree.h
index 553d57542f..20f0378f83 100644
--- a/sidebar/trees/konq_sidebartree.h
+++ b/sidebar/trees/konq_sidebartree.h
@@ -9,7 +9,7 @@
 #define KONQ_SIDEBARTREE_H
 
 #include <k3listview.h>
-#include <kparts/browserextension.h>
+#include "kf5compat.h" //For NavigationExtension
 #include "konq_sidebartreetoplevelitem.h"
 #include <QMap>
 #include <QPoint>
diff --git a/sidebar/web_module/web_module.cpp b/sidebar/web_module/web_module.cpp
index cb9073279d..efdb9f6817 100644
--- a/sidebar/web_module/web_module.cpp
+++ b/sidebar/web_module/web_module.cpp
@@ -16,7 +16,7 @@
 #include <kglobal.h>
 #include <KLocalizedString>
 #include <kpluginfactory.h>
-#include <kparts/browserextension.h>
+#include "kf5compat.h" //For NavigationExtension
 #include <knameandurlinputdialog.h>
 
 #include <QHBoxLayout>
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a9ae13ab56..504c3cf4af 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -49,6 +49,8 @@ generate_export_header(konquerorprivate BASE_NAME konquerorprivate EXPORT_FILE_N
 
 ########### konqueror ###############
 
+#TODO KF6: rename konqueror_KDEINIT_SRCS as konqueror_SRCS
+
 set(konqueror_KDEINIT_SRCS
    konqapplication.cpp
    konqdebug.cpp
@@ -107,12 +109,20 @@ qt_add_dbus_interface(konqueror_KDEINIT_SRCS org.kde.Konqueror.SessionManager.xm
 
 file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../pics/*-apps-konqueror.png")
 ecm_add_app_icon(konqueror_KDEINIT_SRCS ICONS ${ICONS_SRCS})
-if (KF_MAJOR_VERSION STREQUAL "6")
-   kf6_add_kdeinit_executable(konqueror ${konqueror_KDEINIT_SRCS} konqmain.cpp)
-else()
+
+#TODO KF6: when removing compatibility with KF5, remove konqueror_internal_lib_target and use konqueror_internal_lib
+if (KF_MAJOR_VERSION STRLESS "6")
    kf5_add_kdeinit_executable(konqueror ${konqueror_KDEINIT_SRCS} konqmain.cpp)
+   add_library(konqueror_internal_lib ALIAS kdeinit_konqueror)
+   set(konqueror_internal_lib_target kdeinit_konqueror)
+else()
+#We need a library because some tests link to it
+   add_library(konqueror_internal_lib ${konqueror_KDEINIT_SRCS})
+   add_executable(konqueror konqmain.cpp)
+   target_link_libraries(konqueror konqueror_internal_lib)
+   set(konqueror_internal_lib_target konqueror_internal_lib)
 endif()
-target_link_libraries(kdeinit_konqueror
+target_link_libraries(${konqueror_internal_lib_target}
    konquerorprivate
    KF${KF_MAJOR_VERSION}::Archive
    KF${KF_MAJOR_VERSION}::KCMUtils
@@ -122,16 +132,17 @@ target_link_libraries(kdeinit_konqueror
    KF${KF_MAJOR_VERSION}::Crash
    KF${KF_MAJOR_VERSION}::WindowSystem
    KF${KF_MAJOR_VERSION}::SonnetUi
+   KF${KF_MAJOR_VERSION}::Bookmarks
 )
 
-if (KFActivities_FOUND)
-  target_link_libraries(kdeinit_konqueror KFActivities)
-  target_compile_definitions(kdeinit_konqueror PUBLIC KActivities_FOUND)
+if (KF${KF_MAJOR_VERSION}Activities_FOUND)
+  target_link_libraries(${konqueror_internal_lib_target} KF${KF_MAJOR_VERSION}::Activities)
+  target_compile_definitions(${konqueror_internal_lib_target} PUBLIC KActivities_FOUND)
 endif ()
 
-if (NOT WIN32)
+if (NOT WIN32 AND (QT_MAJOR_VERSION STRLESS 6))
     install(TARGETS kdeinit_konqueror  ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
-endif (NOT WIN32)
+endif ()
 install(TARGETS konqueror ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
 
 ########### install files ###############
diff --git a/src/konqbookmarkmenu.cpp b/src/konqbookmarkmenu.cpp
index a5813cf07a..081be446db 100644
--- a/src/konqbookmarkmenu.cpp
+++ b/src/konqbookmarkmenu.cpp
@@ -1,8 +1,8 @@
 /* This file is part of the KDE project
-    SPDX-FileCopyrightText: 1998, 1999 Torben Weis <weis at kde.org>
-    SPDX-FileCopyrightText: 2006 Daniel Teske <teske at squorn.de>
+SPDX-FileCopyrightText: 1998, 1999 Torben Weis <weis at kde.org>
+SPDX-FileCopyrightText: 2006 Daniel Teske <teske at squorn.de>
 
-    SPDX-License-Identifier: LGPL-2.0-or-later
+SPDX-License-Identifier: LGPL-2.0-or-later
 */
 
 #include "konqbookmarkmenu.h"
@@ -20,11 +20,12 @@
 
 #include "kbookmarkmanager.h"
 #include "konqpixmapprovider.h"
+#include "libkonq_utils.h"
 
 using namespace Konqueror;
 
 KonqBookmarkContextMenu::KonqBookmarkContextMenu(const KBookmark &bm, KBookmarkManager *mgr, KBookmarkOwner *owner)
-    : KBookmarkContextMenu(bm, mgr, owner)
+: KBookmarkContextMenu(bm, mgr, owner)
 {
 }
 
@@ -34,49 +35,49 @@ KonqBookmarkContextMenu::~KonqBookmarkContextMenu()
 
 void KonqBookmarkContextMenu::addActions()
 {
-    KConfigGroup config = KSharedConfig::openConfig(QStringLiteral("kbookmarkrc"), KConfig::NoGlobals)->group("Bookmarks");
-    bool filteredToolbar = config.readEntry("FilteredToolbar", false);
+KConfigGroup config = KSharedConfig::openConfig(QStringLiteral("kbookmarkrc"), KConfig::NoGlobals)->group("Bookmarks");
+bool filteredToolbar = config.readEntry("FilteredToolbar", false);
 
-    if (bookmark().isGroup()) {
-        addOpenFolderInTabs();
-        addBookmark();
+if (bookmark().isGroup()) {
+    addOpenFolderInTabs();
+    addBookmark();
 
-        if (filteredToolbar) {
-            QString text = bookmark().showInToolbar() ? tr("Hide in toolbar") : tr("Show in toolbar");
-            addAction(text, this, &KonqBookmarkContextMenu::toggleShowInToolbar);
-        }
+    if (filteredToolbar) {
+        QString text = bookmark().showInToolbar() ? tr("Hide in toolbar") : tr("Show in toolbar");
+        addAction(text, this, &KonqBookmarkContextMenu::toggleShowInToolbar);
+    }
 
-        addFolderActions();
-    } else {
-        if (owner()) {
-            addAction(QIcon::fromTheme(QStringLiteral("window-new")), tr("Open in New Window"), this, &KonqBookmarkContextMenu::openInNewWindow);
-            addAction(QIcon::fromTheme(QStringLiteral("tab-new")), tr("Open in New Tab"), this, &KonqBookmarkContextMenu::openInNewTab);
-        }
-        addBookmark();
-
-        if (filteredToolbar) {
-            QString text = bookmark().showInToolbar() ? tr("Hide in toolbar") : tr("Show in toolbar");
-            addAction(text, this, &KonqBookmarkContextMenu::toggleShowInToolbar);
-        }
-
-        addBookmarkActions();
+    addFolderActions();
+} else {
+    if (owner()) {
+        addAction(QIcon::fromTheme(QStringLiteral("window-new")), tr("Open in New Window"), this, &KonqBookmarkContextMenu::openInNewWindow);
+        addAction(QIcon::fromTheme(QStringLiteral("tab-new")), tr("Open in New Tab"), this, &KonqBookmarkContextMenu::openInNewTab);
+    }
+    addBookmark();
+
+    if (filteredToolbar) {
+        QString text = bookmark().showInToolbar() ? tr("Hide in toolbar") : tr("Show in toolbar");
+        addAction(text, this, &KonqBookmarkContextMenu::toggleShowInToolbar);
     }
+
+    addBookmarkActions();
+}
 }
 
 void KonqBookmarkContextMenu::toggleShowInToolbar()
 {
-    bookmark().setShowInToolbar(!bookmark().showInToolbar());
-    manager()->emitChanged(bookmark().parentGroup());
+bookmark().setShowInToolbar(!bookmark().showInToolbar());
+manager()->emitChanged(bookmark().parentGroup());
 }
 
 void KonqBookmarkContextMenu::openInNewTab()
 {
-    owner()->openInNewTab(bookmark());
+owner()->openInNewTab(bookmark());
 }
 
 void KonqBookmarkContextMenu::openInNewWindow()
 {
-    owner()->openInNewWindow(bookmark());
+owner()->openInNewWindow(bookmark());
 }
 
 /******************************/
diff --git a/src/konqbookmarkmenu.h b/src/konqbookmarkmenu.h
index 1d8bfcfca5..55edffc16d 100644
--- a/src/konqbookmarkmenu.h
+++ b/src/konqbookmarkmenu.h
@@ -38,6 +38,9 @@ public:
         : KBookmarkMenu(mgr, owner, parentMenu->menu())
     {
         m_actionCollection = collec;
+#if QT_VERSION_MAJOR >= 6
+        setBrowserMode(true);
+#endif
     }
     ~KonqBookmarkMenu() override
     {}
@@ -55,6 +58,10 @@ protected:
     void refill() override;
     QAction *actionForBookmark(const KBookmark &bm) override;
     QMenu *contextMenu(QAction *action) override;
+    void fillDynamicBookmarks();
+#if QT_VERSION_MAJOR > 5
+        KActionCollection *m_actionCollection = nullptr;
+#endif
 };
 
 class KonqBookmarkContextMenu : public KBookmarkContextMenu
diff --git a/src/konqcombo.cpp b/src/konqcombo.cpp
index 3600376e84..51eeb95d3a 100644
--- a/src/konqcombo.cpp
+++ b/src/konqcombo.cpp
@@ -112,7 +112,7 @@ KonqCombo::KonqCombo(QWidget *parent)
     setLayoutDirection(Qt::LeftToRight);
     setInsertPolicy(NoInsert);
     setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
-    setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
+    setSizeAdjustPolicy(QComboBox::AdjustToContents);
 
     Q_ASSERT(s_config);
 
@@ -377,7 +377,7 @@ void KonqCombo::slotSetIcon(int index)
 void KonqCombo::getStyleOption(QStyleOptionComboBox *comboOpt)
 {
     //We only use this for querying metrics,so it's rough..
-    comboOpt->init(this);
+    comboOpt->initFrom(this);
     comboOpt->editable = isEditable();
     comboOpt->frame    = hasFrame();
     comboOpt->iconSize = iconSize();
@@ -735,7 +735,9 @@ QSize KonqComboItemDelegate::sizeHint(const QStyleOptionViewItem &option,
     QSize size(1, qMax(option.fontMetrics.lineSpacing(), option.decorationSize.height()));
     size.rheight() += vMargin * 2;
 
-    return size.expandedTo(QApplication::globalStrut());
+    //TODO KF6: QApplication::globalStrut doesn't exist in Qt6, so we're treating as
+    //if it were QSize(0,0). Check whether the assumption is correct
+    return size;
 }
 
 void KonqComboItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
diff --git a/src/konqextensionmanager.cpp b/src/konqextensionmanager.cpp
index 2943d3b640..8cf5e22db5 100644
--- a/src/konqextensionmanager.cpp
+++ b/src/konqextensionmanager.cpp
@@ -26,7 +26,6 @@
 #include <KLocalizedString>
 #include <KPluginWidget>
 #include <KSharedConfig>
-#include <ksettings/dispatcher.h>
 #include <kstandardguiitem.h>
 
 // Local
diff --git a/src/konqguiclients.cpp b/src/konqguiclients.cpp
index 2c8f7754d5..affc846e93 100644
--- a/src/konqguiclients.cpp
+++ b/src/konqguiclients.cpp
@@ -13,7 +13,6 @@
 #include <QIcon>
 #include <kiconloader.h>
 #include <KLocalizedString>
-#include <kservicetypetrader.h>
 
 // Local
 #include "konqview.h"
diff --git a/src/konqhistoryview.cpp b/src/konqhistoryview.cpp
index 07c4d73ba1..52c898f494 100644
--- a/src/konqhistoryview.cpp
+++ b/src/konqhistoryview.cpp
@@ -23,6 +23,7 @@
 #include <QTimer>
 #include <QTreeView>
 #include <QVBoxLayout>
+#include <QActionGroup>
 
 #include <kactioncollection.h>
 #include "konqdebug.h"
diff --git a/src/konqmainwindow.cpp b/src/konqmainwindow.cpp
index 88248c50db..602c788587 100644
--- a/src/konqmainwindow.cpp
+++ b/src/konqmainwindow.cpp
@@ -48,6 +48,7 @@
 #include <konqsettings.h>
 #include <konq_spellcheckingconfigurationdispatcher.h>
 #include <kcmutils_version.h>
+#include "libkonq_utils.h"
 
 #include <kwidgetsaddons_version.h>
 #include <kxmlgui_version.h>
@@ -88,7 +89,6 @@
 #endif
 
 #include <QKeyEvent>
-#include <QByteRef>
 #include <QPixmap>
 #include <QLineEdit>
 #include <QNetworkProxy>
@@ -118,7 +118,6 @@
 #include <kurlcompletion.h>
 #include <kurlrequesterdialog.h>
 #include <kurlrequester.h>
-#include <kmimetypetrader.h>
 #include <KJobWidgets>
 #include <KLocalizedString>
 #include <QIcon>
@@ -130,7 +129,6 @@
 #include <KIO/Job>
 #include <KIO/FileUndoManager>
 #include <KParts/OpenUrlEvent>
-#include <KParts/BrowserRun>
 #include <KCompletionMatches>
 #include <kacceleratormanager.h>
 #include <kuser.h>
@@ -158,6 +156,7 @@
 
 #include <QMetaObject>
 #include <QMetaMethod>
+#include <QActionGroup>
 
 template class QList<QPixmap *>;
 template class QList<KToggleAction *>;
@@ -240,10 +239,12 @@ KonqMainWindow::KonqMainWindow(const QUrl &initialURL)
 
     // init history-manager, load history, get completion object
     if (!s_pCompletion) {
-        s_bookmarkManager = KBookmarkManager::userBookmarksManager();
+        s_bookmarkManager = Konq::userBookmarksManager();
 
+#if QT_VERSION_MAJOR < 6
         // let the KBookmarkManager know that we are a browser, equals to "keditbookmarks --browser"
         s_bookmarkManager->setEditorOptions(QStringLiteral("konqueror"), true);
+#endif
 
         KonqHistoryManager *mgr = new KonqHistoryManager(s_bookmarkManager);
         s_pCompletion = mgr->completionObject();
@@ -546,9 +547,9 @@ void KonqMainWindow::openUrl(KonqView *_view, const QUrl &_url,
         // URL filtering catches this case before hand, and in cases without filtering
         // (e.g. HTML link), the url is empty here, not invalid.
         // But just to be safe, let's keep this code path
-        url = KParts::BrowserRun::makeErrorUrl(KIO::ERR_MALFORMED_URL, url.url(), url);
+        url = Konq::makeErrorUrl(KIO::ERR_MALFORMED_URL, url.url(), url);
     } else if (!KProtocolInfo::isKnownProtocol(url) && !KonqUrl::hasKonqScheme(url) && !s_validProtocols.contains(url.scheme())) {
-        url = KParts::BrowserRun::makeErrorUrl(KIO::ERR_UNSUPPORTED_PROTOCOL, url.scheme(), url);
+        url = Konq::makeErrorUrl(KIO::ERR_UNSUPPORTED_PROTOCOL, url.scheme(), url);
     }
 
     const QString nameFilter = detectNameFilter(url);
@@ -795,25 +796,27 @@ bool KonqMainWindow::openView(QString mimeType, const QUrl &_url, KonqView *chil
     // If the protocol doesn't support writing (e.g. HTTP) then we might want to save instead of just embedding.
     // So (if embedding would succeed, hence the checks above) we ask the user
     // Otherwise the user will get asked 'open or save' in openUrl anyway.
-    if (!forceAutoEmbed && !KProtocolManager::supportsWriting(url)) {
-        QString suggestedFileName;
-        UrlLoader *loader = childView ? childView->urlLoader() : nullptr;
-        if (loader) {
-            suggestedFileName = loader->suggestedFileName();
-        }
-
-        BrowserOpenOrSaveQuestion dlg(this, url, mimeType);
-        dlg.setSuggestedFileName(suggestedFileName);
-        const BrowserOpenOrSaveQuestion::Result res = dlg.askEmbedOrSave();
-        if (res == BrowserOpenOrSaveQuestion::Embed) {
-            forceAutoEmbed = true;
-        } else if (res == BrowserOpenOrSaveQuestion::Cancel) {
-            return true;    // handled, don't do anything else
-        } else { // Save
-            KParts::BrowserRun::saveUrl(url, suggestedFileName, this, req.args);
-            return true; // handled
-        }
-    }
+    //TODO KF6: remove commented code below. This shouldn't be needed, since UrlLoader
+    //already asked the user whether to save or to embed
+    // if (!forceAutoEmbed && !KProtocolManager::supportsWriting(url)) {
+    //     QString suggestedFileName;
+    //     UrlLoader *loader = childView ? childView->urlLoader() : nullptr;
+    //     if (loader) {
+    //         suggestedFileName = loader->suggestedFileName();
+    //     }
+    //
+    //     BrowserOpenOrSaveQuestion dlg(this, url, mimeType);
+    //     dlg.setSuggestedFileName(suggestedFileName);
+    //     const BrowserOpenOrSaveQuestion::Result res = dlg.askEmbedOrSave();
+    //     if (res == BrowserOpenOrSaveQuestion::Embed) {
+    //         forceAutoEmbed = true;
+    //     } else if (res == BrowserOpenOrSaveQuestion::Cancel) {
+    //         return true;    // handled, don't do anything else
+    //     } else { // Save
+    //         KParts::BrowserRun::saveUrl(url, suggestedFileName, this, req.args);
+    //         return true; // handled
+    //     }
+    // }
 
     bool ok = true;
     if (!childView) {
@@ -1096,7 +1099,7 @@ void KonqMainWindow::slotCreateNewWindow(const QUrl &url, KonqOpenURLRequest &re
     KonqMainWindow *mainWindow = nullptr;
     if (!req.browserArgs.frameName.isEmpty() && req.browserArgs.frameName.toLower() != QLatin1String("_blank")) {
         KParts::ReadOnlyPart *ro_part = nullptr;
-        KParts::BrowserExtension *be = ::qobject_cast<KParts::BrowserExtension *>(sender());
+        KParts::NavigationExtension *be = ::qobject_cast<KParts::NavigationExtension *>(sender());
         if (be) {
             ro_part = ::qobject_cast<KParts::ReadOnlyPart *>(be->parent());
         }
@@ -1152,7 +1155,7 @@ void KonqMainWindow::slotCreateNewWindow(const QUrl &url, KonqOpenURLRequest &re
 
         // Raise the current window if the request to create the tab came from a popup
         // window, e.g. clicking on links with target = "_blank" in popup windows.
-        KParts::BrowserExtension *be = qobject_cast<KParts::BrowserExtension *>(sender());
+        KParts::NavigationExtension *be = qobject_cast<KParts::NavigationExtension *>(sender());
         KonqView *view = (be ? childView(qobject_cast<KParts::ReadOnlyPart *>(be->parent())) : nullptr);
         KonqMainWindow *window = view ? view->mainWindow() : nullptr;
         if (window && window->m_isPopupWithProxyWindow && !m_isPopupWithProxyWindow) {
@@ -1674,7 +1677,7 @@ void KonqMainWindow::slotConfigure(const QString startingModule)
         KPluginMetaData fileTypesData(QStringLiteral("plasma/kcms/systemsettings_qwidgets/kcm_filetypes"));
         if (!fileTypesData.isValid()) {
             QString desktopFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kservices5/filetypes.desktop"));
-#if KCMUTILS_VERSION_MAJOR < 6
+#if QT_VERSION_MAJOR < 6
             fileTypesData = KPluginMetaData::fromDesktopFile(desktopFile, {QStringLiteral("kcmodule.desktop")});
 #endif
         }
@@ -1855,7 +1858,7 @@ void KonqMainWindow::slotPartActivated(KParts::Part *part)
         }
     }
 
-    KParts::BrowserExtension *ext = nullptr;
+    KParts::NavigationExtension *ext = nullptr;
 
     if (oldView) {
         ext = oldView->browserExtension();
@@ -1887,9 +1890,13 @@ void KonqMainWindow::slotPartActivated(KParts::Part *part)
         qCDebug(KONQUEROR_LOG) << "No Browser Extension for the new part";
         // Disable all browser-extension actions
 
-        KParts::BrowserExtension::ActionSlotMap *actionSlotMap = KParts::BrowserExtension::actionSlotMapPtr();
-        KParts::BrowserExtension::ActionSlotMap::ConstIterator it = actionSlotMap->constBegin();
-        const KParts::BrowserExtension::ActionSlotMap::ConstIterator itEnd = actionSlotMap->constEnd();
+#if QT_VERSION_MAJOR < 6
+        KParts::NavigationExtension::ActionSlotMap *actionSlotMap = KParts::NavigationExtension::actionSlotMapPtr();
+#else
+        KParts::NavigationExtension::ActionSlotMap *actionSlotMap = KParts::NavigationExtension::actionSlotMap();
+#endif
+        KParts::NavigationExtension::ActionSlotMap::ConstIterator it = actionSlotMap->constBegin();
+        const KParts::NavigationExtension::ActionSlotMap::ConstIterator itEnd = actionSlotMap->constEnd();
         for (; it != itEnd; ++it) {
             QAction *act = actionCollection()->action(QString::fromLatin1(it.key()));
             Q_ASSERT(act);
@@ -2483,7 +2490,7 @@ void KonqMainWindow::slotActivatePrevTab()
 
 void KonqMainWindow::slotActivateTab()
 {
-    m_pViewManager->activateTab(sender()->objectName().rightRef(2).toInt() - 1);
+    m_pViewManager->activateTab(QStringView{sender()->objectName()}.right(2).toInt() - 1);
 }
 
 void KonqMainWindow::slotDumpDebugInfo()
@@ -3021,7 +3028,7 @@ bool KonqMainWindow::eventFilter(QObject *obj, QEvent *ev)
             return KParts::MainWindow::eventFilter(obj, ev);
         }
 
-        KParts::BrowserExtension *ext = nullptr;
+        KParts::NavigationExtension *ext = nullptr;
         if (m_currentView) {
             ext = m_currentView->browserExtension();
         }
@@ -3328,7 +3335,7 @@ void KonqMainWindow::initActions()
     action->setIcon(QIcon::fromTheme(QStringLiteral("window-duplicate")));
     action->setText(i18n("&Duplicate Window"));
     connect(action, &QAction::triggered, this, &KonqMainWindow::slotDuplicateWindow);
-    actionCollection()->setDefaultShortcut(action, Qt::CTRL+Qt::SHIFT+Qt::Key_D);
+    actionCollection()->setDefaultShortcut(action, Qt::CTRL | Qt::SHIFT | Qt::Key_D);
     action = actionCollection()->addAction(QStringLiteral("sendURL"));
     action->setIcon(QIcon::fromTheme(QStringLiteral("mail-message-new")));
     action->setText(i18n("Send &Link Address..."));
@@ -3340,7 +3347,7 @@ void KonqMainWindow::initActions()
     action = actionCollection()->addAction(QStringLiteral("open_location"));
     action->setIcon(QIcon::fromTheme(QStringLiteral("document-open-remote")));
     action->setText(i18n("&Open Location"));
-    actionCollection()->setDefaultShortcut(action, Qt::ALT+Qt::Key_O);
+    actionCollection()->setDefaultShortcut(action, Qt::ALT | Qt::Key_O);
     connect(action, &QAction::triggered, this, &KonqMainWindow::slotOpenLocation);
 
     action = actionCollection()->addAction(QStringLiteral("open_file"));
@@ -3429,7 +3436,7 @@ void KonqMainWindow::initActions()
     action->setIcon(QIcon::fromTheme(QStringLiteral("view-history")));
     // Ctrl+Shift+H, shortcut from firefox
     // TODO: and Ctrl+H should open the sidebar history module
-    actionCollection()->setDefaultShortcut(action, Qt::CTRL+Qt::SHIFT+Qt::Key_H);
+    actionCollection()->setDefaultShortcut(action, Qt::CTRL | Qt::SHIFT | Qt::Key_H);
     action->setText(i18nc("@action:inmenu Go", "Show History"));
     connect(action, &QAction::triggered, this, &KonqMainWindow::slotGoHistory);
 
@@ -3455,41 +3462,41 @@ void KonqMainWindow::initActions()
     m_paSplitViewHor->setIcon(QIcon::fromTheme(QStringLiteral("view-split-left-right")));
     m_paSplitViewHor->setText(i18n("Split View &Left/Right"));
     connect(m_paSplitViewHor, &QAction::triggered, this, &KonqMainWindow::slotSplitViewHorizontal);
-    actionCollection()->setDefaultShortcut(m_paSplitViewHor, Qt::CTRL+Qt::SHIFT+Qt::Key_L);
+    actionCollection()->setDefaultShortcut(m_paSplitViewHor, Qt::CTRL | Qt::SHIFT | Qt::Key_L);
     m_paSplitViewVer = actionCollection()->addAction(QStringLiteral("splitviewv"));
     m_paSplitViewVer->setIcon(QIcon::fromTheme(QStringLiteral("view-split-top-bottom")));
     m_paSplitViewVer->setText(i18n("Split View &Top/Bottom"));
     connect(m_paSplitViewVer, &QAction::triggered, this, &KonqMainWindow::slotSplitViewVertical);
-    actionCollection()->setDefaultShortcut(m_paSplitViewVer, Qt::CTRL+Qt::SHIFT+Qt::Key_T);
+    actionCollection()->setDefaultShortcut(m_paSplitViewVer, Qt::CTRL | Qt::SHIFT | Qt::Key_T);
     m_paAddTab = actionCollection()->addAction(QStringLiteral("newtab"));
     m_paAddTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
     m_paAddTab->setText(i18n("&New Tab"));
     connect(m_paAddTab, &QAction::triggered, this, &KonqMainWindow::slotAddTab);
     QList<QKeySequence> addTabShortcuts;
-    addTabShortcuts.append(QKeySequence(Qt::CTRL+Qt::Key_T));
-    addTabShortcuts.append(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_N));
+    addTabShortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_T));
+    addTabShortcuts.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
     actionCollection()->setDefaultShortcuts(m_paAddTab, addTabShortcuts);
 
     m_paDuplicateTab = actionCollection()->addAction(QStringLiteral("duplicatecurrenttab"));
     m_paDuplicateTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-duplicate")));
     m_paDuplicateTab->setText(i18n("&Duplicate Current Tab"));
     connect(m_paDuplicateTab, &QAction::triggered, this, &KonqMainWindow::slotDuplicateTab);
-    actionCollection()->setDefaultShortcut(m_paDuplicateTab, Qt::CTRL+Qt::Key_D);
+    actionCollection()->setDefaultShortcut(m_paDuplicateTab, Qt::CTRL | Qt::Key_D);
     m_paBreakOffTab = actionCollection()->addAction(QStringLiteral("breakoffcurrenttab"));
     m_paBreakOffTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-detach")));
     m_paBreakOffTab->setText(i18n("Detach Current Tab"));
     connect(m_paBreakOffTab, &QAction::triggered, this, &KonqMainWindow::slotBreakOffTab);
-    actionCollection()->setDefaultShortcut(m_paBreakOffTab, Qt::CTRL+Qt::SHIFT+Qt::Key_B);
+    actionCollection()->setDefaultShortcut(m_paBreakOffTab, Qt::CTRL | Qt::SHIFT | Qt::Key_B);
     m_paRemoveView = actionCollection()->addAction(QStringLiteral("removeview"));
     m_paRemoveView->setIcon(QIcon::fromTheme(QStringLiteral("view-close")));
     m_paRemoveView->setText(i18n("&Close Active View"));
     connect(m_paRemoveView, &QAction::triggered, this, &KonqMainWindow::slotRemoveView);
-    actionCollection()->setDefaultShortcut(m_paRemoveView, Qt::CTRL+Qt::SHIFT+Qt::Key_W);
+    actionCollection()->setDefaultShortcut(m_paRemoveView, Qt::CTRL | Qt::SHIFT | Qt::Key_W);
     m_paRemoveTab = actionCollection()->addAction(QStringLiteral("removecurrenttab"));
     m_paRemoveTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-close")));
     m_paRemoveTab->setText(i18n("Close Current Tab"));
-    connect(m_paRemoveTab, &QAction::triggered, this, &KonqMainWindow::slotRemoveTab, Qt::QueuedConnection /* exit Ctrl+W handler before deleting */);
-    actionCollection()->setDefaultShortcut(m_paRemoveTab, Qt::CTRL+Qt::Key_W);
+    connect(m_paRemoveTab, &QAction::triggered, this, &KonqMainWindow::slotRemoveTab, Qt::QueuedConnection /* exit Ctrl | W handler before deleting */);
+    actionCollection()->setDefaultShortcut(m_paRemoveTab, Qt::CTRL | Qt::Key_W);
     m_paRemoveTab->setAutoRepeat(false);
     m_paRemoveOtherTabs = actionCollection()->addAction(QStringLiteral("removeothertabs"));
     m_paRemoveOtherTabs->setIcon(QIcon::fromTheme(QStringLiteral("tab-close-other")));
@@ -3516,12 +3523,12 @@ void KonqMainWindow::initActions()
     m_paMoveTabLeft->setText(i18n("Move Tab Left"));
     m_paMoveTabLeft->setIcon(QIcon::fromTheme(QStringLiteral("arrow-left")));
     connect(m_paMoveTabLeft, &QAction::triggered, this, &KonqMainWindow::slotMoveTabLeft);
-    actionCollection()->setDefaultShortcut(m_paMoveTabLeft, Qt::CTRL+Qt::SHIFT+Qt::Key_Left);
+    actionCollection()->setDefaultShortcut(m_paMoveTabLeft, Qt::CTRL | Qt::SHIFT | Qt::Key_Left);
     m_paMoveTabRight = actionCollection()->addAction(QStringLiteral("tab_move_right"));
     m_paMoveTabRight->setText(i18n("Move Tab Right"));
     m_paMoveTabRight->setIcon(QIcon::fromTheme(QStringLiteral("arrow-right")));
     connect(m_paMoveTabRight, &QAction::triggered, this, &KonqMainWindow::slotMoveTabRight);
-    actionCollection()->setDefaultShortcut(m_paMoveTabRight, Qt::CTRL+Qt::SHIFT+Qt::Key_Right);
+    actionCollection()->setDefaultShortcut(m_paMoveTabRight, Qt::CTRL | Qt::SHIFT | Qt::Key_Right);
 
 #ifndef NDEBUG
     action = actionCollection()->addAction(QStringLiteral("dumpdebuginfo"));
@@ -3551,7 +3558,7 @@ void KonqMainWindow::initActions()
     m_paReloadAllTabs->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh-all")));
     m_paReloadAllTabs->setText(i18n("&Reload All Tabs"));
     connect(m_paReloadAllTabs, &QAction::triggered, this, &KonqMainWindow::slotReloadAllTabs);
-    actionCollection()->setDefaultShortcut(m_paReloadAllTabs, Qt::SHIFT+Qt::Key_F5);
+    actionCollection()->setDefaultShortcut(m_paReloadAllTabs, Qt::SHIFT | Qt::Key_F5);
     // "Forced"/ "Hard" reload action - re-downloads all e.g. images even if a cached
     // version already exists.
     m_paForceReload = actionCollection()->addAction(QStringLiteral("hard_reload"));
@@ -3560,8 +3567,8 @@ void KonqMainWindow::initActions()
     m_paForceReload->setText(i18n("&Force Reload"));
     connect(m_paForceReload, &QAction::triggered, this, &KonqMainWindow::slotForceReload);
     QList<QKeySequence> forceReloadShortcuts;
-    forceReloadShortcuts.append(QKeySequence(Qt::CTRL+Qt::Key_F5));
-    forceReloadShortcuts.append(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_R));
+    forceReloadShortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_F5));
+    forceReloadShortcuts.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_R));
     actionCollection()->setDefaultShortcuts(m_paForceReload, forceReloadShortcuts);
 
     m_paUndo = KStandardAction::undo(m_pUndoManager, SLOT(undo()), this);
@@ -3574,7 +3581,7 @@ void KonqMainWindow::initActions()
     actionCollection()->addAction(QStringLiteral("cut"), m_paCut);
 
     QList<QKeySequence> cutShortcuts(m_paCut->shortcuts());
-    cutShortcuts.removeAll(QKeySequence(Qt::SHIFT+Qt::Key_Delete)); // used for deleting files
+    cutShortcuts.removeAll(QKeySequence(Qt::SHIFT | Qt::Key_Delete)); // used for deleting files
     actionCollection()->setDefaultShortcuts(m_paCut, cutShortcuts);
 
     m_paCopy = KStandardAction::copy(nullptr, nullptr, this);
@@ -3617,7 +3624,7 @@ void KonqMainWindow::initActions()
     QAction *clearLocation = actionCollection()->addAction(QStringLiteral("clear_location"));
     clearLocation->setIcon(QIcon::fromTheme(QApplication::isRightToLeft() ? "edit-clear-locationbar-rtl" : "edit-clear-locationbar-ltr"));
     clearLocation->setText(i18n("Clear Location Bar"));
-    actionCollection()->setDefaultShortcut(clearLocation, Qt::CTRL+Qt::Key_L);
+    actionCollection()->setDefaultShortcut(clearLocation, Qt::CTRL | Qt::Key_L);
     connect(clearLocation, SIGNAL(triggered()),
             SLOT(slotClearLocationBar()));
     clearLocation->setWhatsThis(i18n("<html>Clear Location bar<br /><br />"
@@ -3733,7 +3740,7 @@ void KonqMainWindow::initActions()
     m_paLinkView->setStatusTip(i18n("Sets the view as 'linked'. A linked view follows folder changes made in other linked views."));
 
     m_paShowDeveloperTools = actionCollection()->addAction("inspect_page", this, &KonqMainWindow::inspectCurrentPage);
-    actionCollection()->setDefaultShortcut(m_paShowDeveloperTools, QKeySequence("Ctrl+Shift+I"));
+    actionCollection()->setDefaultShortcut(m_paShowDeveloperTools, QKeySequence("Ctrl | Shift | I"));
     m_paShowDeveloperTools->setText(i18n("&Inspect Current Page"));
     m_paShowDeveloperTools->setWhatsThis(i18n("<html>Shows the developer tools for the current page<br/><br/>The current view is split in two and the developer tools are displayed in the second half"));
     m_paShowDeveloperTools->setStatusTip(i18n("Shows the developer tools for the current page"));
@@ -3953,11 +3960,15 @@ QString KonqMainWindow::findIndexFile(const QString &dir)
     return QString();
 }
 
-void KonqMainWindow::connectExtension(KParts::BrowserExtension *ext)
+void KonqMainWindow::connectExtension(KParts::NavigationExtension *ext)
 {
-    KParts::BrowserExtension::ActionSlotMap *actionSlotMap = KParts::BrowserExtension::actionSlotMapPtr();
-    KParts::BrowserExtension::ActionSlotMap::ConstIterator it = actionSlotMap->constBegin();
-    KParts::BrowserExtension::ActionSlotMap::ConstIterator itEnd = actionSlotMap->constEnd();
+#if QT_VERSION_MAJOR < 6
+    KParts::NavigationExtension::ActionSlotMap *actionSlotMap = KParts::NavigationExtension::actionSlotMapPtr();
+#else
+    KParts::NavigationExtension::ActionSlotMap *actionSlotMap = KParts::NavigationExtension::actionSlotMap();
+#endif
+    KParts::NavigationExtension::ActionSlotMap::ConstIterator it = actionSlotMap->constBegin();
+    KParts::NavigationExtension::ActionSlotMap::ConstIterator itEnd = actionSlotMap->constEnd();
 
     for (; it != itEnd; ++it) {
         QAction *act = actionCollection()->action(it.key().data());
@@ -3978,17 +3989,21 @@ void KonqMainWindow::connectExtension(KParts::BrowserExtension *ext)
             }
 
         } else {
-            qCWarning(KONQUEROR_LOG) << "Error in BrowserExtension::actionSlotMap(), unknown action : " << it.key();
+            qCWarning(KONQUEROR_LOG) << "Error in NavigationExtension::actionSlotMap(), unknown action : " << it.key();
         }
     }
 
 }
 
-void KonqMainWindow::disconnectExtension(KParts::BrowserExtension *ext)
+void KonqMainWindow::disconnectExtension(KParts::NavigationExtension *ext)
 {
-    KParts::BrowserExtension::ActionSlotMap *actionSlotMap = KParts::BrowserExtension::actionSlotMapPtr();
-    KParts::BrowserExtension::ActionSlotMap::ConstIterator it = actionSlotMap->constBegin();
-    KParts::BrowserExtension::ActionSlotMap::ConstIterator itEnd = actionSlotMap->constEnd();
+#if QT_VERSION_MAJOR < 6
+    KParts::NavigationExtension::ActionSlotMap *actionSlotMap = KParts::NavigationExtension::actionSlotMapPtr();
+#else
+    KParts::NavigationExtension::ActionSlotMap *actionSlotMap = KParts::NavigationExtension::actionSlotMap();
+#endif
+    KParts::NavigationExtension::ActionSlotMap::ConstIterator it = actionSlotMap->constBegin();
+    KParts::NavigationExtension::ActionSlotMap::ConstIterator itEnd = actionSlotMap->constEnd();
 
     for (; it != itEnd; ++it) {
         QAction *act = actionCollection()->action(it.key().data());
@@ -4038,7 +4053,11 @@ void KonqMainWindow::setActionText(const char *name, const QString &text)
 void KonqMainWindow::enableAllActions(bool enable)
 {
     //qCDebug(KONQUEROR_LOG) << enable;
-    KParts::BrowserExtension::ActionSlotMap *actionSlotMap = KParts::BrowserExtension::actionSlotMapPtr();
+#if QT_VERSION_MAJOR < 6
+    KParts::NavigationExtension::ActionSlotMap *actionSlotMap = KParts::NavigationExtension::actionSlotMapPtr();
+#else
+    KParts::NavigationExtension::ActionSlotMap *actionSlotMap = KParts::NavigationExtension::actionSlotMap();
+#endif
 
     const QList<QAction *> actions = actionCollection()->actions();
     QList<QAction *>::ConstIterator it = actions.constBegin();
@@ -4268,9 +4287,9 @@ QString KonqMainWindow::currentTitle() const
     return m_currentView ? m_currentView->caption() : QString();
 }
 
-// Convert between deprecated string-based KParts::BrowserExtension::ActionGroupMap
+// Convert between deprecated string-based KParts::NavigationExtension::ActionGroupMap
 // to newer enum-based KonqPopupMenu::ActionGroupMap
-static KonqPopupMenu::ActionGroupMap convertActionGroups(const KParts::BrowserExtension::ActionGroupMap &input)
+static KonqPopupMenu::ActionGroupMap convertActionGroups(const KParts::NavigationExtension::ActionGroupMap &input)
 {
     KonqPopupMenu::ActionGroupMap agm;
     agm.insert(KonqPopupMenu::TopActions, input.value(QStringLiteral("topactions")));
@@ -4282,7 +4301,7 @@ static KonqPopupMenu::ActionGroupMap convertActionGroups(const KParts::BrowserEx
     return agm;
 }
 
-void KonqMainWindow::slotPopupMenu(const QPoint &global, const QUrl &url, mode_t mode, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments &browserArgs, KParts::BrowserExtension::PopupFlags flags, const KParts::BrowserExtension::ActionGroupMap &actionGroups)
+void KonqMainWindow::slotPopupMenu(const QPoint &global, const QUrl &url, mode_t mode, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments &browserArgs, KParts::NavigationExtension::PopupFlags flags, const KParts::NavigationExtension::ActionGroupMap &actionGroups)
 {
     KFileItem item(url, args.mimeType(), mode);
     KFileItemList items;
@@ -4290,7 +4309,7 @@ void KonqMainWindow::slotPopupMenu(const QPoint &global, const QUrl &url, mode_t
     slotPopupMenu(global, items, args, browserArgs, flags, actionGroups);
 }
 
-void KonqMainWindow::slotPopupMenu(const QPoint &global, const KFileItemList &items, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments &browserArgs, KParts::BrowserExtension::PopupFlags itemFlags, const KParts::BrowserExtension::ActionGroupMap &actionGroups)
+void KonqMainWindow::slotPopupMenu(const QPoint &global, const KFileItemList &items, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments &browserArgs, KParts::NavigationExtension::PopupFlags itemFlags, const KParts::NavigationExtension::ActionGroupMap &actionGroups)
 {
     KonqView *m_oldView = m_currentView;
     KonqView *currentView = childView(static_cast<KParts::ReadOnlyPart *>(sender()->parent()));
@@ -4366,7 +4385,7 @@ void KonqMainWindow::slotPopupMenu(const QPoint &global, const KFileItemList &it
     const bool doTabHandling = !openedForViewURL && !isIntoTrash && sReading;
     const bool showEmbeddingServices = items.count() == 1 && !m_popupMimeType.isEmpty() &&
                                        !isIntoTrash && !devicesFile &&
-                                       (itemFlags & KParts::BrowserExtension::ShowTextSelectionItems) == 0;
+                                       (itemFlags & KParts::NavigationExtension::ShowTextSelectionItems) == 0;
 
     QVector<KPluginMetaData> embeddingServices;
     if (showEmbeddingServices) {
@@ -4380,7 +4399,7 @@ void KonqMainWindow::slotPopupMenu(const QPoint &global, const KFileItemList &it
         std::copy_if(allEmbeddingServices.begin(), allEmbeddingServices.end(), std::back_inserter(embeddingServices), filter);
     }
 
-    // TODO: get rid of KParts::BrowserExtension::PopupFlags
+    // TODO: get rid of KParts::NavigationExtension::PopupFlags
     KonqPopupMenu::Flags popupFlags = static_cast<KonqPopupMenu::Flags>(static_cast<int>(itemFlags));
 
     KonqPopupMenu::ActionGroupMap popupActionGroups = convertActionGroups(actionGroups);
@@ -4441,7 +4460,7 @@ void KonqMainWindow::slotPopupMenu(const QPoint &global, const KFileItemList &it
         pPopupMenu->setURLTitle(currentView->caption());
     }
 
-    QPointer<KParts::BrowserExtension> be = ::qobject_cast<KParts::BrowserExtension *>(sender());
+    QPointer<KParts::NavigationExtension> be = ::qobject_cast<KParts::NavigationExtension *>(sender());
 
     if (be) {
         QObject::connect(this, &KonqMainWindow::popupItemsDisturbed, pPopupMenu.data(), &KonqPopupMenu::close);
@@ -4703,7 +4722,7 @@ void KonqMainWindow::updateViewModeActions()
         const QString actionDesktopFile = md.value("X-Konqueror-Actions-File");
 
         if (!actionDesktopFile.isEmpty()) {
-            KDesktopFile df(QStandardPaths::DataLocation, actionDesktopFile);
+            KDesktopFile df(QStandardPaths::AppDataLocation, actionDesktopFile);
             QStringList actionNames = df.readActions();
 
             for (const QString &name : actionNames) {
@@ -5447,8 +5466,8 @@ void KonqMainWindow::updateProxyForWebEngine(bool updateProtocolManager)
             return;
         }
     }
-    QString httpProxy = KProtocolManager::proxyForUrl(QUrl("http://fakeurl.test.com"));
-    QString httpsProxy = KProtocolManager::proxyForUrl(QUrl("https://fakeurl.test.com"));
+    QString httpProxy = KProtocolManager::proxyFor(QStringLiteral("http"));
+    QString httpsProxy = KProtocolManager::proxyFor(QStringLiteral("https"));
     if (httpProxy == "DIRECT" && httpsProxy == "DIRECT") {
         QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::NoProxy));
     } else {
diff --git a/src/konqmainwindow.h b/src/konqmainwindow.h
index 1c8c440dfa..6984d9e0a0 100644
--- a/src/konqmainwindow.h
+++ b/src/konqmainwindow.h
@@ -27,6 +27,7 @@
 #include "konqframe.h"
 #include "konqframecontainer.h"
 #include "konqopenurlrequest.h"
+#include "kf5compat.h" //For NavigationExtension
 
 class QActionGroup;
 class KUrlCompletion;
@@ -61,7 +62,8 @@ class UrlLoader;
 
 namespace KParts
 {
-class BrowserExtension;
+//TODO KF6: when removing compatibility with KF5, uncomment the line below
+// class NavigationExtension;
 class ReadOnlyPart;
 class OpenUrlArguments;
 struct BrowserArguments;
@@ -359,8 +361,8 @@ public Q_SLOTS:
 
     void slotCtrlTabPressed();
 
-    void slotPopupMenu(const QPoint &global, const KFileItemList &items, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments &browserArgs, KParts::BrowserExtension::PopupFlags flags, const KParts::BrowserExtension::ActionGroupMap &);
-    void slotPopupMenu(const QPoint &global, const QUrl &url, mode_t mode, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments &browserArgs, KParts::BrowserExtension::PopupFlags f, const KParts::BrowserExtension::ActionGroupMap &);
+    void slotPopupMenu(const QPoint &global, const KFileItemList &items, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments &browserArgs, KParts::NavigationExtension::PopupFlags flags, const KParts::NavigationExtension::ActionGroupMap &);
+    void slotPopupMenu(const QPoint &global, const QUrl &url, mode_t mode, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments &browserArgs, KParts::NavigationExtension::PopupFlags f, const KParts::NavigationExtension::ActionGroupMap &);
 
     void slotOpenURLRequest(const QUrl &url, KonqOpenURLRequest &req);
 
@@ -625,8 +627,8 @@ private:
     */
     static QString findIndexFile(const QString &directory);
 
-    void connectExtension(KParts::BrowserExtension *ext);
-    void disconnectExtension(KParts::BrowserExtension *ext);
+    void connectExtension(KParts::NavigationExtension *ext);
+    void disconnectExtension(KParts::NavigationExtension *ext);
 
     void plugViewModeActions();
     void unplugViewModeActions();
diff --git a/src/konqmisc.cpp b/src/konqmisc.cpp
index 24ab55327f..51f652092c 100644
--- a/src/konqmisc.cpp
+++ b/src/konqmisc.cpp
@@ -4,7 +4,6 @@
     SPDX-License-Identifier: GPL-2.0-or-later
 */
 #include "konqmisc.h"
-#include <kparts/browserrun.h>
 #include "konqsettingsxt.h"
 #include "konqmainwindow.h"
 #include "konqviewmanager.h"
@@ -72,9 +71,9 @@ QUrl KonqMisc::konqFilteredURL(KonqMainWindow *parent, const QString &_url, cons
         if (KUriFilter::self()->filterUri(data)) {
             if (data.uriType() == KUriFilterData::Error) {
                 if (data.errorMsg().isEmpty()) {
-                    return KParts::BrowserRun::makeErrorUrl(KIO::ERR_MALFORMED_URL, _url, QUrl(_url));
+                    return Konq::makeErrorUrl(KIO::ERR_MALFORMED_URL, _url, QUrl(_url));
                 } else {
-                    return KParts::BrowserRun::makeErrorUrl(KIO::ERR_SLAVE_DEFINED, data.errorMsg(), QUrl(_url));
+                    return Konq::makeErrorUrl(KIO::ERR_WORKER_DEFINED, data.errorMsg(), QUrl(_url));
                 }
             } else {
                 return data.uri();
@@ -86,12 +85,12 @@ QUrl KonqMisc::konqFilteredURL(KonqMainWindow *parent, const QString &_url, cons
         // information.
         const QString scheme = data.uri().scheme();
         if (!scheme.isEmpty() && !KProtocolInfo::isKnownProtocol(scheme)) {
-            return KParts::BrowserRun::makeErrorUrl(KIO::ERR_UNSUPPORTED_PROTOCOL, _url, QUrl(_url));
+            return Konq::makeErrorUrl(KIO::ERR_UNSUPPORTED_PROTOCOL, _url, QUrl(_url));
         }
 
         // NOTE: a valid URL like http://kde.org always passes the filtering test.
         // As such, this point could only be reached when _url is NOT a valid URL.
-        return KParts::BrowserRun::makeErrorUrl(KIO::ERR_MALFORMED_URL, _url, QUrl(_url));
+        return Konq::makeErrorUrl(KIO::ERR_MALFORMED_URL, _url, QUrl(_url));
     }
 
     const bool isKnownAbout = KonqUrl::hasKnownPathRoot(_url);
diff --git a/src/konqmisc.h b/src/konqmisc.h
index 14d3fc20e4..e9aa4745bb 100644
--- a/src/konqmisc.h
+++ b/src/konqmisc.h
@@ -11,7 +11,7 @@
 
 #include <QUrl>
 
-#include <kparts/browserextension.h>
+#include "kf5compat.h" //For NavigationExtension
 
 class KonqMainWindow;
 class KonqView;
diff --git a/src/konqopenurlrequest.h b/src/konqopenurlrequest.h
index 44ff091146..811e1b04a4 100644
--- a/src/konqopenurlrequest.h
+++ b/src/konqopenurlrequest.h
@@ -11,7 +11,7 @@
 
 #include <QStringList>
 
-#include <kparts/browserextension.h>
+#include "kf5compat.h" //For NavigationExtension
 
 namespace KParts {
     class ReadOnlyPart;
diff --git a/src/konqpixmapprovider.h b/src/konqpixmapprovider.h
index 76d72ea8ba..e42405a9f9 100644
--- a/src/konqpixmapprovider.h
+++ b/src/konqpixmapprovider.h
@@ -12,6 +12,7 @@
 #include <QMap>
 #include <QPixmap>
 #include <QUrl>
+#include <QObject>
 
 class KConfigGroup;
 class KConfig;
diff --git a/src/konqsessionmanager.cpp b/src/konqsessionmanager.cpp
index 679faadff0..91316bb278 100644
--- a/src/konqsessionmanager.cpp
+++ b/src/konqsessionmanager.cpp
@@ -35,13 +35,13 @@
 #include <QTreeWidget>
 #include <QScrollBar>
 #include <QApplication>
-#include <QDesktopWidget>
 #include <QStandardPaths>
 #include <QSessionManager>
 #include <KSharedConfig>
 #include <KConfigGroup>
 #include <QDialogButtonBox>
 #include <KGuiItem>
+#include <QScreen>
 
 class KonqSessionManagerPrivate
 {
@@ -101,7 +101,7 @@ SessionRestoreDialog::SessionRestoreDialog(const QStringList &sessionFilePaths,
         iconLayout->addWidget(iconLabel);
         iconLayout->addStretch(5);
         hLayout->addLayout(iconLayout, 0);
-        hLayout->addSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
+        hLayout->addSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
     }
 
     const QString text(i18n("Konqueror did not close correctly. Would you like to restore these previous sessions?"));
@@ -122,7 +122,7 @@ SessionRestoreDialog::SessionRestoreDialog(const QStringList &sessionFilePaths,
     styleOption.initFrom(m_treeWidget);
     QFontMetrics fm(styleOption.font);
     int w = m_treeWidget->width();
-    const QRect desktop = QApplication::desktop()->screenGeometry(this);
+    const QRect desktop = screen()->geometry();
 
     // Collect info from the sessions to restore
     Q_FOREACH (const QString &sessionFile, sessionFilePaths) {
diff --git a/src/konqundomanager.cpp b/src/konqundomanager.cpp
index 2c765ec0a2..7692a9b70c 100644
--- a/src/konqundomanager.cpp
+++ b/src/konqundomanager.cpp
@@ -13,6 +13,7 @@
 #include <kio/fileundomanager.h>
 #include "konqdebug.h"
 #include <KLocalizedString>
+#include <QWidget>
 
 KonqUndoManager::KonqUndoManager(KonqClosedWindowsManager *cwManager, QWidget *parent)
     : QObject(parent), m_cwManager(cwManager)
diff --git a/src/konqutils.cpp b/src/konqutils.cpp
index 197110be1e..42c72bc769 100644
--- a/src/konqutils.cpp
+++ b/src/konqutils.cpp
@@ -16,3 +16,24 @@ QStringList Konq::serviceTypes(const KPluginMetaData& md)
     return md.rawData().value(QLatin1String("KPlugin")).toObject().value(QLatin1String("ServiceTypes")).toVariant().toStringList();
 }
 
+//Code copied from kparts/browserrun.cpp (KF5.109) written by David Faure <faure at kde.org>
+QUrl Konq::makeErrorUrl(int error, const QString& errorText, const QUrl& initialUrl)
+{
+    /*
+     * The format of the error:/ URL is error:/?query#url,
+     * where two variables are passed in the query:
+     * error = int kio error code, errText = QString error text from kio
+     * The sub-url is the URL that we were trying to open.
+     */
+    QUrl newURL(QStringLiteral("error:/?error=%1&errText=%2").arg(error).arg(QString::fromUtf8(QUrl::toPercentEncoding(errorText))));
+
+    QString cleanedOrigUrl = initialUrl.toString();
+    QUrl runURL(cleanedOrigUrl);
+    if (runURL.isValid()) {
+        runURL.setPassword(QString()); // don't put the password in the error URL
+        cleanedOrigUrl = runURL.toString();
+    }
+
+    newURL.setFragment(cleanedOrigUrl);
+    return newURL;
+}
diff --git a/src/konqutils.h b/src/konqutils.h
index 176519bd44..1d228610a3 100644
--- a/src/konqutils.h
+++ b/src/konqutils.h
@@ -22,5 +22,16 @@ namespace Konq
      * @return A list of the service types implemented by @p md
      */
     QStringList serviceTypes(const KPluginMetaData &md);
+
+    /**
+     * @brief Creates an URL with scheme `error` describing the error occurred while attempting to load an URL
+     *
+     * @param error the `KIO` error code (or `KIO::ERR_WORKER_DEFINED` if not from `KIO`)
+     * @param errorText the text of the error message
+     * @param initialUrl the URL that we were trying to open
+     * @return the `error` URL
+     */
+    QUrl makeErrorUrl(int error, const QString &errorText, const QUrl &initialUrl);
+
 }
 #endif //KONQUTILS_H
diff --git a/src/konqview.cpp b/src/konqview.cpp
index 825ee8021a..08c073ce90 100644
--- a/src/konqview.cpp
+++ b/src/konqview.cpp
@@ -31,7 +31,6 @@
 
 #include <QApplication>
 #include <QArgument>
-#include <QByteRef>
 #include <QFile>
 #include <QDropEvent>
 #include <QDBusConnection>
@@ -49,7 +48,7 @@
 #include <KParts/BrowserArguments>
 #include <KParts/OpenUrlEvent>
 #include <KParts/OpenUrlArguments>
-#include <KParts/BrowserExtension>
+#include "kf5compat.h" //For NavigationExtension
 #include <KParts/WindowArgs>
 #include <QMimeDatabase>
 
@@ -146,7 +145,7 @@ void KonqView::openUrl(const QUrl &url, const QString &locationBarURL,
         args = m_pPart->arguments();
     }
 
-    KParts::BrowserExtension *ext = browserExtension();
+    KParts::NavigationExtension *ext = browserExtension();
     KParts::BrowserArguments browserArgs;
     if (ext) {
         browserArgs = ext->browserArguments();
@@ -400,14 +399,14 @@ void KonqView::connectPart()
         }
     }
 
-    KParts::BrowserExtension *ext = browserExtension();
+    KParts::NavigationExtension *ext = browserExtension();
 
     if (ext) {
         
         KonqBrowserWindowInterface *bi = new KonqBrowserWindowInterface(mainWindow(), m_pPart);
         ext->setBrowserInterface(bi);
         
-        connect(ext, &KParts::BrowserExtension::openUrlRequestDelayed, ext,
+        connect(ext, &KParts::NavigationExtension::openUrlRequestDelayed, ext,
                 [ext, this](const QUrl &url, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments &bargs){
                     KonqOpenURLRequest req(args, bargs, qobject_cast<KParts::ReadOnlyPart*>(ext->parent()));
                     m_pMainWindow->slotOpenURLRequest(url, req);
@@ -464,7 +463,7 @@ void KonqView::connectPart()
                 this, SLOT(slotRequestFocus(KParts::ReadOnlyPart*)));
 
         if (service().pluginId() != QLatin1String("konq_sidebartng")) {
-            connect(ext, &KParts::BrowserExtension::infoMessage, m_pKonqFrame->statusbar(), &KonqFrameStatusBar::message);
+            connect(ext, &KParts::NavigationExtension::infoMessage, m_pKonqFrame->statusbar(), &KonqFrameStatusBar::message);
 
             //Must use this form of connect because slotAddWebSideBar is private
             connect(ext, SIGNAL(addWebSideBar(QUrl,QString)), m_pMainWindow, SLOT(slotAddWebSideBar(QUrl,QString)));
@@ -1035,7 +1034,7 @@ void KonqView::setPartMimeType()
 
 bool KonqView::callExtensionMethod(const char *methodName)
 {
-    QObject *obj = KParts::BrowserExtension::childObject(m_pPart);
+    QObject *obj = KParts::NavigationExtension::childObject(m_pPart);
     if (!obj) { // not all views have a browser extension !
         return false;
     }
@@ -1045,7 +1044,7 @@ bool KonqView::callExtensionMethod(const char *methodName)
 
 bool KonqView::callExtensionBoolMethod(const char *methodName, bool value)
 {
-    QObject *obj = KParts::BrowserExtension::childObject(m_pPart);
+    QObject *obj = KParts::NavigationExtension::childObject(m_pPart);
     if (!obj) { // not all views have a browser extension !
         return false;
     }
@@ -1055,7 +1054,7 @@ bool KonqView::callExtensionBoolMethod(const char *methodName, bool value)
 
 bool KonqView::callExtensionURLMethod(const char *methodName, const QUrl &value)
 {
-    QObject *obj = KParts::BrowserExtension::childObject(m_pPart);
+    QObject *obj = KParts::NavigationExtension::childObject(m_pPart);
     if (!obj) { // not all views have a browser extension !
         return false;
     }
@@ -1080,7 +1079,7 @@ void KonqView::enablePopupMenu(bool b)
 {
     Q_ASSERT(m_pMainWindow);
 
-    KParts::BrowserExtension *ext = browserExtension();
+    KParts::NavigationExtension *ext = browserExtension();
 
     if (!ext) {
         return;
@@ -1090,23 +1089,24 @@ void KonqView::enablePopupMenu(bool b)
         return;
     }
 
-    // enable context popup
-    if (b) {
+    //Store signal and slot overloads in variable so that they can be reused in both branches
+    using namespace KParts;
+    auto sigOverloadFileItem = QOverload<const QPoint&, const KFileItemList&, const OpenUrlArguments &, const BrowserArguments&,
+        NavigationExtension::PopupFlags, const NavigationExtension::ActionGroupMap&>::of(&NavigationExtension::popupMenu);
+    auto slotOverloadFileItem = QOverload<const QPoint&, const KFileItemList&, const OpenUrlArguments &, const BrowserArguments&,
+        NavigationExtension::PopupFlags, const NavigationExtension::ActionGroupMap&>::of(&KonqMainWindow::slotPopupMenu);
+    auto sigOverloadUrl = QOverload<const QPoint&, const QUrl&, mode_t, const OpenUrlArguments& , const BrowserArguments& ,
+        NavigationExtension::PopupFlags, const NavigationExtension::ActionGroupMap&>::of(&NavigationExtension::popupMenu);
+    auto slotOverloadUrl = QOverload<const QPoint&, const QUrl&, mode_t, const OpenUrlArguments& , const BrowserArguments& ,
+        NavigationExtension::PopupFlags, const NavigationExtension::ActionGroupMap&>::of(&KonqMainWindow::slotPopupMenu);
+    if (b) { // enable context popup
         m_bPopupMenuEnabled = true;
-
-        connect(ext, SIGNAL(popupMenu(QPoint,KFileItemList,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)),
-                m_pMainWindow, SLOT(slotPopupMenu(QPoint,KFileItemList,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)));
-
-        connect(ext, SIGNAL(popupMenu(QPoint,QUrl,mode_t,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)),
-                m_pMainWindow, SLOT(slotPopupMenu(QPoint,QUrl,mode_t,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)));
+        connect(ext,sigOverloadFileItem, m_pMainWindow, slotOverloadFileItem);
+        connect(ext, sigOverloadUrl, m_pMainWindow, slotOverloadUrl);
     } else { // disable context popup
         m_bPopupMenuEnabled = false;
-
-        disconnect(ext, SIGNAL(popupMenu(QPoint,KFileItemList,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)),
-                   m_pMainWindow, SLOT(slotPopupMenu(QPoint,KFileItemList,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)));
-
-        disconnect(ext, SIGNAL(popupMenu(QPoint,QUrl,mode_t,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)),
-                   m_pMainWindow, SLOT(slotPopupMenu(QPoint,QUrl,mode_t,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)));
+        disconnect(ext,sigOverloadFileItem, m_pMainWindow, slotOverloadFileItem);
+        disconnect(ext, sigOverloadUrl, m_pMainWindow, slotOverloadUrl);
     }
 }
 
@@ -1171,7 +1171,7 @@ bool KonqView::eventFilter(QObject *obj, QEvent *e)
         const QMimeData *mimeData = ev->mimeData();
 
         QList<QUrl> lstDragURLs = KUrlMimeData::urlsFromMimeData(mimeData);
-        KParts::BrowserExtension *ext = browserExtension();
+        KParts::NavigationExtension *ext = browserExtension();
         if (!lstDragURLs.isEmpty() && ext && lstDragURLs.first().isValid()) {
             emit ext->openUrlRequest(lstDragURLs.first());    // this will call m_pMainWindow::slotOpenURLRequest delayed
         }
@@ -1216,9 +1216,9 @@ bool KonqView::prepareReload(KParts::OpenUrlArguments &args, KParts::BrowserArgu
     return true;
 }
 
-KParts::BrowserExtension *KonqView::browserExtension() const
+KParts::NavigationExtension *KonqView::browserExtension() const
 {
-    return m_pPart ? KParts::BrowserExtension::childObject(m_pPart) : nullptr;
+    return m_pPart ? KParts::NavigationExtension::childObject(m_pPart) : nullptr;
 }
 
 KParts::StatusBarExtension *KonqView::statusBarExtension() const
diff --git a/src/konqview.h b/src/konqview.h
index cc0674460a..3e2c36297d 100644
--- a/src/konqview.h
+++ b/src/konqview.h
@@ -12,6 +12,7 @@
 #include "konqfactory.h"
 #include "konqframe.h"
 #include "konqutils.h"
+#include "kf5compat.h" //For NavigationExtension
 
 #include <kservice.h>
 #include <QMimeType>
@@ -29,7 +30,8 @@ class UrlLoader;
 class KonqFrame;
 namespace KParts
 {
-class BrowserExtension;
+//TODO KF6: when removing compatibility with KF5, uncomment the line below
+//class NavigationExtension;
 class StatusBarExtension;
 }
 
@@ -299,7 +301,7 @@ public:
         return m_bAborted;
     }
 
-    KParts::BrowserExtension *browserExtension() const;
+    KParts::NavigationExtension *browserExtension() const;
 
     KParts::StatusBarExtension *statusBarExtension() const;
 
@@ -535,7 +537,7 @@ public Q_SLOTS:
      */
     void setLocationBarURL(const QString &locationBarURL);
     /**
-     * get an icon for the URL from the BrowserExtension
+     * get an icon for the URL from the NavigationExtension
      */
     void setIconURL(const QUrl &iconURL);
 
@@ -559,7 +561,7 @@ private Q_SLOTS:
     void slotSpeed(KJob *, unsigned long bytesPerSecond);
 
     /**
-     * Connected to the BrowserExtension
+     * Connected to the NavigationExtension
      */
     void slotSelectionInfo(const KFileItemList &items);
     void slotMouseOverInfo(const KFileItem &item);
diff --git a/src/konqviewmanager.cpp b/src/konqviewmanager.cpp
index acafe11002..1a254939b1 100644
--- a/src/konqviewmanager.cpp
+++ b/src/konqviewmanager.cpp
@@ -33,12 +33,12 @@
 #include <kmessagebox.h>
 #include <QMenu>
 #include <QApplication>
-#include <QDesktopWidget>
 #include <QStandardPaths>
 #include <KSharedConfig>
 #include <KWindowConfig>
 #include <QMimeDatabase>
 #include <QMimeType>
+#include <QScreen>
 
 //#define DEBUG_VIEWMGR
 
@@ -1042,7 +1042,7 @@ static QSize readDefaultSize(const KConfigGroup &cfg, QWidget *widget)
     QString heightStr = cfg.readEntry("Height");
     int width = -1;
     int height = -1;
-    const QRect geom = QApplication::desktop()->screenGeometry(widget);
+    const QRect geom = widget->screen()->geometry();
 
     bool ok;
     if (widthStr.endsWith('%')) {
diff --git a/src/ksortfilterproxymodel.cpp b/src/ksortfilterproxymodel.cpp
index 3ada3d4923..759dc8286e 100644
--- a/src/ksortfilterproxymodel.cpp
+++ b/src/ksortfilterproxymodel.cpp
@@ -35,7 +35,7 @@ KSortFilterProxyModel::~KSortFilterProxyModel()
 
 bool KSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
 {
-    if (filterRegExp().isEmpty()) {
+    if (filterRegularExpression().pattern().isEmpty()) {
         return true;    //Shortcut for common case
     }
 
diff --git a/src/ktabwidget.cpp b/src/ktabwidget.cpp
index 67d2ef1b62..8b5cfec000 100644
--- a/src/ktabwidget.cpp
+++ b/src/ktabwidget.cpp
@@ -266,8 +266,12 @@ int KTabWidget::tabBarWidthForMaxChars(int maxLength)
             // FIXME: how to get the size of the close button directly from the tabBar()?
             iw += KIconLoader::SizeSmall * 3 / 2;
         }
+        //TODO KF6: the third argument used to be a size whose width was the maximum between
+        //lw + hframe + iw and QApplication::globalStrut().width(). Since QApplication::globalStrut()
+        //has been removed in KF6, we assume it's 0: check whether this is correct or what should
+        //be used in place of globalStrut
         x += (tabBar()->style()->sizeFromContents(QStyle::CT_TabBarTab, nullptr,
-                QSize(qMax(lw + hframe + iw, QApplication::globalStrut().width()), 0),
+                QSize(lw + hframe + iw, 0),
                 this)).width();
     }
 
diff --git a/src/urlloader.cpp b/src/urlloader.cpp
index 70090f493e..b72ba8680a 100644
--- a/src/urlloader.cpp
+++ b/src/urlloader.cpp
@@ -24,8 +24,7 @@
 #include <KMessageBox>
 #include <KParts/ReadOnlyPart>
 #include <KParts/BrowserInterface>
-#include <KParts/BrowserExtension>
-#include <KParts/BrowserRun>
+#include "kf5compat.h" //For NavigationExtension
 #include <KParts/PartLoader>
 #include <KJobWidgets>
 #include <KProtocolManager>
@@ -63,9 +62,19 @@ bool UrlLoader::embedWithoutAskingToSave(const QString &mimeType)
     return s_mimeTypes.contains(mimeType);
 }
 
-bool UrlLoader::isExecutable(const QString& mimeType)
+//Code copied from kio/krun.cpp (KF5.109) written by:
+//- Torben Weis <weis at kde.org>
+//- David Faure <faure at kde.org>
+//- Michael Pyne <michael.pyne at kdemail.net>
+//- Harald Sitter <sitter at kde.org>
+bool UrlLoader::isExecutable(const QString& mimeTypeName)
 {
-    return KParts::BrowserRun::isExecutable(mimeType);
+    QMimeDatabase db;
+    QMimeType mimeType = db.mimeTypeForName(mimeTypeName);
+    return (mimeType.inherits(QStringLiteral("application/x-desktop")) || mimeType.inherits(QStringLiteral("application/x-executable")) ||
+            /* See https://bugs.freedesktop.org/show_bug.cgi?id=97226 */
+            mimeType.inherits(QStringLiteral("application/x-sharedlib")) || mimeType.inherits(QStringLiteral("application/x-ms-dos-executable"))
+            || mimeType.inherits(QStringLiteral("application/x-shellscript")));
 }
 
 UrlLoader::UrlLoader(KonqMainWindow *mainWindow, KonqView *view, const QUrl &url, const QString &mimeType, const KonqOpenURLRequest &req, bool trustedSource, bool dontEmbed):
@@ -320,7 +329,7 @@ void UrlLoader::decideOpenOrSave()
 }
 
 UrlLoader::OpenUrlAction UrlLoader::decideExecute() const {
-    if (!m_url.isLocalFile() || !KRun::isExecutable(m_mimeType)) {
+    if (!m_url.isLocalFile() || !isExecutable(m_mimeType)) {
         return OpenUrlAction::UnknwonAction;
     }
     bool canDisplay = !KParts::PartLoader::partsForMimeType(m_mimeType).isEmpty();
@@ -478,7 +487,7 @@ void UrlLoader::mimetypeDeterminedByJob()
 {
     if (m_mimeTypeFinderJob->error()) {
         m_jobErrorCode = m_mimeTypeFinderJob->error();
-        m_url = KParts::BrowserRun::makeErrorUrl(m_jobErrorCode, m_mimeTypeFinderJob->errorString(), m_url);
+        m_url = Konq::makeErrorUrl(m_jobErrorCode, m_mimeTypeFinderJob->errorString(), m_url);
         m_mimeType = QStringLiteral("text/html");
         m_action = OpenUrlAction::Embed;
         performAction();
@@ -629,7 +638,7 @@ void UrlLoader::embed()
 {
     if (m_jobErrorCode) {
         QUrl url = m_url;
-        m_url = KParts::BrowserRun::makeErrorUrl(m_jobErrorCode, m_url.scheme(), m_url);
+        m_url = Konq::makeErrorUrl(m_jobErrorCode, m_url.scheme(), m_url);
         m_mimeType = QStringLiteral("text/html");
         m_part = findPartById(QStringLiteral("webenginepart"));
     }
diff --git a/src/urlloader.h b/src/urlloader.h
index ea9ea955d4..14ba637816 100644
--- a/src/urlloader.h
+++ b/src/urlloader.h
@@ -14,6 +14,7 @@
 
 #include <QObject>
 #include <QUrl>
+#include <QPointer>
 
 #include <KService>
 #include <KJob>
@@ -147,7 +148,13 @@ public:
     QString oldLocationBarUrl() const {return m_oldLocationBarUrl;}
     bool hasError() const {return m_jobErrorCode;}
     void setNewTab(bool newTab);
-    static bool isExecutable(const QString &mimeType);
+
+    /**
+     * @brief whether a given mimetype refers to an executable program instead of a data file
+     * @param mimeTypeName the mimetype to test
+     * @return `true` if @p mimeTypeName refers to an executable and `false` otherwise
+     */
+    static bool isExecutable(const QString &mimeTypeName);
     QString suggestedFileName() const {return m_request.suggestedFileName;}
 
     /**
diff --git a/webenginepart/autotests/webengine_partapi_test.cpp b/webenginepart/autotests/webengine_partapi_test.cpp
index 86090ce83e..81e26cfb67 100644
--- a/webenginepart/autotests/webengine_partapi_test.cpp
+++ b/webenginepart/autotests/webengine_partapi_test.cpp
@@ -8,7 +8,7 @@
 #include "webengine_testutils.h"
 
 #include <KIO/Job>
-#include <KParts/BrowserExtension>
+#include "kf5compat.h" //For NavigationExtension
 #include <KPluginMetaData>
 
 #include <QTest>
@@ -35,7 +35,7 @@ class WebEnginePartApiTest : public QObject
     Q_OBJECT
 private Q_SLOTS:
     void initTestCase();
-    void shouldHaveBrowserExtension();
+    void shouldHaveNavigationExtension();
     void shouldEmitStartedAndCompleted();
     void shouldEmitStartAndCompleteWithPendingAction();
     void shouldEmitSetWindowCaption();
@@ -48,13 +48,13 @@ void WebEnginePartApiTest::initTestCase()
     qRegisterMetaType<KIO::Job *>(); // for the KParts started signal
 }
 
-void WebEnginePartApiTest::shouldHaveBrowserExtension()
+void WebEnginePartApiTest::shouldHaveNavigationExtension()
 {
     // GIVEN
     WebEnginePart part(nullptr, nullptr, dummyMetaData());
 
     // WHEN
-    KParts::BrowserExtension *ext = KParts::BrowserExtension::childObject(&part);
+    KParts::NavigationExtension *ext = KParts::NavigationExtension::childObject(&part);
 
     // THEN
     QVERIFY(ext);
@@ -67,8 +67,8 @@ void WebEnginePartApiTest::shouldEmitStartedAndCompleted()
     QSignalSpy spyStarted(&part, &KParts::ReadOnlyPart::started);
     QSignalSpy spyCompleted(&part, SIGNAL(completed()));
     QSignalSpy spySetWindowCaption(&part, &KParts::ReadOnlyPart::setWindowCaption);
-    KParts::BrowserExtension *ext = KParts::BrowserExtension::childObject(&part);
-    QSignalSpy spyOpenUrlNotify(ext, &KParts::BrowserExtension::openUrlNotify);
+    KParts::NavigationExtension *ext = KParts::NavigationExtension::childObject(&part);
+    QSignalSpy spyOpenUrlNotify(ext, &KParts::NavigationExtension::openUrlNotify);
     const QUrl url(QStringLiteral("data:text/html, <p>Hello World</p>"));
 
     // WHEN
@@ -89,8 +89,8 @@ void WebEnginePartApiTest::shouldEmitStartAndCompleteWithPendingAction()
     QSignalSpy spyStarted(&part, &KParts::ReadOnlyPart::started);
     QSignalSpy spyCompleted(&part, SIGNAL(completedWithPendingAction()));
     QSignalSpy spySetWindowCaption(&part, &KParts::ReadOnlyPart::setWindowCaption);
-    KParts::BrowserExtension *ext = KParts::BrowserExtension::childObject(&part);
-    QSignalSpy spyOpenUrlNotify(ext, &KParts::BrowserExtension::openUrlNotify);
+    KParts::NavigationExtension *ext = KParts::NavigationExtension::childObject(&part);
+    QSignalSpy spyOpenUrlNotify(ext, &KParts::NavigationExtension::openUrlNotify);
     const QUrl url(QStringLiteral("data:text/html, <html><head><meta http-equiv=\"refresh\"><body><p>Hello World</p></body></html>"));
 
     // WHEN
@@ -130,8 +130,8 @@ void WebEnginePartApiTest::shouldEmitOpenUrlNotifyOnClick()
     QSignalSpy spyStarted(&part, &KParts::ReadOnlyPart::started);
     QSignalSpy spyCompleted(&part, SIGNAL(completed()));
     QSignalSpy spySetWindowCaption(&part, &KParts::ReadOnlyPart::setWindowCaption);
-    KParts::BrowserExtension *ext = KParts::BrowserExtension::childObject(&part);
-    QSignalSpy spyOpenUrlNotify(ext, &KParts::BrowserExtension::openUrlNotify);
+    KParts::NavigationExtension *ext = KParts::NavigationExtension::childObject(&part);
+    QSignalSpy spyOpenUrlNotify(ext, &KParts::NavigationExtension::openUrlNotify);
     const QString file = QFINDTESTDATA("data/page-with-link.html");
     QVERIFY(!file.isEmpty());
     const QUrl url = QUrl::fromLocalFile(file);
diff --git a/webenginepart/src/CMakeLists.txt b/webenginepart/src/CMakeLists.txt
index 1141cffb4b..7287bc59d6 100644
--- a/webenginepart/src/CMakeLists.txt
+++ b/webenginepart/src/CMakeLists.txt
@@ -10,7 +10,7 @@ if(BUILD_TESTING)
   add_definitions(-DBUILD_TESTING)
 endif(BUILD_TESTING)
 
-#Before Qt .1. QtWebEngineView didn't allow opening a remote URL by dropping it
+#Before Qt 5.15.5 QtWebEngineView didn't allow opening a remote URL by dropping it
 #on the view itself, so WebEngineView needed to handle that itself.
 if(QtWebEngineWidgets_VERSION VERSION_LESS "5.15.5")
   add_definitions(-DREMOTE_DND_NOT_HANDLED_BY_WEBENGINE)
@@ -94,6 +94,7 @@ target_link_libraries(kwebenginepartlib
         KF${KF_MAJOR_VERSION}::Wallet
         KF${KF_MAJOR_VERSION}::Notifications
         KF${KF_MAJOR_VERSION}::KIOWidgets
+        KF${KF_MAJOR_VERSION}::TextWidgets
         KF${KF_MAJOR_VERSION}::Konq
     PRIVATE
         KF${KF_MAJOR_VERSION}::I18n
@@ -128,7 +129,13 @@ set(USE_SYSTEM_DICTIONARIES 0 CACHE BOOL "Don't build QtWebEngine dictionaries b
 if((NOT USE_SYSTEM_DICTIONARIES) AND Hunspell_FOUND)
   set(WEBENGINEPART_OWN_DICTIONARY_DIR ${CMAKE_INSTALL_PREFIX}/share/konqueror/webengine_dictionaries CACHE PATH "The directory where dictionary files built for WebEnginePart will be installed")
   add_compile_definitions(WEBENGINEPART_OWN_DICTIONARY_DIR="${WEBENGINEPART_OWN_DICTIONARY_DIR}")
-  target_compile_definitions(kdeinit_konqueror PUBLIC WEBENGINEPART_OWN_DICTIONARY_DIR="${WEBENGINEPART_OWN_DICTIONARY_DIR}")
+  
+if (KF_MAJOR_VERSION STRLESS "6")
+   set(konqueror_internal_lib_target kdeinit_konqueror)
+else()
+   set(konqueror_internal_lib_target konqueror_internal_lib)
+endif()
+  target_compile_definitions(${konqueror_internal_lib_target} PUBLIC WEBENGINEPART_OWN_DICTIONARY_DIR="${WEBENGINEPART_OWN_DICTIONARY_DIR}")
 
   #COMPILE HUNSPELL DICTIONARIES AS BDIC FILES
   find_package(WebEngineDictConverter)
diff --git a/webenginepart/src/about/konq_aboutpage.cpp b/webenginepart/src/about/konq_aboutpage.cpp
index f3c6aebc00..5d37845780 100644
--- a/webenginepart/src/about/konq_aboutpage.cpp
+++ b/webenginepart/src/about/konq_aboutpage.cpp
@@ -4,7 +4,6 @@
 #include <QDir>
 #include <QSaveFile>
 #include <QStandardPaths>
-#include <QTextCodec>
 #include <QTextStream>
 #include <QUrl>
 #include <QBuffer>
diff --git a/webenginepart/src/certificateerrordialogmanager.cpp b/webenginepart/src/certificateerrordialogmanager.cpp
index d44c904631..a3080ae935 100644
--- a/webenginepart/src/certificateerrordialogmanager.cpp
+++ b/webenginepart/src/certificateerrordialogmanager.cpp
@@ -39,7 +39,7 @@ bool CertificateErrorDialogManager::handleCertificateError(const QWebEngineCerti
 #if QT_VERSION_MAJOR < 6
         ce.ignoreCertificateError();
 #else
-        ce.acceptCertificate()
+        ce.acceptCertificate();
 #endif
     } else {
         ce.defer();
@@ -54,7 +54,11 @@ bool CertificateErrorDialogManager::handleCertificateError(const QWebEngineCerti
 
 bool CertificateErrorDialogManager::userAlreadyChoseToIgnoreError(const QWebEngineCertificateError &ce)
 {
+#if QT_VERSION_MAJOR < 6
     int error = static_cast<int>(ce.error());
+#else
+    int error = static_cast<int>(ce.type());
+#endif
     QString url = ce.url().url();
     KConfigGroup grp(KSharedConfig::openConfig(), "CertificateExceptions");
     QList<int> exceptionsForUrl = grp.readEntry(url, QList<int>{});
@@ -125,7 +129,7 @@ void CertificateErrorDialogManager::applyUserChoice(WebEnginePartCertificateErro
 #if QT_VERSION_MAJOR < 6
         error.ignoreCertificateError();
 #else
-        error.acceptCertificate()
+        error.acceptCertificate();
 #endif
         if (choice == WebEnginePartCertificateErrorDlg::UserChoice::IgnoreErrorForever) {
             recordIgnoreForeverChoice(error);
@@ -161,8 +165,13 @@ void CertificateErrorDialogManager::recordIgnoreForeverChoice(const QWebEngineCe
 {
     KConfigGroup grp(KSharedConfig::openConfig(), "CertificateExceptions");
     QString url = ce.url().url();
+#if QT_VERSION_MAJOR < 6
+    int error = ce.error();
+#else
+    int error = ce.type();
+#endif
     QList<int> exceptionsForUrl = grp.readEntry(url, QList<int>{});
-    exceptionsForUrl.append(ce.error());
+    exceptionsForUrl.append(error);
     grp.writeEntry(url, exceptionsForUrl);
     grp.sync();
 }
diff --git a/webenginepart/src/choosepagesaveformatdlg.cpp b/webenginepart/src/choosepagesaveformatdlg.cpp
index a8815982cf..9910dfaed1 100644
--- a/webenginepart/src/choosepagesaveformatdlg.cpp
+++ b/webenginepart/src/choosepagesaveformatdlg.cpp
@@ -10,7 +10,7 @@
 #include <QButtonGroup>
 
 ChoosePageSaveFormatDlg::ChoosePageSaveFormatDlg(QWidget* parent)
-    : m_ui(new Ui::ChoosePageSaveFormatDlg), m_choicesGroup(new QButtonGroup(this))
+    : QDialog(parent), m_ui(new Ui::ChoosePageSaveFormatDlg), m_choicesGroup(new QButtonGroup(this))
 {
     m_ui->setupUi(this);
     m_choicesGroup->addButton(m_ui->m_singleHTMLPage, QWebEngineDownloadRequest::SavePageFormat::SingleHtmlSaveFormat);
diff --git a/webenginepart/src/choosepagesaveformatdlg.h b/webenginepart/src/choosepagesaveformatdlg.h
index a4a75557e8..e2e34c9c40 100644
--- a/webenginepart/src/choosepagesaveformatdlg.h
+++ b/webenginepart/src/choosepagesaveformatdlg.h
@@ -11,7 +11,6 @@
 
 #include <QDialog>
 #include <QScopedPointer>
-#include <QWebEngineDownloadItem>
 
 class QButtonGroup;
 
diff --git a/webenginepart/src/cookies/webenginepartcookiejar6.cpp b/webenginepart/src/cookies/webenginepartcookiejar6.cpp
index 8b129e9f8e..00291f7279 100644
--- a/webenginepart/src/cookies/webenginepartcookiejar6.cpp
+++ b/webenginepart/src/cookies/webenginepartcookiejar6.cpp
@@ -25,6 +25,7 @@
 #include <QFile>
 #include <QDataStream>
 #include <QDir>
+#include <QNetworkCookie>
 
 #include <kio_version.h>
 #include <KSharedConfig>
diff --git a/webenginepart/src/cookies/webenginepartcookiejar6.h b/webenginepart/src/cookies/webenginepartcookiejar6.h
index 49eeafb825..cf1b6d4e7b 100644
--- a/webenginepart/src/cookies/webenginepartcookiejar6.h
+++ b/webenginepart/src/cookies/webenginepartcookiejar6.h
@@ -22,7 +22,6 @@
 #include <QVector>
 #include <QDBusInterface>
 #include <QSet>
-#include <QtWebEngine/QtWebEngineVersion>
 
 #include "kwebenginepartlib_export.h"
 
diff --git a/webenginepart/src/cookies/webenginepartcookiejar_kio.h b/webenginepart/src/cookies/webenginepartcookiejar_kio.h
index 5e911dbb46..ff48bc6f93 100644
--- a/webenginepart/src/cookies/webenginepartcookiejar_kio.h
+++ b/webenginepart/src/cookies/webenginepartcookiejar_kio.h
@@ -21,7 +21,6 @@
 #include <QVector>
 #include <QDBusInterface>
 #include <QSet>
-#include <QtWebEngine/QtWebEngineVersion>
 
 #include "kwebenginepartlib_export.h"
 
diff --git a/webenginepart/src/navigationrecorder.h b/webenginepart/src/navigationrecorder.h
index 9817ae9823..ce84af3134 100644
--- a/webenginepart/src/navigationrecorder.h
+++ b/webenginepart/src/navigationrecorder.h
@@ -13,6 +13,7 @@
 #include <QUrl>
 #include <QPointer>
 #include <QWebEngineUrlRequestInfo>
+#include <QMultiHash>
 
 class WebEnginePage;
 
diff --git a/webenginepart/src/settings/webengine_filter.cpp b/webenginepart/src/settings/webengine_filter.cpp
index 209f242855..e6d4d0be64 100644
--- a/webenginepart/src/settings/webengine_filter.cpp
+++ b/webenginepart/src/settings/webengine_filter.cpp
@@ -11,6 +11,7 @@
 
 #include <QHash>
 #include <QBitArray>
+#include <QStringView>
 
 // rolling hash parameters
 #define HASH_P (1997)
@@ -102,7 +103,7 @@ public:
                     // check if we got simple string or REs prefix
                     if (index >= 0) {
                         int flen = stringFilters[index].length();
-                        if (k - flen + 1 >= 0 && stringFilters[index] == str.midRef(k - flen + 1 , flen))
+                        if (k - flen + 1 >= 0 && stringFilters[index] == QStringView{str}.mid(k - flen + 1 , flen))
                         {
                             if (by != nullptr) *by = stringFilters[index];
                             return true;
@@ -110,7 +111,7 @@ public:
                     } else {
                         index = -index - 1;
                         int flen = rePrefixes[index].length();
-                        if (k - 8 + flen < len && rePrefixes[index] == str.midRef(k - 7, flen))
+                        if (k - 8 + flen < len && rePrefixes[index] == QStringView{str}.mid(k - 7, flen))
                         {
                             int remStart = k - 7 + flen;
                             QString remainder = QString::fromRawData(str.unicode() + remStart,
diff --git a/webenginepart/src/settings/webenginesettings.cpp b/webenginepart/src/settings/webenginesettings.cpp
index 2809d8fd9c..6a054ddfda 100644
--- a/webenginepart/src/settings/webenginesettings.cpp
+++ b/webenginepart/src/settings/webenginesettings.cpp
@@ -9,6 +9,7 @@
 #include "webengine_filter.h"
 #include <webenginepart_debug.h>
 #include "../../src/htmldefaults.h"
+#include "profile.h"
 
 #include <KConfig>
 #include <KSharedConfig>
@@ -22,6 +23,10 @@
 #include <QFontDatabase>
 #include <QFileInfo>
 #include <QDir>
+#include <QStringView>
+#include <QRegularExpression>
+
+using namespace KonqWebEnginePart;
 
 QDataStream & operator<<(QDataStream& ds, const WebEngineSettings::WebFormInfo& info)
 {
@@ -365,7 +370,7 @@ void WebEngineSettings::init( KConfig * config, bool reset )
               else
                   d->adBlackList.addFilter(url);
           }
-          else if (name.startsWith(QLatin1String("HTMLFilterListName-")) && (id = name.midRef(19).toInt()) > 0)
+          else if (name.startsWith(QLatin1String("HTMLFilterListName-")) && (id = QStringView{name}.mid(19).toInt()) > 0)
           {
               /** check if entry is enabled */
               bool filterEnabled = cgFilter.readEntry(QStringLiteral("HTMLFilterListEnabled-").append(QString::number(id))) != QLatin1String("false");
@@ -678,51 +683,52 @@ void WebEngineSettings::init( KConfig * config, bool reset )
     QString value = cgHtml.readEntry( "DNSPrefetch", "Enabled" ).toLower();
 
     if (value == "enabled")
-        QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true);
+        Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true);
     else
-        QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, false);
+        Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, false);
   }
 
   // Sync with QWebEngineSettings.
   if (!d->m_encoding.isEmpty())
-      QWebEngineSettings::defaultSettings()->setDefaultTextEncoding(d->m_encoding);
-  QWebEngineSettings::defaultSettings()->setUserStyleSheetUrl(QUrl::fromUserInput(userStyleSheet()));
+      Profile::defaultProfile()->settings()->setDefaultTextEncoding(d->m_encoding);
+  Profile::defaultProfile()->settings()->setUserStyleSheetUrl(QUrl::fromUserInput(userStyleSheet()));
 #endif
 
-  QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::AutoLoadImages, autoLoadImages());
-  QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::JavascriptEnabled, isJavaScriptEnabled());
- // QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::JavaEnabled, isJavaEnabled());
-  QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::PluginsEnabled, isPluginsEnabled());
+
+  Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::AutoLoadImages, autoLoadImages());
+  Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, isJavaScriptEnabled());
+ // Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::JavaEnabled, isJavaEnabled());
+  Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, isPluginsEnabled());
 
   // By default disable JS window.open when policy is deny or smart.
   const HtmlSettingsInterface::JSWindowOpenPolicy policy = windowOpenPolicy();
   if (policy == HtmlSettingsInterface::JSWindowOpenDeny || policy == HtmlSettingsInterface::JSWindowOpenSmart)
-      QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false);
+      Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false);
   else
-      QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
+      Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
 
-//  QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::ZoomTextOnly, zoomTextOnly());
-//  QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::DeveloperExtrasEnabled, isJavaScriptDebugEnabled());
-  QWebEngineSettings::defaultSettings()->setFontFamily(QWebEngineSettings::StandardFont, stdFontName());
-  QWebEngineSettings::defaultSettings()->setFontFamily(QWebEngineSettings::FixedFont, fixedFontName());
-  QWebEngineSettings::defaultSettings()->setFontFamily(QWebEngineSettings::SerifFont, serifFontName());
-  QWebEngineSettings::defaultSettings()->setFontFamily(QWebEngineSettings::SansSerifFont, sansSerifFontName());
-  QWebEngineSettings::defaultSettings()->setFontFamily(QWebEngineSettings::CursiveFont, cursiveFontName());
-  QWebEngineSettings::defaultSettings()->setFontFamily(QWebEngineSettings::FantasyFont, fantasyFontName());
+//  Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::ZoomTextOnly, zoomTextOnly());
+//  Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::DeveloperExtrasEnabled, isJavaScriptDebugEnabled());
+  Profile::defaultProfile()->settings()->setFontFamily(QWebEngineSettings::StandardFont, stdFontName());
+  Profile::defaultProfile()->settings()->setFontFamily(QWebEngineSettings::FixedFont, fixedFontName());
+  Profile::defaultProfile()->settings()->setFontFamily(QWebEngineSettings::SerifFont, serifFontName());
+  Profile::defaultProfile()->settings()->setFontFamily(QWebEngineSettings::SansSerifFont, sansSerifFontName());
+  Profile::defaultProfile()->settings()->setFontFamily(QWebEngineSettings::CursiveFont, cursiveFontName());
+  Profile::defaultProfile()->settings()->setFontFamily(QWebEngineSettings::FantasyFont, fantasyFontName());
 
   // TODO: Create a webengine config module that gets embedded into Konqueror's kcm.
   // Turn on WebGL support
-//  QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::WebGLEnabled, d->m_enableWebGL);
+//  Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::WebGLEnabled, d->m_enableWebGL);
   // Turn on HTML 5 local and offline storage capabilities...
-//  QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::OfflineStorageDatabaseEnabled, d->m_enableOfflineStorageDb);
-//  QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::OfflineWebApplicationCacheEnabled, d->m_enableOfflineWebAppCache);
-  QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, d->m_enableLocalStorage);
+//  Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::OfflineStorageDatabaseEnabled, d->m_enableOfflineStorageDb);
+//  Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::OfflineWebApplicationCacheEnabled, d->m_enableOfflineWebAppCache);
+  Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, d->m_enableLocalStorage);
 
-  QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::ScrollAnimatorEnabled, smoothScrolling() != KSmoothScrollingDisabled);
+  Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::ScrollAnimatorEnabled, smoothScrolling() != KSmoothScrollingDisabled);
 
-  QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::PdfViewerEnabled, internalPdfViewer());
+  Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::PdfViewerEnabled, internalPdfViewer());
 
-  QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, true);
+  Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, true);
 
   // These numbers should be calculated from real "logical" DPI/72, using a default dpi of 96 for now
   computeFontSizes(96);
@@ -740,8 +746,8 @@ void WebEngineSettings::computeFontSizes( int logicalDpi )
   if (toPix < 96.0/72.0)
       toPix = 96.0/72.0;
 
-  QWebEngineSettings::defaultSettings()->setFontSize(QWebEngineSettings::MinimumFontSize, qRound(minFontSize() * toPix));
-  QWebEngineSettings::defaultSettings()->setFontSize(QWebEngineSettings::DefaultFontSize, qRound(mediumFontSize() * toPix));
+  Profile::defaultProfile()->settings()->setFontSize(QWebEngineSettings::MinimumFontSize, qRound(minFontSize() * toPix));
+  Profile::defaultProfile()->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, qRound(mediumFontSize() * toPix));
 }
 
 bool WebEngineSettings::zoomToDPI() const
@@ -874,7 +880,7 @@ void WebEngineSettings::addAdFilter( const QString &url )
 {
     KConfigGroup config = KSharedConfig::openConfig( QStringLiteral("khtmlrc"), KConfig::NoGlobals )->group( "Filter Settings" );
 
-    QRegExp rx;
+    QRegularExpression rx;
 
     // Try compiling to avoid invalid stuff. Only support the basic syntax here...
     // ### refactor somewhat
@@ -885,8 +891,7 @@ void WebEngineSettings::addAdFilter( const QString &url )
     }
     else
     {
-        rx.setPatternSyntax(QRegExp::Wildcard);
-        rx.setPattern(url);
+        rx.setPattern(QRegularExpression::wildcardToRegularExpression(url));
     }
 
     if (rx.isValid())
diff --git a/webenginepart/src/ui/passwordbar.cpp b/webenginepart/src/ui/passwordbar.cpp
index 15d304321e..0688fb993a 100644
--- a/webenginepart/src/ui/passwordbar.cpp
+++ b/webenginepart/src/ui/passwordbar.cpp
@@ -145,5 +145,5 @@ QPoint PasswordBar::computeDetailsWidgetPosition() const
     if (!m_detailsWidget) {
         return QPoint();
     }
-    return mapTo(parentWidget(), {width() - m_detailsWidget->width(), height()});
+    return mapTo(parentWidget(), QPoint{width() - m_detailsWidget->width(), height()});
 }
diff --git a/webenginepart/src/webenginepage.cpp b/webenginepart/src/webenginepage.cpp
index de1dbe4491..ec244ae910 100644
--- a/webenginepart/src/webenginepage.cpp
+++ b/webenginepart/src/webenginepage.cpp
@@ -20,6 +20,7 @@
 #include "navigationrecorder.h"
 #include "profile.h"
 #include "webenginepart_ext.h"
+#include "qtwebengine6compat.h"
 
 #include <QWebEngineCertificateError>
 #include <QWebEngineSettings>
@@ -36,7 +37,6 @@
 #include <KSharedConfig>
 #include <KIO/AuthInfo>
 #include <KIO/Job>
-#include <KIO/AccessManager>
 #include <KIO/CommandLauncherJob>
 #include <KJobTrackerInterface>
 #include <KUserTimestamp>
@@ -46,7 +46,7 @@
 #include <KPluginMetaData>
 
 #include <QStandardPaths>
-#include <QDesktopWidget>
+#include <QScreen>
 #include <QFileDialog>
 #include <QDialogButtonBox>
 #include <QMimeDatabase>
@@ -58,7 +58,6 @@
 #include <QTimer>
 #include <QWebEngineHistory>
 #include <QWebEngineHistoryItem>
-#include <QWebEngineDownloadItem>
 #include <QUrlQuery>
 #include <KConfigGroup>
 #include <KToggleFullScreenAction>
@@ -128,10 +127,10 @@ const WebSslInfo& WebEnginePage::sslInfo() const
     return m_sslInfo;
 }
 
-#if QT_VERSION_MAJOR == 6
+#if QT_VERSION_MAJOR > 5
 QWidget *WebEnginePage::view() const
 {
-    return QWebEngineView::viewForPage(this);
+    return QWebEngineView::forPage(this);
 }
 #endif
 
@@ -189,7 +188,7 @@ bool WebEnginePage::downloadWithExternalDonwloadManager(const QUrl &url)
     return true;
 }
 
-void WebEnginePage::requestDownload(QWebEngineDownloadItem *item, bool newWindow, bool requestSave)
+void WebEnginePage::requestDownload(QWebEngineDownloadRequest *item, bool newWindow, bool requestSave)
 {
     QUrl url = item->url();
     if (downloadWithExternalDonwloadManager(url)) {
@@ -233,6 +232,7 @@ void WebEnginePage::requestDownload(QWebEngineDownloadItem *item, bool newWindow
             item->accept();
         }
     };
+
 //TODO KF6: remove #ifndef and line inside it when compatibility with KF5 isn't needed anymore.
 #ifdef MANAGE_COOKIES_INTERNALLY
     if (downloader) {
@@ -314,14 +314,14 @@ bool WebEnginePage::askBrowserToOpenUrl(const QUrl& url, const QString& mimetype
     KParts::OpenUrlArguments args(_args);
     args.setMimeType(mimetype);
     args.metaData().insert("DontSendToDefaultHTMLPart", "");
-    emit m_part->browserExtension()->openUrlRequest(url, args, bargs);
+    emit m_part->navigationExtension()->openUrlRequest(url, args, bargs);
     return true;
 }
 
 bool WebEnginePage::shouldOpenLocalUrl(const QUrl& url) const
 {
     Q_ASSERT(url.isLocalFile());
-    KParts::BrowserInterface *bi = m_part->browserExtension()->browserInterface();
+    KParts::BrowserInterface *bi = m_part->navigationExtension()->browserInterface();
     bool useThisPart = false;
     //We don't check whether bi is valid, as invokeMethod will fail if it's nullptr
     //If invokeMethod fails, useThisPart will keep its default value (false) which is what we need to return, so there's no
@@ -559,50 +559,10 @@ void WebEnginePage::slotLoadFinished(bool ok)
 
     if (isMainFrameRequest) {
         const WebEnginePageSecurity security = (m_sslInfo.isValid() ? PageEncrypted : PageUnencrypted);
-        emit m_part->browserExtension()->setPageSecurity(security);
+        emit m_part->navigationExtension()->setPageSecurity(security);
     }
 }
 
-void WebEnginePage::slotUnsupportedContent(QNetworkReply* reply)
-{
-#if 0
-    //qCDebug(WEBENGINEPART_LOG) << reply->url();
-    QString mimeType;
-    KIO::MetaData metaData;
-
-    KIO::AccessManager::putReplyOnHold(reply);
-    QString downloadCmd;
-    checkForDownloadManager(view(), downloadCmd);
-    if (!downloadCmd.isEmpty()) {
-        reply->setProperty("DownloadManagerExe", downloadCmd);
-    }
-
-    if (QWePage::handleReply(reply, &mimeType, &metaData)) {
-        reply->deleteLater();
-        if (qobject_cast<NewWindowPage*>(this) && isBlankUrl(m_part->url())) {
-            m_part->closeUrl();
-            if (m_part->arguments().metaData().contains(QL1S("new-window"))) {
-                m_part->widget()->topLevelWidget()->close();
-            } else {
-                delete m_part;
-            }
-        }
-        return;
-    }
-
-    //qCDebug(WEBENGINEPART_LOG) << "mimetype=" << mimeType << "metadata:" << metaData;
-
-    if (reply->request().originatingObject() == this->mainFrame()) {
-        KParts::OpenUrlArguments args;
-        args.setMimeType(mimeType);
-        args.metaData() = metaData;
-        emit m_part->browserExtension()->openUrlRequest(reply->url(), args, KParts::BrowserArguments());
-        return;
-    }
-#endif
-    reply->deleteLater();
-
-}
 void WebEnginePage::slotFeaturePermissionRequested(const QUrl& url, QWebEnginePage::Feature feature)
 {
     //url.path() is always / (meaning that permissions should be granted site-wide and not per page)
@@ -650,7 +610,7 @@ void WebEnginePage::slotGeometryChangeRequested(const QRect & rect)
     // window will be in maximized mode where moving it will not be possible...
     if (WebEngineSettings::self()->windowMovePolicy(host) == HtmlSettingsInterface::JSWindowMoveAllow &&
         (view()->x() != rect.x() || view()->y() != rect.y()))
-        emit m_part->browserExtension()->moveTopLevelWidget(rect.x(), rect.y());
+        emit m_part->navigationExtension()->moveTopLevelWidget(rect.x(), rect.y());
 
     const int height = rect.height();
     const int width = rect.width();
@@ -662,7 +622,7 @@ void WebEnginePage::slotGeometryChangeRequested(const QRect & rect)
         return;
     }
 
-    QRect sg = QApplication::desktop()->screenGeometry(view());
+    QRect sg = view()->screen()->virtualGeometry();
 
     if (width > sg.width() || height > sg.height()) {
         qCWarning(WEBENGINEPART_LOG) << "Window resize refused, window would be too big (" << width << "," << height << ")";
@@ -671,7 +631,7 @@ void WebEnginePage::slotGeometryChangeRequested(const QRect & rect)
 
     if (WebEngineSettings::self()->windowResizePolicy(host) == HtmlSettingsInterface::JSWindowResizeAllow) {
         //qCDebug(WEBENGINEPART_LOG) << "resizing to " << width << "x" << height;
-        emit m_part->browserExtension()->resizeTopLevelWidget(width, height);
+        emit m_part->navigationExtension()->resizeTopLevelWidget(width, height);
     }
 
     // If the window is out of the desktop, move it up/left
@@ -685,46 +645,7 @@ void WebEnginePage::slotGeometryChangeRequested(const QRect & rect)
         moveByY = - bottom + sg.bottom(); // always <0
 
     if ((moveByX || moveByY) && WebEngineSettings::self()->windowMovePolicy(host) == HtmlSettingsInterface::JSWindowMoveAllow)
-        emit m_part->browserExtension()->moveTopLevelWidget(view()->x() + moveByX, view()->y() + moveByY);
-}
-
-bool WebEnginePage::checkLinkSecurity(const QNetworkRequest &req, NavigationType type) const
-{
-    // Check whether the request is authorized or not...
-    if (!KUrlAuthorized::authorizeUrlAction(QStringLiteral("redirect"), url(), req.url())) {
-
-        //qCDebug(WEBENGINEPART_LOG) << "*** Failed security check: base-url=" << mainFrame()->url() << ", dest-url=" << req.url();
-        QString buttonText, title, message;
-
-        int response = KMessageBox::Cancel;
-        QUrl linkUrl (req.url());
-
-        if (type == QWebEnginePage::NavigationTypeLinkClicked) {
-            message = i18n("<qt>This untrusted page links to<br/><b>%1</b>."
-                           "<br/>Do you want to follow the link?</qt>", linkUrl.url());
-            title = i18n("Security Warning");
-            buttonText = i18nc("follow link despite of security warning", "Follow");
-        } else {
-            title = i18n("Security Alert");
-            message = i18n("<qt>Access by untrusted page to<br/><b>%1</b><br/> denied.</qt>",
-                           linkUrl.toDisplayString().toHtmlEscaped());
-        }
-
-        if (buttonText.isEmpty()) {
-            KMessageBox::error( nullptr, message, title);
-        } else {
-            // Dangerous flag makes the Cancel button the default
-            response = KMessageBox::warningContinueCancel(nullptr, message, title,
-                                                          KGuiItem(buttonText),
-                                                          KStandardGuiItem::cancel(),
-                                                          QString(), // no don't ask again info
-                                                          KMessageBox::Notify | KMessageBox::Dangerous);
-        }
-
-        return (response == KMessageBox::Continue);
-    }
-
-    return true;
+        emit m_part->navigationExtension()->moveTopLevelWidget(view()->x() + moveByX, view()->y() + moveByY);
 }
 
 bool WebEnginePage::checkFormData(const QUrl &url) const
@@ -831,7 +752,7 @@ bool WebEnginePage::handleMailToUrl (const QUrl &url, NavigationType type) const
         }
 
         //qCDebug(WEBENGINEPART_LOG) << "Emitting openUrlRequest with " << mailtoUrl;
-        emit m_part->browserExtension()->openUrlRequest(mailtoUrl);
+        emit m_part->navigationExtension()->openUrlRequest(mailtoUrl);
         return true;
     }
 
@@ -873,7 +794,7 @@ void WebEnginePage::slotAuthenticationRequired(const QUrl &requestUrl, QAuthenti
 
 void WebEnginePage::changeFullScreenMode(QWebEngineFullScreenRequest req)
 {
-        KParts::BrowserInterface *iface = part()->browserExtension()->browserInterface();
+        KParts::BrowserInterface *iface = part()->navigationExtension()->browserInterface();
         if (iface) {
             req.accept();
             iface->callMethod("toggleCompleteFullScreen", req.toggleOn());
@@ -990,7 +911,7 @@ bool NewWindowPage::acceptNavigationRequest(const QUrl &url, NavigationType type
         KParts::WindowArgs wargs (m_windowArgs);
 
         KParts::ReadOnlyPart* newWindowPart =nullptr;
-        emit part()->browserExtension()->createNewWindow(QUrl(), uargs, bargs, wargs, &newWindowPart);
+        emit part()->navigationExtension()->createNewWindow(QUrl(), uargs, bargs, wargs, &newWindowPart);
         qCDebug(WEBENGINEPART_LOG) << "Created new window" << newWindowPart;
 
         if (!newWindowPart) {
@@ -1016,7 +937,7 @@ bool NewWindowPage::acceptNavigationRequest(const QUrl &url, NavigationType type
         //Set the create new window flag to false...
         m_createNewWindow = false;
         if (webenginePart) {
-            QTimer::singleShot(0, webenginePart, [webenginePart, url](){emit webenginePart->browserExtension()->openUrlRequest(url);});
+            QTimer::singleShot(0, webenginePart, [webenginePart, url](){emit webenginePart->navigationExtension()->openUrlRequest(url);});
             return false;
         }
 
@@ -1083,7 +1004,7 @@ void NewWindowPage::slotLoadFinished(bool ok)
     KParts::WindowArgs wargs (m_windowArgs);
 
     KParts::ReadOnlyPart* newWindowPart =nullptr;
-    emit part()->browserExtension()->createNewWindow(QUrl(), uargs, bargs, wargs, &newWindowPart);
+    emit part()->navigationExtension()->createNewWindow(QUrl(), uargs, bargs, wargs, &newWindowPart);
 
     qCDebug(WEBENGINEPART_LOG) << "Created new window or tab" << newWindowPart;
 
diff --git a/webenginepart/src/webenginepage.h b/webenginepart/src/webenginepage.h
index b175992bf4..8d69e2a9c9 100644
--- a/webenginepart/src/webenginepage.h
+++ b/webenginepart/src/webenginepage.h
@@ -15,7 +15,7 @@
 #include "kwebenginepartlib_export.h"
 #include "qtwebengine6compat.h"
 
-#include <KParts/BrowserExtension>
+#include "kf5compat.h" //For NavigationExtension
 #include <QWebEnginePage>
 
 #include <QUrl>
@@ -56,17 +56,6 @@ public:
 
     void setStatusBarText(const QString &text);
 
-    /**
-    * @brief Tells the page that the part has requested to load the given URL
-    *
-    * @note Calling this function doesn't cause the page to be loaded: you still need to call load() to do so.
-    * @see m_urlRequestedByApp
-    * @param url the requested URL
-    */
-//     void markUrlAsRequestedByApp(const QUrl &url){m_urlRequestedByApp = url;}
-
-//     void forceLoadingOfUrl(const QUrl &url){m_forcedUrl = url;}
-
     /**
      * @brief Sets the webengine part to be used by this object.
      * @param part the part
@@ -160,7 +149,6 @@ protected Q_SLOTS:
 
 protected Q_SLOTS:
     void slotLoadFinished(bool ok);
-    void slotUnsupportedContent(QNetworkReply* reply);
     virtual void slotGeometryChangeRequested(const QRect& rect);
     void slotFeaturePermissionRequested(const QUrl& url, QWebEnginePage::Feature feature);
     void slotAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth);
@@ -168,7 +156,6 @@ protected Q_SLOTS:
     void changeLifecycleState(QWebEnginePage::LifecycleState recommendedState);
 
 private:
-    bool checkLinkSecurity(const QNetworkRequest& req, NavigationType type) const;
     bool checkFormData(const QUrl& url) const;
     bool handleMailToUrl (const QUrl& , NavigationType type) const;
     void setPageJScriptPolicy(const QUrl& url);
@@ -225,7 +212,7 @@ private:
     QTimer *m_dropOperationTimer;
 #endif
 
-    QMultiHash<QUrl, QWebEngineDownloadItem*> m_downloadItems;
+    QMultiHash<QUrl, QWebEngineDownloadRequest*> m_downloadItems;
 };
 
 
diff --git a/webenginepart/src/webenginepart.cpp b/webenginepart/src/webenginepart.cpp
index 794cc73edb..906b89046e 100644
--- a/webenginepart/src/webenginepart.cpp
+++ b/webenginepart/src/webenginepart.cpp
@@ -66,7 +66,6 @@
 #include <KIO/ApplicationLauncherJob>
 
 #include <QFile>
-#include <QTextCodec>
 #include <QCoreApplication>
 #include <QVBoxLayout>
 #include <QDBusInterface>
@@ -74,6 +73,9 @@
 #include <QStatusBar>
 #include <QWebEngineScriptCollection>
 #include <QDir>
+#if QT_VERSION_MAJOR > 5
+#include <QWebEngineFindTextResult>
+#endif
 
 #include "utils.h"
 #include <kio_version.h>
@@ -81,7 +83,11 @@
 WebEnginePart::WebEnginePart(QWidget *parentWidget, QObject *parent,
                          const KPluginMetaData& metaData,
                          const QByteArray& cachedHistory, const QStringList& /*args*/)
+#if QT_VERSION_MAJOR < 6
             :KParts::ReadOnlyPart(parent),
+#else
+            :KParts::ReadOnlyPart(parent, metaData),
+#endif
              m_emitOpenUrlNotify(true),
              m_walletData{false, false, false},
              m_doLoadFinishedActions(false),
@@ -97,10 +103,9 @@ WebEnginePart::WebEnginePart(QWidget *parentWidget, QObject *parent,
 
     connect(WebEnginePartControls::self(), &WebEnginePartControls::userAgentChanged, this, &WebEnginePart::reloadAfterUAChange);
 
-    //Used by KonqInterfaces::DownloaderExtension::downloader()
-    setProperty("DownloaderExtension", QVariant::fromValue(WebEnginePartControls::self()->downloadManager()));
-
+#if QT_VERSION_MAJOR < 6
     setMetaData(metaData);
+#endif
 
 #if 0
     // NOTE: If the application does not set its version number, we automatically
@@ -122,7 +127,7 @@ WebEnginePart::WebEnginePart(QWidget *parentWidget, QObject *parent,
     m_webView = new WebEngineView (this, parentWidget);
 
     // Create the browser extension.
-    m_browserExtension = new WebEngineBrowserExtension(this, cachedHistory);
+    m_browserExtension = new WebEngineNavigationExtension(this, cachedHistory);
 
     // Add status bar extension...
     m_statusBarExtension = new KParts::StatusBarExtension(this);
@@ -203,30 +208,30 @@ SpellCheckerManager * WebEnginePart::spellCheckerManager()
 
 void WebEnginePart::initActions()
 {
-    QAction *action = actionCollection()->addAction(KStandardAction::SaveAs, QLatin1String("saveDocument"), m_browserExtension, &WebEngineBrowserExtension::slotSaveDocument);
+    QAction *action = actionCollection()->addAction(KStandardAction::SaveAs, QLatin1String("saveDocument"), m_browserExtension, &WebEngineNavigationExtension::slotSaveDocument);
 
     action = new QAction(QIcon::fromTheme(QStringLiteral("document-save-as")), i18n("Save Full HTML Page As..."), this);
     actionCollection()->addAction(QStringLiteral("saveFullHtmlPage"), action);
-    connect(action, &QAction::triggered, m_browserExtension, &WebEngineBrowserExtension::slotSaveFullHTMLPage);
+    connect(action, &QAction::triggered, m_browserExtension, &WebEngineNavigationExtension::slotSaveFullHTMLPage);
 
     action = new QAction(QIcon::fromTheme(QStringLiteral("document-print-preview")), i18n("Print Preview"), this);
     actionCollection()->addAction(QStringLiteral("printPreview"), action);
-    connect(action, &QAction::triggered, m_browserExtension, &WebEngineBrowserExtension::slotPrintPreview);
+    connect(action, &QAction::triggered, m_browserExtension, &WebEngineNavigationExtension::slotPrintPreview);
 
     action = new QAction(QIcon::fromTheme(QStringLiteral("zoom-in")), i18nc("zoom in action", "Zoom In"), this);
     actionCollection()->addAction(QStringLiteral("zoomIn"), action);
     actionCollection()->setDefaultShortcuts(action, QList<QKeySequence> () << QKeySequence(QStringLiteral("CTRL++")) << QKeySequence(QStringLiteral("CTRL+=")));
-    connect(action, &QAction::triggered, m_browserExtension, &WebEngineBrowserExtension::zoomIn);
+    connect(action, &QAction::triggered, m_browserExtension, &WebEngineNavigationExtension::zoomIn);
 
     action = new QAction(QIcon::fromTheme(QStringLiteral("zoom-out")), i18nc("zoom out action", "Zoom Out"), this);
     actionCollection()->addAction(QStringLiteral("zoomOut"), action);
     actionCollection()->setDefaultShortcuts(action, QList<QKeySequence> () << QKeySequence(QStringLiteral("CTRL+-")) << QKeySequence(QStringLiteral("CTRL+_")));
-    connect(action, &QAction::triggered, m_browserExtension, &WebEngineBrowserExtension::zoomOut);
+    connect(action, &QAction::triggered, m_browserExtension, &WebEngineNavigationExtension::zoomOut);
 
     action = new QAction(QIcon::fromTheme(QStringLiteral("zoom-original")), i18nc("reset zoom action", "Actual Size"), this);
     actionCollection()->addAction(QStringLiteral("zoomNormal"), action);
     actionCollection()->setDefaultShortcut(action, QKeySequence(QStringLiteral("CTRL+0")));
-    connect(action, &QAction::triggered, m_browserExtension, &WebEngineBrowserExtension::zoomNormal);
+    connect(action, &QAction::triggered, m_browserExtension, &WebEngineNavigationExtension::zoomNormal);
 
     action = new QAction(i18n("Zoom Text Only"), this);
     action->setCheckable(true);
@@ -234,17 +239,17 @@ void WebEnginePart::initActions()
     bool zoomTextOnly = cgHtml.readEntry("ZoomTextOnly", false);
     action->setChecked(zoomTextOnly);
     actionCollection()->addAction(QStringLiteral("zoomTextOnly"), action);
-    connect(action, &QAction::triggered, m_browserExtension, &WebEngineBrowserExtension::toogleZoomTextOnly);
+    connect(action, &QAction::triggered, m_browserExtension, &WebEngineNavigationExtension::toogleZoomTextOnly);
 
     action = new QAction(i18n("Zoom To DPI"), this);
     action->setCheckable(true);
     bool zoomToDPI = cgHtml.readEntry("ZoomToDPI", false);
     action->setChecked(zoomToDPI);
     actionCollection()->addAction(QStringLiteral("zoomToDPI"), action);
-    connect(action, &QAction::triggered, m_browserExtension, &WebEngineBrowserExtension::toogleZoomToDPI);
+    connect(action, &QAction::triggered, m_browserExtension, &WebEngineNavigationExtension::toogleZoomToDPI);
 
 
-    action = KStandardAction::create(KStandardAction::SelectAll, m_browserExtension, &WebEngineBrowserExtension::slotSelectAll,
+    action = KStandardAction::create(KStandardAction::SelectAll, m_browserExtension, &WebEngineNavigationExtension::slotSelectAll,
                                      actionCollection());
     action->setShortcutContext(Qt::WidgetShortcut);
     m_webView->addAction(action);
@@ -255,7 +260,7 @@ void WebEnginePart::initActions()
     action = new QAction(i18n("View Do&cument Source"), this);
     actionCollection()->addAction(QStringLiteral("viewDocumentSource"), action);
     actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::CTRL | Qt::Key_U));
-    connect(action, &QAction::triggered, m_browserExtension, &WebEngineBrowserExtension::slotViewDocumentSource);
+    connect(action, &QAction::triggered, m_browserExtension, &WebEngineNavigationExtension::slotViewDocumentSource);
 
     action = new QAction(i18nc("Secure Sockets Layer", "SSL"), this);
     actionCollection()->addAction(QStringLiteral("security"), action);
@@ -297,8 +302,8 @@ void WebEnginePart::connectWebEnginePageSignals(WebEnginePage* page)
     connect(page, &WebEnginePage::loadAborted, this, &WebEnginePart::slotLoadAborted);
     connect(page, &QWebEnginePage::linkHovered, this, &WebEnginePart::slotLinkHovered);
     connect(page, &QWebEnginePage::windowCloseRequested, this, &WebEnginePart::slotWindowCloseRequested);
-    connect(page, &QWebEnginePage::loadProgress, m_browserExtension, &KParts::BrowserExtension::loadingProgress);
-    connect(page, &QWebEnginePage::selectionChanged, m_browserExtension, &WebEngineBrowserExtension::updateEditActions);
+    connect(page, &QWebEnginePage::loadProgress, m_browserExtension, &KParts::NavigationExtension::loadingProgress);
+    connect(page, &QWebEnginePage::selectionChanged, m_browserExtension, &WebEngineNavigationExtension::updateEditActions);
 //    connect(m_browserExtension, SIGNAL(saveUrl(QUrl)),
 //            page, SLOT(downloadUrl(QUrl)));
 
@@ -689,13 +694,19 @@ void WebEnginePart::slotSearchForText(const QString &text, bool backward)
     if (backward)
         flags |= QWebEnginePage::FindBackward;
 
-    if (m_searchBar->caseSensitive())
+    if (m_searchBar->caseSensitive()) {
         flags |= QWebEnginePage::FindCaseSensitively;
+    }
 
+#if QT_VERSION_MAJOR < 6
+    auto callback = [this](bool found){m_searchBar->setFoundMatch(found);};
+#else
+    auto callback = [this](const QWebEngineFindTextResult &res){m_searchBar->setFoundMatch(res.numberOfMatches() > 0);};
+#endif
     //qCDebug(WEBENGINEPART_LOG) << "search for text:" << text << ", backward ?" << backward;
-    page()->findText(text, flags, [this](bool found) {
-        m_searchBar->setFoundMatch(found);
-    });
+    //TODO KF6: when dropping compatibility with KF5, see whether it's better to connect to the
+    //QWebEnginePage::findTextFinished signal rather than using the callback
+    page()->findText(text, flags, callback);
 }
 
 void WebEnginePart::slotShowSearchBar()
@@ -1093,3 +1104,10 @@ void WebEnginePart::reloadAfterUAChange(const QString &)
         m_webView->triggerPageAction(QWebEnginePage::Reload);
     }
 }
+
+#if QT_VERSION_MAJOR < 6
+KParts::NavigationExtension* WebEnginePart::navigationExtension() const
+{
+    return browserExtension();
+}
+#endif
diff --git a/webenginepart/src/webenginepart.h b/webenginepart/src/webenginepart.h
index ae934eac8e..015e9886de 100644
--- a/webenginepart/src/webenginepart.h
+++ b/webenginepart/src/webenginepart.h
@@ -12,6 +12,8 @@
 
 #include "kwebenginepartlib_export.h"
 
+#include "kf5compat.h" //For NavigationExtension
+
 #include <QWebEnginePage>
 
 #include <kparts_version.h>
@@ -20,7 +22,8 @@
 #include <QWebEngineScript>
 
 namespace KParts {
-  class BrowserExtension;
+//TODO KF6: when removing compatibility with KF5, uncomment the line below
+  // class NavigationExtension;
   class StatusBarExtension;
 }
 
@@ -32,7 +35,7 @@ class SearchBar;
 class PasswordBar;
 class FeaturePermissionBar;
 class KUrlLabel;
-class WebEngineBrowserExtension;
+class WebEngineNavigationExtension;
 class WebEngineWallet;
 class KPluginMetaData;
 class WebEnginePartControls;
@@ -108,6 +111,10 @@ public:
 
     WebEngineWallet* wallet() const;
 
+#if QT_VERSION_MAJOR < 6
+    KParts::NavigationExtension* navigationExtension() const;
+#endif
+
     /**
      * @brief Changes the page object associated with the part
      *
@@ -215,7 +222,7 @@ private:
     SearchBar* m_searchBar;
     PasswordBar* m_passwordBar;
     QVector<FeaturePermissionBar*> m_permissionBars;
-    WebEngineBrowserExtension* m_browserExtension;
+    WebEngineNavigationExtension* m_browserExtension;
     KParts::StatusBarExtension* m_statusBarExtension;
     WebEngineView* m_webView;
     WebEngineWallet* m_wallet;
diff --git a/webenginepart/src/webenginepart_ext.cpp b/webenginepart/src/webenginepart_ext.cpp
index 22cda99401..bbf93e7940 100644
--- a/webenginepart/src/webenginepart_ext.cpp
+++ b/webenginepart/src/webenginepart_ext.cpp
@@ -9,7 +9,6 @@
 */
 
 #include "webenginepart_ext.h"
-#include <QtWebEngine/QtWebEngineVersion>
 
 #include "webenginepart.h"
 #include "webengineview.h"
@@ -34,7 +33,6 @@
 #include <sonnet/backgroundchecker.h>
 #include <KIO/JobUiDelegate>
 #include <KIO/OpenUrlJob>
-#include <KParts/BrowserRun>
 #include <KEMailClientLauncherJob>
 #include <KIO/JobUiDelegateFactory>
 
@@ -51,6 +49,7 @@
 #include <QPrinterInfo>
 #include <QJsonDocument>
 #include <QJsonArray>
+#include <QStringView>
 
 #define QL1S(x)     QLatin1String(x)
 #define QL1C(x)     QLatin1Char(x)
@@ -76,8 +75,8 @@ InvokeWrapper<Arg, R, C> invoke(R *receiver, void (C::*memberFun)(Arg))
     return InvokeWrapper<Arg, R, C>{receiver, memberFun};
 }
 
-WebEngineBrowserExtension::WebEngineBrowserExtension(WebEnginePart *parent, const QByteArray& cachedHistoryData)
-                       :KParts::BrowserExtension(parent),
+WebEngineNavigationExtension::WebEngineNavigationExtension(WebEnginePart *parent, const QByteArray& cachedHistoryData)
+                       :KParts::NavigationExtension(parent),
                         m_part(parent),
                         mCurrentPrinter(nullptr)
 {
@@ -86,6 +85,10 @@ WebEngineBrowserExtension::WebEngineBrowserExtension(WebEnginePart *parent, cons
     emit enableAction("paste", false);
     emit enableAction("print", true);
 
+#if QT_VERSION_MAJOR >= 6
+    connect(view(), &QWebEngineView::printFinished, this, &WebEngineNavigationExtension::slotHandlePagePrinted);
+#endif
+
     if (cachedHistoryData.isEmpty()) {
         return;
     }
@@ -96,7 +99,7 @@ WebEngineBrowserExtension::WebEngineBrowserExtension(WebEnginePart *parent, cons
         return;
     }
 
-    // NOTE: When restoring history, webengine PORTING_TODO automatically navigates to
+    // NOTE: When restoring history, webengine automatically navigates to
     // the previous "currentItem". Since we do not want that to happen,
     // we set a property on the WebEnginePage object that is used to allow or
     // disallow history navigation in WebEnginePage::acceptNavigationRequest.
@@ -105,11 +108,11 @@ WebEngineBrowserExtension::WebEngineBrowserExtension(WebEnginePart *parent, cons
     s >> *(view()->history());
 }
 
-WebEngineBrowserExtension::~WebEngineBrowserExtension()
+WebEngineNavigationExtension::~WebEngineNavigationExtension()
 {
 }
 
-WebEngineView* WebEngineBrowserExtension::view()
+WebEngineView* WebEngineNavigationExtension::view()
 {
     if (!m_view && m_part) {
         m_view = qobject_cast<WebEngineView*>(m_part->view());
@@ -118,7 +121,7 @@ WebEngineView* WebEngineBrowserExtension::view()
     return m_view;
 }
 
-WebEnginePage* WebEngineBrowserExtension::page()
+WebEnginePage* WebEngineNavigationExtension::page()
 {
     WebEngineView *v = view();
     if (v) {
@@ -128,25 +131,25 @@ WebEnginePage* WebEngineBrowserExtension::page()
     }
 }
 
-int WebEngineBrowserExtension::xOffset()
+int WebEngineNavigationExtension::xOffset()
 {
     if (view()) {
         return view()->page()->scrollPosition().x();
     }
 
-    return KParts::BrowserExtension::xOffset();
+    return KParts::NavigationExtension::xOffset();
 }
 
-int WebEngineBrowserExtension::yOffset()
+int WebEngineNavigationExtension::yOffset()
 {
    if (view()) {
         return view()->page()->scrollPosition().y();
    }
 
-    return KParts::BrowserExtension::yOffset();
+    return KParts::NavigationExtension::yOffset();
 }
 
-void WebEngineBrowserExtension::saveState(QDataStream &stream)
+void WebEngineNavigationExtension::saveState(QDataStream &stream)
 {
     // TODO: Save information such as form data from the current page.
     QWebEngineHistory* history = (view() ? view()->history() : nullptr);
@@ -160,7 +163,7 @@ void WebEngineBrowserExtension::saveState(QDataStream &stream)
            << m_historyData;
 }
 
-void WebEngineBrowserExtension::restoreState(QDataStream &stream)
+void WebEngineNavigationExtension::restoreState(QDataStream &stream)
 {
     QUrl u;
     QByteArray historyData;
@@ -229,25 +232,25 @@ void WebEngineBrowserExtension::restoreState(QDataStream &stream)
 }
 
 
-void WebEngineBrowserExtension::cut()
+void WebEngineNavigationExtension::cut()
 {
     if (view())
         view()->triggerPageAction(QWebEnginePage::Cut);
 }
 
-void WebEngineBrowserExtension::copy()
+void WebEngineNavigationExtension::copy()
 {
     if (view())
         view()->triggerPageAction(QWebEnginePage::Copy);
 }
 
-void WebEngineBrowserExtension::paste()
+void WebEngineNavigationExtension::paste()
 {
     if (view())
         view()->triggerPageAction(QWebEnginePage::Paste);
 }
 
-void WebEngineBrowserExtension::slotSaveDocument()
+void WebEngineNavigationExtension::slotSaveDocument()
 {
     WebEnginePage *pg = page();
     if (pg) {
@@ -256,7 +259,7 @@ void WebEngineBrowserExtension::slotSaveDocument()
     }
 }
 
-void WebEngineBrowserExtension::slotSaveFullHTMLPage()
+void WebEngineNavigationExtension::slotSaveFullHTMLPage()
 {
     WebEnginePage *p = page();
     if (p) {
@@ -264,7 +267,7 @@ void WebEngineBrowserExtension::slotSaveFullHTMLPage()
     }
 }
 
-void WebEngineBrowserExtension::print()
+void WebEngineNavigationExtension::print()
 {
     if (view()) {
         mCurrentPrinter = new QPrinter();
@@ -276,18 +279,22 @@ void WebEngineBrowserExtension::print()
             return;
         }
         delete dialog;
-        view()->page()->print(mCurrentPrinter, invoke(this, &WebEngineBrowserExtension::slotHandlePagePrinted));
+#if QT_VERSION_MAJOR < 6
+        view()->page()->print(mCurrentPrinter, invoke(this, &WebEngineNavigationExtension::slotHandlePagePrinted));
+#else
+        view()->print(mCurrentPrinter);
+#endif
     }
 }
 
-void WebEngineBrowserExtension::slotHandlePagePrinted(bool result)
+void WebEngineNavigationExtension::slotHandlePagePrinted(bool result)
 {
     Q_UNUSED(result);
     delete mCurrentPrinter;
     mCurrentPrinter = nullptr;
 }
 
-void WebEngineBrowserExtension::updateEditActions()
+void WebEngineNavigationExtension::updateEditActions()
 {
     if (!view())
         return;
@@ -297,14 +304,14 @@ void WebEngineBrowserExtension::updateEditActions()
     emit enableAction("paste", view()->pageAction(QWebEnginePage::Paste)->isEnabled());
 }
 
-void WebEngineBrowserExtension::updateActions()
+void WebEngineNavigationExtension::updateActions()
 {
     const QString protocol (m_part->url().scheme());
     const bool isValidDocument = (protocol != QL1S("about") && protocol != QL1S("error") && protocol != QL1S("konq"));
     emit enableAction("print", isValidDocument);
 }
 
-void WebEngineBrowserExtension::searchProvider()
+void WebEngineNavigationExtension::searchProvider()
 {
     if (!view())
         return;
@@ -330,13 +337,13 @@ void WebEngineBrowserExtension::searchProvider()
     emit openUrlRequest(url, KParts::OpenUrlArguments(), bargs);
 }
 
-void WebEngineBrowserExtension::reparseConfiguration()
+void WebEngineNavigationExtension::reparseConfiguration()
 {
     // Force the configuration stuff to reparse...
     WebEngineSettings::self()->init();
 }
 
-void WebEngineBrowserExtension::disableScrolling()
+void WebEngineNavigationExtension::disableScrolling()
 {
     QWebEngineView* currentView = view();
     QWebEnginePage* page = currentView ? currentView->page() : nullptr;
@@ -347,19 +354,19 @@ void WebEngineBrowserExtension::disableScrolling()
     page->runJavaScript(QStringLiteral("document.documentElement.style.overflow = 'hidden';"));
 }
 
-void WebEngineBrowserExtension::zoomIn()
+void WebEngineNavigationExtension::zoomIn()
 {
     if (view())
         view()->setZoomFactor(view()->zoomFactor() + 0.1);
 }
 
-void WebEngineBrowserExtension::zoomOut()
+void WebEngineNavigationExtension::zoomOut()
 {
     if (view())
         view()->setZoomFactor(view()->zoomFactor() - 0.1);
 }
 
-void WebEngineBrowserExtension::zoomNormal()
+void WebEngineNavigationExtension::zoomNormal()
 {
     if (view()) {
         if (WebEngineSettings::self()->zoomToDPI())
@@ -369,7 +376,7 @@ void WebEngineBrowserExtension::zoomNormal()
     }
 }
 
-void WebEngineBrowserExtension::toogleZoomTextOnly()
+void WebEngineNavigationExtension::toogleZoomTextOnly()
 {
     if (!view())
         return;
@@ -382,7 +389,7 @@ void WebEngineBrowserExtension::toogleZoomTextOnly()
     // view()->settings()->setAttribute(QWebEngineSettings::ZoomTextOnly, !zoomTextOnly);
 }
 
-void WebEngineBrowserExtension::toogleZoomToDPI()
+void WebEngineNavigationExtension::toogleZoomToDPI()
 {
     if (!view())
         return;
@@ -399,26 +406,26 @@ void WebEngineBrowserExtension::toogleZoomToDPI()
     WebEngineSettings::self()->computeFontSizes(view()->logicalDpiY());
 }
 
-void WebEngineBrowserExtension::slotSelectAll()
+void WebEngineNavigationExtension::slotSelectAll()
 {
     if (view())
         view()->triggerPageAction(QWebEnginePage::SelectAll);
 }
 
-void WebEngineBrowserExtension::slotSaveImageAs()
+void WebEngineNavigationExtension::slotSaveImageAs()
 {
     if (view())
         view()->triggerPageAction(QWebEnginePage::DownloadImageToDisk);
 }
 
-void WebEngineBrowserExtension::slotSendImage()
+void WebEngineNavigationExtension::slotSendImage()
 {
     if (!view()) {
         return;
     }
 
-    QList<QUrl> urls = {view()->contextMenuResult().mediaUrl()};
-    const QString subject = view()->contextMenuResult().mediaUrl().path();
+    QList<QUrl> urls = {view()->contextMenuResult()->mediaUrl()};
+    const QString subject = view()->contextMenuResult()->mediaUrl().path();
 
     auto *job = new KEMailClientLauncherJob;
     job->setSubject(subject);
@@ -426,13 +433,13 @@ void WebEngineBrowserExtension::slotSendImage()
     job->start();
 }
 
-void WebEngineBrowserExtension::slotCopyImageURL()
+void WebEngineNavigationExtension::slotCopyImageURL()
 {
     if (!view()) {
         return;
     }
 
-    QUrl safeURL = view()->contextMenuResult().mediaUrl();
+    QUrl safeURL = view()->contextMenuResult()->mediaUrl();
     safeURL.setPassword(QString());
     // Set it in both the mouse selection and in the clipboard
     QMimeData* mimeData = new QMimeData;
@@ -448,18 +455,18 @@ void WebEngineBrowserExtension::slotCopyImageURL()
 }
 
 
-void WebEngineBrowserExtension::slotCopyImage()
+void WebEngineNavigationExtension::slotCopyImage()
 {
     if (!view()) {
         return;
     }
 
-    QUrl safeURL; //(view()->contextMenuResult().imageUrl());
+    QUrl safeURL; //(view()->contextMenuResult()->imageUrl());
     safeURL.setPassword(QString());
 
     // Set it in both the mouse selection and in the clipboard
     QMimeData* mimeData = new QMimeData;
-//    mimeData->setImageData(view()->contextMenuResult().pixmap());
+//    mimeData->setImageData(view()->contextMenuResult()->pixmap());
 //TODO: Porting: test
     QList<QUrl> safeURLList;
     safeURLList.append(safeURL);
@@ -467,19 +474,19 @@ void WebEngineBrowserExtension::slotCopyImage()
     QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
 
     mimeData = new QMimeData;
-//    mimeData->setImageData(view()->contextMenuResult().pixmap());
+//    mimeData->setImageData(view()->contextMenuResult()->pixmap());
     mimeData->setUrls(safeURLList);
     QApplication::clipboard()->setMimeData(mimeData, QClipboard::Selection);
 }
 
-void WebEngineBrowserExtension::slotViewImage()
+void WebEngineNavigationExtension::slotViewImage()
 {
     if (view()) {
-        emit createNewWindow(view()->contextMenuResult().mediaUrl());
+        emit createNewWindow(view()->contextMenuResult()->mediaUrl());
     }
 }
 
-void WebEngineBrowserExtension::slotBlockImage()
+void WebEngineNavigationExtension::slotBlockImage()
 {
     if (!view()) {
         return;
@@ -488,7 +495,7 @@ void WebEngineBrowserExtension::slotBlockImage()
     bool ok = false;
     const QString url = QInputDialog::getText(view(), i18n("Add URL to Filter"),
                                               i18n("Enter the URL:"), QLineEdit::Normal,
-                                              view()->contextMenuResult().mediaUrl().toString(),
+                                              view()->contextMenuResult()->mediaUrl().toString(),
                                               &ok);
     if (ok) {
         WebEngineSettings::self()->addAdFilter(url);
@@ -496,54 +503,57 @@ void WebEngineBrowserExtension::slotBlockImage()
     }
 }
 
-void WebEngineBrowserExtension::slotBlockHost()
+void WebEngineNavigationExtension::slotBlockHost()
 {
     if (!view())
         return;
 
-    QUrl url; // (view()->contextMenuResult().imageUrl());
+    QUrl url; // (view()->contextMenuResult()->imageUrl());
     url.setPath(QL1S("/*"));
     WebEngineSettings::self()->addAdFilter(url.toString(QUrl::RemoveUserInfo | QUrl::RemovePort));
     reparseConfiguration();
 }
 
-void WebEngineBrowserExtension::slotCopyLinkURL()
+void WebEngineNavigationExtension::slotCopyLinkURL()
 {
     if (view())
         view()->triggerPageAction(QWebEnginePage::CopyLinkToClipboard);
 }
 
-void WebEngineBrowserExtension::slotCopyLinkText()
+void WebEngineNavigationExtension::slotCopyLinkText()
 {
     if (view()) {
         QMimeData* data = new QMimeData;
-        data->setText(view()->contextMenuResult().linkText());
+        data->setText(view()->contextMenuResult()->linkText());
         QApplication::clipboard()->setMimeData(data, QClipboard::Clipboard);
     }
 }
 
-void WebEngineBrowserExtension::slotCopyEmailAddress()
+void WebEngineNavigationExtension::slotCopyEmailAddress()
 {
     if (view()) {
         QMimeData* data = new QMimeData;
-        const QUrl url(view()->contextMenuResult().linkUrl());
+        const QUrl url(view()->contextMenuResult()->linkUrl());
         data->setText(url.path());
         QApplication::clipboard()->setMimeData(data, QClipboard::Clipboard);
     }
 }
 
-void WebEngineBrowserExtension::slotSaveLinkAs(const QUrl &url)
+void WebEngineNavigationExtension::slotSaveLinkAs(const QUrl &url)
 {
-    if (view()) {
-        if (!url.isEmpty()) {
-            KParts::BrowserRun::saveUrl(url, url.path(), view(), KParts::OpenUrlArguments());
-        } else {
-            view()->triggerPageAction(QWebEnginePage::DownloadLinkToDisk);
+    if (!view()) {
+        return;
+    }
+    if (!url.isEmpty()) {
+        WebEnginePage *pg = qobject_cast<WebEnginePage*>(view()->page());
+        if (pg) {
+            WebEnginePartControls::self()->downloadManager()->setForceDownload(url, pg);
         }
     }
+    view()->triggerPageAction(QWebEnginePage::DownloadLinkToDisk);
 }
 
-void WebEngineBrowserExtension::slotViewDocumentSource()
+void WebEngineNavigationExtension::slotViewDocumentSource()
 {
     if (!view())
         return;
@@ -570,62 +580,62 @@ void WebEngineBrowserExtension::slotViewDocumentSource()
     }
 }
 
-static bool isMultimediaElement(QWebEngineContextMenuData::MediaType mediaType)
+static bool isMultimediaElement(QWebEngineContextMenuRequest::MediaType mediaType)
 {
     switch(mediaType)
     {
-        case QWebEngineContextMenuData::MediaTypeVideo:
-        case QWebEngineContextMenuData::MediaTypeAudio:
+        case QWebEngineContextMenuRequest::MediaTypeVideo:
+        case QWebEngineContextMenuRequest::MediaTypeAudio:
             return true;
         default:
             return false;
     }
 }
 
-void WebEngineBrowserExtension::slotLoopMedia()
+void WebEngineNavigationExtension::slotLoopMedia()
 {
     if (!view()) {
         return;
     }
 
-    QWebEngineContextMenuData data =  view()->contextMenuResult();
-    if (!isMultimediaElement( data.mediaType()))
+    const QWebEngineContextMenuRequest *data =  view()->contextMenuResult();
+    if (!isMultimediaElement( data->mediaType()))
         return;
     view()->page()->triggerAction(QWebEnginePage::ToggleMediaLoop);
 }
 
-void WebEngineBrowserExtension::slotMuteMedia()
+void WebEngineNavigationExtension::slotMuteMedia()
 {
     if (!view()) {
         return;
     }
 
-    QWebEngineContextMenuData data =  view()->contextMenuResult();
-    if (!isMultimediaElement( data.mediaType()))
+    const QWebEngineContextMenuRequest *data =  view()->contextMenuResult();
+    if (!isMultimediaElement( data->mediaType()))
         return;
     view()->page()->triggerAction(QWebEnginePage::ToggleMediaMute);
 }
 
-void WebEngineBrowserExtension::slotPlayMedia()
+void WebEngineNavigationExtension::slotPlayMedia()
 {
     if (!view()) {
         return;
     }
 
-    QWebEngineContextMenuData data =  view()->contextMenuResult();
-    if (!isMultimediaElement( data.mediaType()))
+    const QWebEngineContextMenuRequest *data =  view()->contextMenuResult();
+    if (!isMultimediaElement( data->mediaType()))
         return;
     view()->page()->triggerAction(QWebEnginePage::ToggleMediaPlayPause);
 }
 
-void WebEngineBrowserExtension::slotShowMediaControls()
+void WebEngineNavigationExtension::slotShowMediaControls()
 {
     if (!view()) {
         return;
     }
 
-    QWebEngineContextMenuData data =  view()->contextMenuResult();
-    if (!isMultimediaElement( data.mediaType()))
+    const QWebEngineContextMenuRequest *data =  view()->contextMenuResult();
+    if (!isMultimediaElement( data->mediaType()))
         return;
     view()->page()->triggerAction(QWebEnginePage::ToggleMediaControls);
 }
@@ -645,31 +655,31 @@ static QUrl mediaUrlFrom(QWebElement& element)
 }
 #endif
 
-void WebEngineBrowserExtension::slotSaveMedia()
+void WebEngineNavigationExtension::slotSaveMedia()
 {
     WebEnginePage *pg = page();
-    QWebEngineContextMenuData data =  view()->contextMenuResult();
-    if (!isMultimediaElement( data.mediaType())) {
+    const QWebEngineContextMenuRequest *data =  view()->contextMenuResult();
+    if (!isMultimediaElement( data->mediaType())) {
         return;
     }
     if (pg) {
-        if (data.mediaUrl().isValid()) {
-            WebEnginePartControls::self()->downloadManager()->setForceDownload(data.mediaUrl(), pg);
+        if (data->mediaUrl().isValid()) {
+            WebEnginePartControls::self()->downloadManager()->setForceDownload(data->mediaUrl(), pg);
         }
         pg->triggerAction(QWebEnginePage::DownloadMediaToDisk);
     }
 }
 
-void WebEngineBrowserExtension::slotCopyMedia()
+void WebEngineNavigationExtension::slotCopyMedia()
 {
     if (!view()) {
         return;
     }
-    QWebEngineContextMenuData data =  view()->contextMenuResult();
-    if (!isMultimediaElement( data.mediaType()))
+    const QWebEngineContextMenuRequest *data =  view()->contextMenuResult();
+    if (!isMultimediaElement( data->mediaType()))
         return;
 
-    QUrl safeURL(data.mediaUrl());
+    QUrl safeURL(data->mediaUrl());
     if (!safeURL.isValid())
         return;
 
@@ -687,7 +697,7 @@ void WebEngineBrowserExtension::slotCopyMedia()
     QApplication::clipboard()->setMimeData(mimeData, QClipboard::Selection);
 }
 
-void WebEngineBrowserExtension::slotTextDirectionChanged()
+void WebEngineNavigationExtension::slotTextDirectionChanged()
 {
     QAction* action = qobject_cast<QAction*>(sender());
     if (action) {
@@ -699,7 +709,7 @@ void WebEngineBrowserExtension::slotTextDirectionChanged()
     }
 }
 
-void WebEngineBrowserExtension::slotCheckSpelling()
+void WebEngineNavigationExtension::slotCheckSpelling()
 {
     view()->page()->runJavaScript(QL1S("this.value"), [this](const QVariant &value) {
         const QString text = value.toString();
@@ -712,15 +722,15 @@ void WebEngineBrowserExtension::slotCheckSpelling()
             backgroundSpellCheck->setParent(spellDialog);
             spellDialog->setAttribute(Qt::WA_DeleteOnClose, true);
             spellDialog->showSpellCheckCompletionMessage(true);
-            connect(spellDialog, &Sonnet::Dialog::replace, this, &WebEngineBrowserExtension::spellCheckerCorrected);
-            connect(spellDialog, &Sonnet::Dialog::misspelling, this, &WebEngineBrowserExtension::spellCheckerMisspelling);
+            connect(spellDialog, &Sonnet::Dialog::replace, this, &WebEngineNavigationExtension::spellCheckerCorrected);
+            connect(spellDialog, &Sonnet::Dialog::misspelling, this, &WebEngineNavigationExtension::spellCheckerMisspelling);
             spellDialog->setBuffer(text);
             spellDialog->show();
         }
     });
 }
 
-void WebEngineBrowserExtension::slotSpellCheckSelection()
+void WebEngineNavigationExtension::slotSpellCheckSelection()
 {
     view()->page()->runJavaScript(QL1S("this.value"), [this](const QVariant &value) {
         const QString text = value.toString();
@@ -728,8 +738,8 @@ void WebEngineBrowserExtension::slotSpellCheckSelection()
             view()->page()->runJavaScript(QL1S("this.selectionStart + ' ' + this.selectionEnd"), [this, text](const QVariant &value) {
                 const QString values = value.toString();
                 const int pos = values.indexOf(' ');
-                m_spellTextSelectionStart = qMax(0, values.leftRef(pos).toInt());
-                m_spellTextSelectionEnd = qMax(0, values.midRef(pos + 1).toInt());
+                m_spellTextSelectionStart = qMax(0, QStringView{values}.left(pos).toInt());
+                m_spellTextSelectionEnd = qMax(0, QStringView{values}.mid(pos + 1).toInt());
                 // qCDebug(WEBENGINEPART_LOG) << "selection start:" << m_spellTextSelectionStart << "end:" << m_spellTextSelectionEnd;
 
                 Sonnet::BackgroundChecker *backgroundSpellCheck = new Sonnet::BackgroundChecker;
@@ -737,9 +747,9 @@ void WebEngineBrowserExtension::slotSpellCheckSelection()
                 backgroundSpellCheck->setParent(spellDialog);
                 spellDialog->setAttribute(Qt::WA_DeleteOnClose, true);
                 spellDialog->showSpellCheckCompletionMessage(true);
-                connect(spellDialog, &Sonnet::Dialog::replace, this, &WebEngineBrowserExtension::spellCheckerCorrected);
-                connect(spellDialog, &Sonnet::Dialog::misspelling, this, &WebEngineBrowserExtension::spellCheckerMisspelling);
-                connect(spellDialog, &Sonnet::Dialog::spellCheckDone, this, &WebEngineBrowserExtension::slotSpellCheckDone);
+                connect(spellDialog, &Sonnet::Dialog::replace, this, &WebEngineNavigationExtension::spellCheckerCorrected);
+                connect(spellDialog, &Sonnet::Dialog::misspelling, this, &WebEngineNavigationExtension::spellCheckerMisspelling);
+                connect(spellDialog, &Sonnet::Dialog::spellCheckDone, this, &WebEngineNavigationExtension::slotSpellCheckDone);
                 spellDialog->setBuffer(text.mid(m_spellTextSelectionStart, (m_spellTextSelectionEnd - m_spellTextSelectionStart)));
                 spellDialog->show();
             });
@@ -747,7 +757,7 @@ void WebEngineBrowserExtension::slotSpellCheckSelection()
     });
 }
 
-void WebEngineBrowserExtension::spellCheckerCorrected(const QString& original, int pos, const QString& replacement)
+void WebEngineNavigationExtension::spellCheckerCorrected(const QString& original, int pos, const QString& replacement)
 {
     // Adjust the selection end...
     if (m_spellTextSelectionEnd > 0) {
@@ -767,7 +777,7 @@ void WebEngineBrowserExtension::spellCheckerCorrected(const QString& original, i
     view()->page()->runJavaScript(script);
 }
 
-void WebEngineBrowserExtension::spellCheckerMisspelling(const QString& text, int pos)
+void WebEngineNavigationExtension::spellCheckerMisspelling(const QString& text, int pos)
 {
     // qCDebug(WEBENGINEPART_LOG) << text << pos;
     QString selectionScript (QL1S("this.setSelectionRange("));
@@ -778,7 +788,7 @@ void WebEngineBrowserExtension::spellCheckerMisspelling(const QString& text, int
     view()->page()->runJavaScript(selectionScript);
 }
 
-void WebEngineBrowserExtension::slotSpellCheckDone(const QString&)
+void WebEngineNavigationExtension::slotSpellCheckDone(const QString&)
 {
     // Restore the text selection if one was present before we started the
     // spell check.
@@ -792,7 +802,7 @@ void WebEngineBrowserExtension::slotSpellCheckDone(const QString&)
     }
 }
 
-void WebEngineBrowserExtension::saveHistory()
+void WebEngineNavigationExtension::saveHistory()
 {
     QWebEngineHistory* history = (view() ? view()->history() : nullptr);
 
@@ -817,21 +827,26 @@ void WebEngineBrowserExtension::saveHistory()
     }
 }
 
-void WebEngineBrowserExtension::slotPrintPreview()
+void WebEngineNavigationExtension::slotPrintPreview()
 {
     QPrinter printer;
     QPrintPreviewDialog dlg(&printer, view());
     auto printPreview = [this](QPrinter *p){
         QEventLoop loop;
         auto preview = [&](bool) {loop.quit();};
+#if QT_VERSION_MAJOR < 6
         m_view->page()->print(p, preview);
+#else
+        m_view->print(p);
+        connect(m_view, &QWebEngineView::printFinished, &loop, preview);
+#endif
         loop.exec();
     };
     connect(&dlg, &QPrintPreviewDialog::paintRequested, this, printPreview);
     dlg.exec();
 }
 
-void WebEngineBrowserExtension::slotOpenSelection()
+void WebEngineNavigationExtension::slotOpenSelection()
 {
     QAction *action = qobject_cast<QAction*>(sender());
     if (action) {
@@ -841,7 +856,7 @@ void WebEngineBrowserExtension::slotOpenSelection()
     }
 }
 
-void WebEngineBrowserExtension::slotLinkInTop()
+void WebEngineNavigationExtension::slotLinkInTop()
 {
     if (!view()) {
         return;
@@ -853,7 +868,7 @@ void WebEngineBrowserExtension::slotLinkInTop()
     KParts::BrowserArguments bargs;
     bargs.frameName = QL1S("_top");
 
-    const QUrl url(view()->contextMenuResult().linkUrl());
+    const QUrl url(view()->contextMenuResult()->linkUrl());
 
     emit openUrlRequest(url, uargs, bargs);
 }
@@ -918,19 +933,6 @@ WebEngineHtmlExtension::WebEngineHtmlExtension(WebEnginePart* part)
 {
 }
 
-QWebEngineScript WebEngineHtmlExtension::querySelectorScript()
-{
-    static QWebEngineScript s_selectorScript;
-    if (s_selectorScript.isNull()) {
-        QFile jsfile(":/queryselector.js");
-        jsfile.open(QIODevice::ReadOnly);
-        s_selectorScript.setSourceCode(QString(jsfile.readAll()));
-        s_selectorScript.setInjectionPoint(QWebEngineScript::DocumentCreation);
-        s_selectorScript.setWorldId(QWebEngineScript::ApplicationWorld);
-    }
-    return s_selectorScript;
-}
-
 QUrl WebEngineHtmlExtension::baseUrl() const
 {
     return part()->view()->page()->url();
diff --git a/webenginepart/src/webenginepart_ext.h b/webenginepart/src/webenginepart_ext.h
index d5a2e7293c..82ca368d54 100644
--- a/webenginepart/src/webenginepart_ext.h
+++ b/webenginepart/src/webenginepart_ext.h
@@ -16,7 +16,7 @@
 
 #include <QPointer>
 
-#include <KParts/BrowserExtension>
+#include "kf5compat.h" //For NavigationExtension
 #include <KParts/SelectorInterface>
 
 #include <asyncselectorinterface.h>
@@ -32,13 +32,13 @@ class QPrinter;
 class QJsonObject;
 class QWebEngineScript;
 
-class KWEBENGINEPARTLIB_EXPORT WebEngineBrowserExtension : public KParts::BrowserExtension
+class KWEBENGINEPARTLIB_EXPORT WebEngineNavigationExtension : public KParts::NavigationExtension
 {
     Q_OBJECT
 
 public:
-    WebEngineBrowserExtension(WebEnginePart *parent, const QByteArray& cachedHistoryData);
-    ~WebEngineBrowserExtension() override;
+    WebEngineNavigationExtension(WebEnginePart *parent, const QByteArray& cachedHistoryData);
+    ~WebEngineNavigationExtension() override;
 
     int xOffset() override;
     int yOffset() override;
@@ -169,13 +169,6 @@ public:
     QVariant htmlSettingsProperty(HtmlSettingsType type) const override;
     bool setHtmlSettingsProperty(HtmlSettingsType type, const QVariant& value) override;
 
-    /**
-     * @brief The script containing the definition of the JS functions to call to execute CSS queries
-     * @return the script object
-     * @warning To be used only by WebEnginePartControls
-     */
-    static QWebEngineScript querySelectorScript();
-
 private:
     WebEnginePart* part() const;
 
diff --git a/webenginepart/src/webenginepartcertificateerrordlg.cpp b/webenginepart/src/webenginepartcertificateerrordlg.cpp
index 6ea37c9bae..c89d56e64a 100644
--- a/webenginepart/src/webenginepartcertificateerrordlg.cpp
+++ b/webenginepart/src/webenginepartcertificateerrordlg.cpp
@@ -45,7 +45,12 @@ WebEnginePartCertificateErrorDlg::WebEnginePartCertificateErrorDlg(const QWebEng
     m_ui->buttons->button(QDialogButtonBox::YesToAll)->setText(i18nc("Ignore the certificate error for this URL now and in the future", "Yes, &forever"));
     m_ui->details->hide();
 
-    QString translatedDesc = i18n(m_error.errorDescription().toUtf8());
+    //According to the documentation, QWebEngineCertificateError::description() returns a localized string
+#if QT_VERSION_MAJOR < 6
+    QString translatedDesc = m_error.errorDescription().toUtf8();
+#else
+    QString translatedDesc = m_error.description().toUtf8();
+#endif
     QString text = i18n("<p>The server <tt>%1</tt> failed the authenticity check. The error is:</p><p><tt>%2</tt></p>Do you want to ignore this error?",
                         m_error.url().host(), translatedDesc);
     m_ui->label->setText(text);
diff --git a/webenginepart/src/webenginepartcontrols.cpp b/webenginepart/src/webenginepartcontrols.cpp
index 0f86852145..fd5620b850 100644
--- a/webenginepart/src/webenginepartcontrols.cpp
+++ b/webenginepart/src/webenginepartcontrols.cpp
@@ -94,7 +94,7 @@ void WebEnginePartControls::registerScripts()
         QJsonObject scriptData = it.value().toObject();
         Q_ASSERT(!scriptData.isEmpty());
         QWebEngineScript script = scriptFromJson(it.key(), scriptData);
-        if (!script.isNull()) {
+        if (!script.name().isEmpty()) {
             m_profile->scripts()->insert(script);
         }
     }
@@ -204,7 +204,10 @@ QString WebEnginePartControls::determineHttpAcceptLanguageHeader() const
     }
     QStringList languages = lang.split(':');
     QString header = languages.at(0);
-    int max = std::min(languages.length(), 10);
+    //In Qt6, QList::length() returns a qsizetype, which means you can't pass it to std::min.
+    //Casting it to an int shouldn't be a problem, since the number of languages should be
+    //small
+    int max = std::min(static_cast<int>(languages.length()), 10);
     //The counter starts from 1 because the first entry has already been inserted above
     for (int i = 1; i < max; ++i) {
         header.append(QString(", %1;q=0.%2").arg(languages.at(i)).arg(10-i));
diff --git a/webenginepart/src/webenginepartcontrols.h b/webenginepart/src/webenginepartcontrols.h
index 87f2f8757a..1b23b240d0 100644
--- a/webenginepart/src/webenginepartcontrols.h
+++ b/webenginepart/src/webenginepartcontrols.h
@@ -130,7 +130,7 @@ private:
      * @brief Creates a QWebEngineScript from it's JSON description and its name
      * @param name the name to give to the script (will be passed to QWebEngineScript::setName()
      * @param obj the JSON object describing the script
-     * @return the script object
+     * @return the script object. If script creation fails for any reason, the name of the script will be empty
      * @see registerScripts() for the description of the fields in @p object
      */
     static QWebEngineScript scriptFromJson(const QString &name, const QJsonObject &obj);
diff --git a/webenginepart/src/webenginepartdownloadmanager.cpp b/webenginepart/src/webenginepartdownloadmanager.cpp
index 6614fbf52b..665699eea1 100644
--- a/webenginepart/src/webenginepartdownloadmanager.cpp
+++ b/webenginepart/src/webenginepartdownloadmanager.cpp
@@ -25,7 +25,6 @@
 #include <QDialog>
 
 #include <KLocalizedString>
-#include <KNotificationJobUiDelegate>
 #include <KJobTrackerInterface>
 #include <KIO/JobTracker>
 #include <KIO/OpenUrlJob>
@@ -258,10 +257,17 @@ bool WebEngineDownloadJob::doSuspend()
     return true;
 }
 
+#if QT_VERSION_MAJOR < 6
 void WebEngineDownloadJob::downloadProgressed(quint64 received, quint64 total)
 {
-    setPercent(received*100.0/total);
+    setPercent(total != 0 ? received*100.0/total : 0);
 }
+#else
+void WebEngineDownloadJob::downloadProgressed()
+{
+    setPercent(m_downloadItem->totalBytes() != 0 ? m_downloadItem->receivedBytes()*100/m_downloadItem->totalBytes() : 0);
+}
+#endif
 
 void WebEngineDownloadJob::stateChanged(QWebEngineDownloadRequest::DownloadState state)
 {
@@ -295,11 +301,20 @@ void WebEngineDownloadJob::startDownloading()
     //This means that, for small files, it's possible that when WebEngineDownloadJob::start is called, the download will already have been
     //completed. In that case, set the download progress to 100% and emit the result() signal
     if (!m_downloadItem->isFinished()) {
+#if QT_VERSION_MAJOR < 6
         connect(m_downloadItem, &QWebEngineDownloadRequest::downloadProgress, this, &WebEngineDownloadJob::downloadProgressed);
         connect(m_downloadItem, &QWebEngineDownloadRequest::finished, this, &WebEngineDownloadJob::downloadFinished);
+#else
+        connect(m_downloadItem, &QWebEngineDownloadRequest::receivedBytesChanged, this, &WebEngineDownloadJob::downloadProgressed);
+        connect(m_downloadItem, &QWebEngineDownloadRequest::isFinishedChanged, this, &WebEngineDownloadJob::downloadFinished);
+#endif
         m_downloadItem->resume();
     } else {
+#if QT_VERSION_MAJOR < 6
         downloadProgressed(m_downloadItem->receivedBytes(), m_downloadItem->totalBytes());
+#else
+        downloadProgressed();
+#endif
         emitResult();
     }
 }
diff --git a/webenginepart/src/webenginepartdownloadmanager.h b/webenginepart/src/webenginepartdownloadmanager.h
index 5536f403db..d5992bb122 100644
--- a/webenginepart/src/webenginepartdownloadmanager.h
+++ b/webenginepart/src/webenginepartdownloadmanager.h
@@ -15,6 +15,7 @@
 #include <QDateTime>
 #include <QSet>
 #include <KJob>
+#include <QPointer>
 
 #include "qtwebengine6compat.h"
 
@@ -115,7 +116,12 @@ protected:
     bool doSuspend() override;
 
 private slots:
+#if QT_VERSION_MAJOR < 6
     void downloadProgressed(quint64 received, quint64 total);
+#else
+    void downloadProgressed();
+#endif
+
     void stateChanged(QWebEngineDownloadRequest::DownloadState state);
     void startDownloading();
     void downloadFinished();
diff --git a/webenginepart/src/webenginepartfactory.cpp b/webenginepart/src/webenginepartfactory.cpp
index 701fed969e..8d0d135981 100644
--- a/webenginepart/src/webenginepartfactory.cpp
+++ b/webenginepart/src/webenginepartfactory.cpp
@@ -33,9 +33,9 @@ QObject *WebEngineFactory::create(const char* iface, QWidget *parentWidget, QObj
     QByteArray histData (m_historyBufContainer.value(parentWidget));
     if (!histData.isEmpty()) histData = qUncompress(histData);
     WebEnginePart* part = new WebEnginePart(parentWidget, parent, metaData(), histData);
-    WebEngineBrowserExtension* ext = qobject_cast<WebEngineBrowserExtension*>(part->browserExtension());
+    WebEngineNavigationExtension* ext = qobject_cast<WebEngineNavigationExtension*>(part->browserExtension());
     if (ext) {
-        connect(ext, QOverload<QObject *, const QByteArray &>::of(&WebEngineBrowserExtension::saveHistory),
+        connect(ext, QOverload<QObject *, const QByteArray &>::of(&WebEngineNavigationExtension::saveHistory),
                 this, &WebEngineFactory::slotSaveHistory);
     }
     return part;
diff --git a/webenginepart/src/webenginepartkiohandler.cpp b/webenginepart/src/webenginepartkiohandler.cpp
index 1844e01c9d..cb2cb5b368 100644
--- a/webenginepart/src/webenginepartkiohandler.cpp
+++ b/webenginepart/src/webenginepartkiohandler.cpp
@@ -10,7 +10,6 @@
 
 #include <QMimeDatabase>
 #include <QBuffer>
-#include <QtWebEngine/QtWebEngineVersion>
 
 #include <KIO/StoredTransferJob>
 
@@ -74,7 +73,7 @@ void WebEnginePartKIOHandler::processSlaveOutput()
 
 void WebEnginePartKIOHandler::createDataFromErrorString(KIO::StoredTransferJob* job)
 {
-    if (job->error() == KIO::ERR_SLAVE_DEFINED && job->errorString().contains("<html>")) {
+    if (job->error() == KIO::ERR_WORKER_DEFINED && job->errorString().contains("<html>")) {
         m_data = job->data();
     } else if (job->error() != 0 && !job->errorString().isEmpty()) {
         QString html = QString("<html><body><h1>Error</h1>%1</body></html>").arg(job->errorString());
diff --git a/webenginepart/src/webengineview.cpp b/webenginepart/src/webengineview.cpp
index 67efb404ac..65842b9cc6 100644
--- a/webenginepart/src/webengineview.cpp
+++ b/webenginepart/src/webengineview.cpp
@@ -24,7 +24,6 @@
 #include <KService>
 #include <KUriFilter>
 #include <KActionMenu>
-#include <KIO/AccessManager>
 #include <KStringHandler>
 #include <KLocalizedString>
 #include <KIO/CommandLauncherJob>
@@ -40,6 +39,7 @@
 #include <QMimeType>
 #include <QMimeDatabase>
 #include <QMenu>
+#include <QActionGroup>
 
 #define QL1S(x)   QLatin1String(x)
 #define QL1C(x)   QLatin1Char(x)
@@ -98,9 +98,9 @@ void WebEngineView::loadUrl(const QUrl& url, const KParts::OpenUrlArguments& arg
     }
 }
 
-QWebEngineContextMenuData WebEngineView::contextMenuResult() const
+const QWebEngineContextMenuRequest* WebEngineView::contextMenuResult() const
 {
-    return m_result;
+    return result();
 }
 
 static void extractMimeTypeFor(const QUrl& url, QString& mimeType)
@@ -130,41 +130,45 @@ static void extractMimeTypeFor(const QUrl& url, QString& mimeType)
 
 void WebEngineView::contextMenuEvent(QContextMenuEvent* e)
 {
+#if QT_VERSION_MAJOR < 6
     m_result = page()->contextMenuData();
+#else
+    m_result = lastContextMenuRequest();
+#endif
 
     // Clear the previous collection entries first...
     m_actionCollection->clear();
 
-    KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems;
-    KParts::BrowserExtension::ActionGroupMap mapAction;
+    KParts::NavigationExtension::PopupFlags flags = KParts::NavigationExtension::DefaultPopupItems;
+    KParts::NavigationExtension::ActionGroupMap mapAction;
     QString mimeType (QL1S("text/html"));
     bool forcesNewWindow = false;
 
     QUrl emitUrl;
 
-    if (m_result.isContentEditable()) {
-        flags |= KParts::BrowserExtension::ShowTextSelectionItems;
+    if (result()->isContentEditable()) {
+        flags |= KParts::NavigationExtension::ShowTextSelectionItems;
         editableContentActionPopupMenu(mapAction);
-    } else if (m_result.mediaType() == QWebEngineContextMenuData::MediaTypeVideo || m_result.mediaType() == QWebEngineContextMenuData::MediaTypeAudio) {
+    } else if (result()->mediaType() == QWebEngineContextMenuRequest::MediaTypeVideo || result()->mediaType() == QWebEngineContextMenuRequest::MediaTypeAudio) {
         multimediaActionPopupMenu(mapAction);
-    } else if (!m_result.linkUrl().isValid()) {
-        if (m_result.mediaType() == QWebEngineContextMenuData::MediaTypeImage) {
-            emitUrl = m_result.mediaUrl();
+    } else if (!result()->linkUrl().isValid()) {
+        if (result()->mediaType() == QWebEngineContextMenuRequest::MediaTypeImage) {
+            emitUrl = result()->mediaUrl();
             extractMimeTypeFor(emitUrl, mimeType);
         } else {
-            flags |= KParts::BrowserExtension::ShowBookmark;
+            flags |= KParts::NavigationExtension::ShowBookmark;
             emitUrl = m_part->url();
 
-            if (!m_result.selectedText().isEmpty()) {
-                flags |= KParts::BrowserExtension::ShowTextSelectionItems;
+            if (!result()->selectedText().isEmpty()) {
+                flags |= KParts::NavigationExtension::ShowTextSelectionItems;
                 selectActionPopupMenu(mapAction);
             }
         }
         partActionPopupMenu(mapAction);
     } else {
-        flags |= KParts::BrowserExtension::ShowBookmark;
-        flags |= KParts::BrowserExtension::IsLink;
-        emitUrl = m_result.linkUrl();
+        flags |= KParts::NavigationExtension::ShowBookmark;
+        flags |= KParts::NavigationExtension::IsLink;
+        emitUrl = result()->linkUrl();
         linkActionPopupMenu(mapAction);
         if (emitUrl.isLocalFile())
             mimeType = QMimeDatabase().mimeTypeForUrl(emitUrl).name();
@@ -173,7 +177,7 @@ void WebEngineView::contextMenuEvent(QContextMenuEvent* e)
         partActionPopupMenu(mapAction);
 
         // Show the OpenInThisWindow context menu item
-//        forcesNewWindow = (page()->currentFrame() != m_result.linkTargetFrame());
+//        forcesNewWindow = (page()->currentFrame() != result()->linkTargetFrame());
     }
 
     if (!mapAction.isEmpty()) {
@@ -182,7 +186,7 @@ void WebEngineView::contextMenuEvent(QContextMenuEvent* e)
         args.setMimeType(mimeType);
         bargs.setForcesNewWindow(forcesNewWindow);
         e->accept();
-        emit m_part->browserExtension()->popupMenu(e->globalPos(), emitUrl, static_cast<mode_t>(-1), args, bargs, flags, mapAction);
+        emit m_part->navigationExtension()->popupMenu(e->globalPos(), emitUrl, static_cast<mode_t>(-1), args, bargs, flags, mapAction);
         return;
     }
 
@@ -291,7 +295,7 @@ void WebEngineView::timerEvent(QTimerEvent* e)
     QWebEngineView::timerEvent(e);
 }
 
-void WebEngineView::editableContentActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& partGroupMap)
+void WebEngineView::editableContentActionPopupMenu(KParts::NavigationExtension::ActionGroupMap& partGroupMap)
 {
     if (m_spellCheckMenu) {
         m_spellCheckMenu->deleteLater();
@@ -306,18 +310,18 @@ void WebEngineView::editableContentActionPopupMenu(KParts::BrowserExtension::Act
     action->setSeparator(true);
     editableContentActions.append(action);
 
-    WebEngineBrowserExtension *ext = qobject_cast<WebEngineBrowserExtension *>(m_part->browserExtension());
+    WebEngineNavigationExtension *ext = qobject_cast<WebEngineNavigationExtension *>(m_part->navigationExtension());
     Q_ASSERT(ext!=nullptr);
 
-    action = KStandardAction::create(KStandardAction::Copy, ext, &WebEngineBrowserExtension::copy, m_actionCollection);
+    action = KStandardAction::create(KStandardAction::Copy, ext, &WebEngineNavigationExtension::copy, m_actionCollection);
     action->setEnabled(pageAction(QWebEnginePage::Copy)->isEnabled());
     editableContentActions.append(action);
 
-    action = KStandardAction::create(KStandardAction::Cut, ext, &WebEngineBrowserExtension::cut, m_actionCollection);
+    action = KStandardAction::create(KStandardAction::Cut, ext, &WebEngineNavigationExtension::cut, m_actionCollection);
     action->setEnabled(pageAction(QWebEnginePage::Cut)->isEnabled());
     editableContentActions.append(action);
 
-    action = KStandardAction::create(KStandardAction::Paste, ext, &WebEngineBrowserExtension::paste, m_actionCollection);
+    action = KStandardAction::create(KStandardAction::Paste, ext, &WebEngineNavigationExtension::paste, m_actionCollection);
     action->setEnabled(pageAction(QWebEnginePage::Paste)->isEnabled());
     editableContentActions.append(action);
 
@@ -329,8 +333,13 @@ void WebEngineView::editableContentActionPopupMenu(KParts::BrowserExtension::Act
     editableContentActions.append(pageAction(QWebEnginePage::InspectElement));
 
 
+#if QT_VERSION_MAJOR < 6
+    const QWebEngineContextMenuRequest *req = &page()->contextMenuData();
+#else
+    QWebEngineContextMenuRequest *req = lastContextMenuRequest();
+#endif
     SpellCheckerManager *manager = m_part->spellCheckerManager();
-    m_spellCheckMenu = manager->spellCheckingMenu(page()->contextMenuData().spellCheckerSuggestions(), m_actionCollection, dynamic_cast<WebEnginePage*>(page()));
+    m_spellCheckMenu = manager->spellCheckingMenu(req->spellCheckerSuggestions(), m_actionCollection, dynamic_cast<WebEnginePage*>(page()));
     if (m_spellCheckMenu) {
         editableContentActions.append(m_spellCheckMenu->menuAction());
     }
@@ -338,54 +347,54 @@ void WebEngineView::editableContentActionPopupMenu(KParts::BrowserExtension::Act
     partGroupMap.insert(QStringLiteral("editactions") , editableContentActions);
 }
 
-void WebEngineView::partActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& partGroupMap)
+void WebEngineView::partActionPopupMenu(KParts::NavigationExtension::ActionGroupMap& partGroupMap)
 {
     QList<QAction*> partActions;
 
-    WebEngineBrowserExtension *ext = qobject_cast<WebEngineBrowserExtension *>(m_part->browserExtension());
+    WebEngineNavigationExtension *ext = qobject_cast<WebEngineNavigationExtension *>(m_part->navigationExtension());
     Q_ASSERT(ext!=nullptr);
-    if (m_result.mediaUrl().isValid()) {
+    if (result()->mediaUrl().isValid()) {
         QAction *action;
         action = new QAction(i18n("Save Image As..."), this);
         m_actionCollection->addAction(QL1S("saveimageas"), action);
-        connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotSaveImageAs);
+        connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotSaveImageAs);
         partActions.append(action);
 
         action = new QAction(i18n("Send Image..."), this);
         m_actionCollection->addAction(QL1S("sendimage"), action);
-        connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotSendImage);
+        connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotSendImage);
         partActions.append(action);
 
         action = new QAction(i18n("Copy Image URL"), this);
         m_actionCollection->addAction(QL1S("copyimageurl"), action);
-        connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotCopyImageURL);
+        connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotCopyImageURL);
         partActions.append(action);
 
 #if 0
         action = new QAction(i18n("Copy Image"), this);
         m_actionCollection->addAction(QL1S("copyimage"), action);
-        connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotCopyImage);
-        action->setEnabled(!m_result.pixmap().isNull());
+        connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotCopyImage);
+        action->setEnabled(!result()->pixmap().isNull());
         partActions.append(action);
 #endif
 
-        action = new QAction(i18n("View Image (%1)", QUrl(m_result.mediaUrl()).fileName()), this);
+        action = new QAction(i18n("View Image (%1)", QUrl(result()->mediaUrl()).fileName()), this);
         m_actionCollection->addAction(QL1S("viewimage"), action);
-        connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotViewImage);
+        connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotViewImage);
         partActions.append(action);
 
         if (WebEngineSettings::self()->isAdFilterEnabled()) {
             action = new QAction(i18n("Block Image..."), this);
             m_actionCollection->addAction(QL1S("blockimage"), action);
-            connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotBlockImage);
+            connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotBlockImage);
             partActions.append(action);
 
-            if (!m_result.mediaUrl().host().isEmpty() &&
-                !m_result.mediaUrl().scheme().isEmpty())
+            if (!result()->mediaUrl().host().isEmpty() &&
+                !result()->mediaUrl().scheme().isEmpty())
             {
-                action = new QAction(i18n("Block Images From %1" , m_result.mediaUrl().host()), this);
+                action = new QAction(i18n("Block Images From %1" , result()->mediaUrl().host()), this);
                 m_actionCollection->addAction(QL1S("blockhost"), action);
-                connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotBlockHost);
+                connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotBlockHost);
                 partActions.append(action);
             }
         }
@@ -404,15 +413,15 @@ void WebEngineView::partActionPopupMenu(KParts::BrowserExtension::ActionGroupMap
     partGroupMap.insert(QStringLiteral("partactions"), partActions);
 }
 
-void WebEngineView::selectActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& selectGroupMap)
+void WebEngineView::selectActionPopupMenu(KParts::NavigationExtension::ActionGroupMap& selectGroupMap)
 {
     QList<QAction*> selectActions;
 
-    WebEngineBrowserExtension *ext = qobject_cast<WebEngineBrowserExtension *>(m_part->browserExtension());
+    WebEngineNavigationExtension *ext = qobject_cast<WebEngineNavigationExtension *>(m_part->navigationExtension());
     Q_ASSERT(ext!=nullptr);
 
     QAction* copyAction = KStandardAction::create(KStandardAction::Copy,
-                                                  ext, &WebEngineBrowserExtension::copy, m_actionCollection);
+                                                  ext, &WebEngineNavigationExtension::copy, m_actionCollection);
     copyAction->setText(i18n("&Copy Text"));
     copyAction->setEnabled(ext->isActionEnabled("copy"));
     selectActions.append(copyAction);
@@ -427,28 +436,28 @@ void WebEngineView::selectActionPopupMenu(KParts::BrowserExtension::ActionGroupM
                                             KStringHandler::rsqueeze(data.uri().url(), 18)), this);
         m_actionCollection->addAction(QL1S("openSelection"), action);
         action->setData(QUrl(data.uri()));
-        connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotOpenSelection);
+        connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotOpenSelection);
         selectActions.append(action);
     }
 
     selectGroupMap.insert(QStringLiteral("editactions"), selectActions);
 }
 
-void WebEngineView::linkActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& linkGroupMap)
+void WebEngineView::linkActionPopupMenu(KParts::NavigationExtension::ActionGroupMap& linkGroupMap)
 {
-    Q_ASSERT(!m_result.linkUrl().isEmpty());
+    Q_ASSERT(!result()->linkUrl().isEmpty());
 
-    const QUrl url(m_result.linkUrl());
+    const QUrl url(result()->linkUrl());
 
     QList<QAction*> linkActions;
 
     QAction* action;
 
-    WebEngineBrowserExtension *ext = qobject_cast<WebEngineBrowserExtension *>(m_part->browserExtension());
+    WebEngineNavigationExtension *ext = qobject_cast<WebEngineNavigationExtension *>(m_part->navigationExtension());
     Q_ASSERT(ext!=nullptr);
 
-    if (!m_result.selectedText().isEmpty()) {
-        action = KStandardAction::create(KStandardAction::Copy, ext, &WebEngineBrowserExtension::copy,
+    if (!result()->selectedText().isEmpty()) {
+        action = KStandardAction::create(KStandardAction::Copy, ext, &WebEngineNavigationExtension::copy,
                                          m_actionCollection);
         action->setText(i18n("&Copy Text"));
         action->setEnabled(ext->isActionEnabled("copy"));
@@ -458,59 +467,59 @@ void WebEngineView::linkActionPopupMenu(KParts::BrowserExtension::ActionGroupMap
     if (url.scheme() == QLatin1String("mailto")) {
         action = new QAction(i18n("&Copy Email Address"), this);
         m_actionCollection->addAction(QL1S("copylinklocation"), action);
-        connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotCopyEmailAddress);
+        connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotCopyEmailAddress);
         linkActions.append(action);
     } else {
-        if (!m_result.linkText().isEmpty()) {
+        if (!result()->linkText().isEmpty()) {
             action = new QAction(QIcon::fromTheme(QStringLiteral("edit-copy")), i18n("Copy Link &Text"), this);
             m_actionCollection->addAction(QL1S("copylinktext"), action);
-            connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotCopyLinkText);
+            connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotCopyLinkText);
             linkActions.append(action);
         }
 
         action = new QAction(i18n("Copy Link &URL"), this);
         m_actionCollection->addAction(QL1S("copylinkurl"), action);
-        connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotCopyLinkURL);
+        connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotCopyLinkURL);
         linkActions.append(action);
 
         action = new QAction(i18n("&Save Link As..."), this);
         m_actionCollection->addAction(QL1S("savelinkas"), action);
-        auto saveLinkAsLambda = [this, url](bool){qobject_cast<WebEngineBrowserExtension*>(m_part->browserExtension())->slotSaveLinkAs(url);};
-        connect(action, &QAction::triggered, m_part->browserExtension(), saveLinkAsLambda);
+        auto saveLinkAsLambda = [this, url](bool){qobject_cast<WebEngineNavigationExtension*>(m_part->navigationExtension())->slotSaveLinkAs(url);};
+        connect(action, &QAction::triggered, m_part->navigationExtension(), saveLinkAsLambda);
         linkActions.append(action);
     }
 
     linkGroupMap.insert(QStringLiteral("linkactions"), linkActions);
 }
 
-void WebEngineView::multimediaActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& mmGroupMap)
+void WebEngineView::multimediaActionPopupMenu(KParts::NavigationExtension::ActionGroupMap& mmGroupMap)
 {
     QList<QAction*> multimediaActions;
 
-    const bool isVideoElement = m_result.mediaType() == QWebEngineContextMenuData::MediaTypeVideo;
-    const bool isAudioElement = m_result.mediaType() == QWebEngineContextMenuData::MediaTypeAudio;
+    const bool isVideoElement = result()->mediaType() == QWebEngineContextMenuRequest::MediaTypeVideo;
+    const bool isAudioElement = result()->mediaType() == QWebEngineContextMenuRequest::MediaTypeAudio;
 
-    WebEngineBrowserExtension *ext = qobject_cast<WebEngineBrowserExtension *>(m_part->browserExtension());
+    WebEngineNavigationExtension *ext = qobject_cast<WebEngineNavigationExtension *>(m_part->navigationExtension());
     Q_ASSERT(ext!=nullptr);
 
     QAction* action = new QAction(i18n("&Play/Pause"), this);
     m_actionCollection->addAction(QL1S("playmultimedia"), action);
-    connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotPlayMedia);
+    connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotPlayMedia);
     multimediaActions.append(action);
 
     action = new QAction(i18n("Un&mute/&Mute"), this);
     m_actionCollection->addAction(QL1S("mutemultimedia"), action);
-    connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotMuteMedia);
+    connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotMuteMedia);
     multimediaActions.append(action);
 
     action = new QAction(i18n("Toggle &Loop"), this);
     m_actionCollection->addAction(QL1S("loopmultimedia"), action);
-    connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotLoopMedia);
+    connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotLoopMedia);
     multimediaActions.append(action);
 
     action = new QAction(i18n("Toggle &Controls"), this);
     m_actionCollection->addAction(QL1S("showmultimediacontrols"), action);
-    connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotShowMediaControls);
+    connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotShowMediaControls);
     multimediaActions.append(action);
 
     action = new QAction(m_actionCollection);
@@ -531,12 +540,12 @@ void WebEngineView::multimediaActionPopupMenu(KParts::BrowserExtension::ActionGr
 
     action = new QAction(saveMediaText, this);
     m_actionCollection->addAction(QL1S("savemultimedia"), action);
-    connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotSaveMedia);
+    connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotSaveMedia);
     multimediaActions.append(action);
 
     action = new QAction(copyMediaText, this);
     m_actionCollection->addAction(QL1S("copymultimediaurl"), action);
-    connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::slotCopyMedia);
+    connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::slotCopyMedia);
     multimediaActions.append(action);
 
     mmGroupMap.insert(QStringLiteral("partactions"), multimediaActions);
@@ -568,7 +577,7 @@ void WebEngineView::addSearchActions(QList<QAction*>& selectActions, QWebEngineV
     if (selectedText.isEmpty())
         return;
 
-    WebEngineBrowserExtension *ext = qobject_cast<WebEngineBrowserExtension *>(m_part->browserExtension());
+    WebEngineNavigationExtension *ext = qobject_cast<WebEngineNavigationExtension *>(m_part->navigationExtension());
     Q_ASSERT(ext!=nullptr);
 
     KUriFilterData data;
@@ -582,7 +591,7 @@ void WebEngineView::addSearchActions(QList<QAction*>& selectActions, QWebEngineV
                                       i18nc("Search \"search provider\" for \"text\"", "Search %1 for '%2'",
                                             data.searchProvider(), squeezedText), view);
         action->setData(QUrl(data.uri()));
-        connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::searchProvider);
+        connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::searchProvider);
         m_actionCollection->addAction(QL1S("defaultSearchProvider"), action);
         selectActions.append(action);
 
@@ -598,7 +607,7 @@ void WebEngineView::addSearchActions(QList<QAction*>& selectActions, QWebEngineV
                 QAction *action = new QAction(QIcon::fromTheme(data.iconNameForPreferredSearchProvider(searchProvider)), searchProvider, view);
                 action->setData(data.queryForPreferredSearchProvider(searchProvider));
                 m_actionCollection->addAction(searchProvider, action);
-                connect(action, &QAction::triggered, ext, &WebEngineBrowserExtension::searchProvider);
+                connect(action, &QAction::triggered, ext, &WebEngineNavigationExtension::searchProvider);
 
                 providerList->addAction(action);
             }
@@ -633,7 +642,7 @@ void WebEngineView::dropEvent(QDropEvent* e)
     //isn't called at all)
     if (!m_dragAndDropHandledBySuperclass && e->mimeData()->hasUrls()) {
         m_dragAndDropHandledBySuperclass = true;
-        emit m_part->browserExtension()->openUrlRequest(e->mimeData()->urls().first());
+        emit m_part->navigationExtension()->openUrlRequest(e->mimeData()->urls().first());
         e->acceptProposedAction();
     }
 }
@@ -660,3 +669,21 @@ void WebEngineView::dragMoveEvent(QDragMoveEvent* e)
     acceptDragMoveEventIfPossible(e);
 }
 #endif
+
+QWebEngineContextMenuRequest* WebEngineView::result()
+{
+#if QT_VERSION_MAJOR < 6
+    return &m_result;
+#else
+    return m_result;
+#endif
+}
+
+const QWebEngineContextMenuRequest* WebEngineView::result() const
+{
+#if QT_VERSION_MAJOR < 6
+    return &m_result;
+#else
+    return m_result;
+#endif
+}
diff --git a/webenginepart/src/webengineview.h b/webenginepart/src/webengineview.h
index 3fae42df6e..d80debb376 100644
--- a/webenginepart/src/webengineview.h
+++ b/webenginepart/src/webengineview.h
@@ -12,11 +12,10 @@
 #define WEBENGINEVIEW_H
 
 #include <QPointer>
-#include <KParts/BrowserExtension>
+#include "kf5compat.h" //For NavigationExtension
+#include "qtwebengine6compat.h" //For QWebEngineContextMenuRequest
 
 #include <QWebEngineView>
-#include <QtWebEngine/QtWebEngineVersion>
-#include <QWebEngineContextMenuData>
 
 class QUrl;
 class WebEnginePart;
@@ -39,7 +38,7 @@ public:
      */
     void loadUrl(const QUrl& url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& bargs);
 
-    QWebEngineContextMenuData contextMenuResult() const;
+    const QWebEngineContextMenuRequest* contextMenuResult() const;
 
 protected:
     /**
@@ -127,15 +126,23 @@ private Q_SLOTS:
     void slotStopAutoScroll();
 
 private:
-    void editableContentActionPopupMenu(KParts::BrowserExtension::ActionGroupMap&);
-    void selectActionPopupMenu(KParts::BrowserExtension::ActionGroupMap&);
-    void linkActionPopupMenu(KParts::BrowserExtension::ActionGroupMap&);
-    void partActionPopupMenu(KParts::BrowserExtension::ActionGroupMap &);
-    void multimediaActionPopupMenu(KParts::BrowserExtension::ActionGroupMap&);
+    void editableContentActionPopupMenu(KParts::NavigationExtension::ActionGroupMap&);
+    void selectActionPopupMenu(KParts::NavigationExtension::ActionGroupMap&);
+    void linkActionPopupMenu(KParts::NavigationExtension::ActionGroupMap&);
+    void partActionPopupMenu(KParts::NavigationExtension::ActionGroupMap &);
+    void multimediaActionPopupMenu(KParts::NavigationExtension::ActionGroupMap&);
     void addSearchActions(QList<QAction*>& selectActions, QWebEngineView*);
 
+    //TODO KF6: when dropping compatibility with KF5, remove these and use m_result directly
+    QWebEngineContextMenuRequest* result();
+    const QWebEngineContextMenuRequest* result() const;
+
     KActionCollection* m_actionCollection;
-    QWebEngineContextMenuData m_result;
+#if QT_VERSION_MAJOR < 6
+    QWebEngineContextMenuRequest m_result;
+#else
+    QPointer<QWebEngineContextMenuRequest> m_result = nullptr;
+#endif
     QPointer<WebEnginePart> m_part;
 
     qint32 m_autoScrollTimerId;
diff --git a/webenginepart/src/webenginewallet.cpp b/webenginepart/src/webenginewallet.cpp
index 111ec0a097..e1abea14f2 100644
--- a/webenginepart/src/webenginewallet.cpp
+++ b/webenginepart/src/webenginewallet.cpp
@@ -30,19 +30,6 @@
 #define QL1S(x)   QLatin1String(x)
 #define QL1C(x)   QLatin1Char(x)
 
-QWebEngineScript WebEngineWallet::formDetectorFunctionsScript()
-{
-    static QWebEngineScript s_formDetectorFunctionsScript;
-    if (s_formDetectorFunctionsScript.isNull()) {
-        QFile jsfile(":/formautofiller.js");
-        jsfile.open(QIODevice::ReadOnly);
-        s_formDetectorFunctionsScript.setSourceCode(QString(jsfile.readAll()));
-        s_formDetectorFunctionsScript.setInjectionPoint(QWebEngineScript::DocumentCreation);
-        s_formDetectorFunctionsScript.setWorldId(QWebEngineScript::ApplicationWorld);
-    }
-    return s_formDetectorFunctionsScript;
-}
-
 WebEngineSettings::WebFormInfo WebEngineWallet::WebForm::toSettingsInfo() const
 {
     QStringList fieldNames;
diff --git a/webenginepart/src/webenginewallet.h b/webenginepart/src/webenginewallet.h
index 9b07424196..8912ecb95c 100644
--- a/webenginepart/src/webenginewallet.h
+++ b/webenginepart/src/webenginewallet.h
@@ -222,13 +222,6 @@ public:
      */
     void removeFormData(WebEnginePage *page);
 
-    /**
-     * @brief The script to use to detect web forms in a page
-     *
-     * @return The script to use to detect web forms in a page
-     */
-    static QWebEngineScript formDetectorFunctionsScript();
-
     /**
      * @brief Removes the form data specified by @p forms from the persistent storage.
      *
diff --git a/webenginepart/src/webfieldsdataview.cpp b/webenginepart/src/webfieldsdataview.cpp
index db1299edb8..1b0e93389a 100644
--- a/webenginepart/src/webfieldsdataview.cpp
+++ b/webenginepart/src/webfieldsdataview.cpp
@@ -31,7 +31,7 @@ QString WebFieldsDataViewPasswordDelegate::passwordReplacement(const QStyleOptio
 {
         const QWidget *w = option.widget;
         QStyle *s = w->style();
-        QChar passwdChar = s->styleHint(QStyle::StyleHint::SH_LineEdit_PasswordCharacter, &option, w);
+        QChar passwdChar(s->styleHint(QStyle::StyleHint::SH_LineEdit_PasswordCharacter, &option, w));
         return QString(index.data().toString().length(), passwdChar);
 }
 
diff --git a/webenginepart/tests/webenginepart_tester.cpp b/webenginepart/tests/webenginepart_tester.cpp
index 9d6ca414dc..b5dccdf975 100644
--- a/webenginepart/tests/webenginepart_tester.cpp
+++ b/webenginepart/tests/webenginepart_tester.cpp
@@ -15,6 +15,7 @@
 #include <KLineEdit>
 #include <KPluginMetaData>
 #include <webenginepart.h>
+#include <profile.h>
 
 #include <QJsonDocument>
 #include <QInputDialog>
@@ -377,12 +378,12 @@ int main(int argc, char **argv)
 
     QString url = QStringLiteral("%1/%2").arg(QDir::homePath()).arg(QStringLiteral("index.html"));
 
-//    QWebEngineSettings::defaultSettings()->setMaximumPagesInCache(4);
+//    Profile::defaultProfile()->settings()->setMaximumPagesInCache(4);
 
 //    QWebEngineSettings::setObjectCacheCapacities((16*1024*1024) / 8, (16*1024*1024) / 8, 16*1024*1024);
 
-    QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
-//    QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::DeveloperExtrasEnabled, true);
+    KonqWebEnginePart::Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
+//    Profile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::DeveloperExtrasEnabled, true);
 
     const QStringList args = app.arguments();
 



More information about the kde-doc-english mailing list