[education/rkward/kf5] /: Make it compile

Thomas Friedrichsmeier null at kde.org
Wed Apr 10 16:12:08 BST 2024


Git commit 0160cffc33e32fa42e1786bc6b786f147165374d by Thomas Friedrichsmeier, on behalf of Carl Schwan.
Committed on 01/04/2024 at 11:45.
Pushed by tfry into branch 'kf5'.

Make it compile

M  +2    -2    doc/rkward/CMakeLists.txt
M  +1    -1    doc/rkwardplugins/CMakeLists.txt
M  +4    -4    rkward/CMakeLists.txt
M  +1    -1    rkward/agents/CMakeLists.txt
M  +10   -10   rkward/dialogs/rkloadlibsdialog.cpp
M  +2    -3    rkward/dialogs/rkrecoverdialog.cpp
M  +1    -1    rkward/icons/CMakeLists.txt
M  +1    -1    rkward/main.cpp
M  +0    -1    rkward/misc/celleditor.h
M  +1    -1    rkward/misc/getfilenamewidget.cpp
M  +0    -2    rkward/misc/rkcommonfunctions.cpp
M  +11   -6    rkward/misc/rkdbusapi.cpp
M  +1    -1    rkward/misc/rkdbusapi.h
M  +7    -6    rkward/misc/rkmessagecatalog.cpp
M  +5    -5    rkward/misc/rkobjectlistview.cpp
M  +2    -2    rkward/misc/rkoutputdirectory.cpp
M  +1    -1    rkward/misc/rkparsedversion.cpp
M  +1    -1    rkward/misc/rkprogresscontrol.cpp
M  +1    -1    rkward/misc/rkspecialactions.cpp
M  +9    -3    rkward/misc/rkstandardactions.cpp
M  +2    -2    rkward/misc/rkstyle.cpp
M  +1    -1    rkward/rbackend/CMakeLists.txt
M  +9    -9    rkward/rbackend/rkfrontendtransmitter.cpp
M  +7    -7    rkward/rbackend/rkrbackend.cpp
M  +1    -1    rkward/rbackend/rkrinterface.cpp
M  +3    -5    rkward/rbackend/rkrsupport.cpp
M  +1    -1    rkward/rbackend/rkstructuregetter.cpp
M  +1    -1    rkward/rbackend/rpackages/CMakeLists.txt
M  +13   -20   rkward/rkconsole.cpp
M  +0    -1    rkward/rkconsole.h
M  +7    -7    rkward/rkward.cpp
M  +1    -1    rkward/scriptbackends/CMakeLists.txt
M  +4    -4    rkward/settings/rksettings.h
M  +1    -1    rkward/windows/CMakeLists.txt
M  +28   -44   rkward/windows/katepluginintegration.cpp
M  +1    -1    rkward/windows/rkcallstackviewer.cpp
M  +45   -50   rkward/windows/rkcodecompletion.cpp
M  +0    -2    rkward/windows/rkcodecompletion.h
M  +15   -24   rkward/windows/rkcommandeditorwindow.cpp
M  +2    -2    rkward/windows/rkfilebrowser.cpp
M  +8    -7    rkward/windows/rkhtmlwindow.cpp
M  +1    -1    rkward/windows/rkhtmlwindow.h
M  +2    -2    rkward/windows/rkmdiwindow.cpp
M  +1    -1    rkward/windows/rkmdiwindow.h
M  +2    -6    rkward/windows/rktexthints.cpp
M  +0    -1    rkward/windows/rktoolwindowbar.cpp
M  +5    -8    rkward/windows/rktoplevelwindowgui.cpp
M  +6    -5    rkward/windows/rkwindowcatcher.cpp
M  +13   -13   rkward/windows/rkworkplace.cpp
M  +10   -4    rkward/windows/rkworkplaceview.cpp

https://invent.kde.org/education/rkward/-/commit/0160cffc33e32fa42e1786bc6b786f147165374d

diff --git a/doc/rkward/CMakeLists.txt b/doc/rkward/CMakeLists.txt
index 65edac6d5..134d69cdf 100644
--- a/doc/rkward/CMakeLists.txt
+++ b/doc/rkward/CMakeLists.txt
@@ -2,5 +2,5 @@
 # SPDX-FileCopyrightText: by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
 # SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
 # SPDX-License-Identifier: GPL-2.0-or-later
-kdoctools_create_handbook (index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR rkward)
-kdoctools_create_manpage (man-rkward.1.docbook 1 INSTALL_DESTINATION ${MAN_INSTALL_DIR})
+kdoctools_create_handbook (index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR rkward)
+kdoctools_create_manpage (man-rkward.1.docbook 1 INSTALL_DESTINATION ${KDE_INSTALL_MANDIR})
diff --git a/doc/rkwardplugins/CMakeLists.txt b/doc/rkwardplugins/CMakeLists.txt
index ddce630d5..15bb37b3c 100644
--- a/doc/rkwardplugins/CMakeLists.txt
+++ b/doc/rkwardplugins/CMakeLists.txt
@@ -4,7 +4,7 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # NOTE: kdoctools_create_handbook does not support multiple docbooks inside one directory. That's why this is separate.
 # KF5 TODO: Is the above still true?
-kdoctools_create_handbook (index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR rkwardplugins)
+kdoctools_create_handbook (index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR rkwardplugins)
 
 ADD_CUSTOM_TARGET (webdocs
 	COMMAND meinproc5 --stylesheet customization/kde-web.xsl ${CMAKE_CURRENT_SOURCE_DIR}/index.docbook
diff --git a/rkward/CMakeLists.txt b/rkward/CMakeLists.txt
index 8920677d1..6b216da7a 100644
--- a/rkward/CMakeLists.txt
+++ b/rkward/CMakeLists.txt
@@ -57,7 +57,7 @@ ADD_EXECUTABLE(rkward main.cpp)
 # NOTE: These definitions are needed for the startup procedure (main.cpp), only.
 # We should switch with to target_compile_definitions once we require CMAKE 2.6+
 TARGET_COMPILE_DEFINITIONS(rkward PUBLIC -DINSTALL_PATH="${CMAKE_INSTALL_PREFIX}")
-FILE(RELATIVE_PATH RelPathToData /${BIN_INSTALL_DIR} /${DATA_INSTALL_DIR})
+FILE(RELATIVE_PATH RelPathToData /${KDE_INSTALL_BINDIR} /${KDE_INSTALL_DATADIR})
 TARGET_COMPILE_DEFINITIONS(rkward PUBLIC -DREL_PATH_TO_DATA="${RelPathToData}")
 
 SET_TARGET_PROPERTIES(rkward PROPERTIES
@@ -81,8 +81,8 @@ ENDIF(KF5Crash_FOUND)
 
 ########### install files ###############
 
-INSTALL(DIRECTORY plugins/ pages DESTINATION ${DATA_INSTALL_DIR}/rkward)
-INSTALL(FILES resource.ver DESTINATION ${DATA_INSTALL_DIR}/rkward)
+INSTALL(DIRECTORY plugins/ pages DESTINATION ${KDE_INSTALL_DATADIR}/rkward)
+INSTALL(FILES resource.ver DESTINATION ${KDE_INSTALL_DATADIR}/rkward)
 # This is for running directly from the build tree.
 EXECUTE_PROCESS(
 	COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/rkwardinstall
@@ -122,7 +122,7 @@ IF(APPLE)
     set_target_properties(rkward PROPERTIES MACOSX_BUNDLE_BUNDLE_VERSION "${RKVERSION_NUMBER}")
     set_target_properties(rkward PROPERTIES MACOSX_BUNDLE_COPYRIGHT "RKWard Team")
 ELSE()
-    INSTALL(TARGETS rkward DESTINATION ${BIN_INSTALL_DIR})
+    INSTALL(TARGETS rkward ${KF6_INSTALL_TARGETS_DEFAULT_ARGS})
 ENDIF()
 
 INSTALL(FILES org.kde.rkward.desktop DESTINATION ${KDE_INSTALL_APPDIR})
diff --git a/rkward/agents/CMakeLists.txt b/rkward/agents/CMakeLists.txt
index 4a59a2c78..77d1f480b 100644
--- a/rkward/agents/CMakeLists.txt
+++ b/rkward/agents/CMakeLists.txt
@@ -18,4 +18,4 @@ SET(agents_STAT_SRCS
    )
 
 ADD_LIBRARY(agents STATIC ${agents_STAT_SRCS})
-TARGET_LINK_LIBRARIES(agents Qt6::Widgets KF6::TextEditor KF6::I18n KF6::Service KF6::KIOCore)
+TARGET_LINK_LIBRARIES(agents Qt6::Widgets KF6::TextEditor KF6::I18n KF6::Service KF6::KIOCore KF6::KIOWidgets)
diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index 0113b0518..c10f171f2 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -90,7 +90,7 @@ void RKLoadLibsDialog::queryClose() {
 		changes |= pages[i]->isChanged();
 	}
 	if (changes) {
-		do_close = (KMessageBox::questionYesNo(this, i18n("Closing will discard pending changes. Are you sure?"), i18n("Discard changes?"), KGuiItem("Discard"), KGuiItem("Do no close")) == KMessageBox::Yes);
+		do_close = (KMessageBox::questionTwoActions(this, i18n("Closing will discard pending changes. Are you sure?"), i18n("Discard changes?"), KStandardGuiItem::discard(), KGuiItem(i18nc("@action:button", "Do no close"))) == KMessageBox::PrimaryAction);
 	}
 	if (do_close) close();
 }
@@ -186,9 +186,9 @@ bool RKLoadLibsDialog::removePackages (QStringList packages, QStringList from_li
 		KMessageBox::informationList (this, i18n ("Your current user permissions do not allow removing the following packages. These will be skipped."), not_writable, i18n ("Insufficient user permissions"));
 		int res = KMessageBox::No;
 #else
-		int res = KMessageBox::questionYesNoList (this, i18n ("Your current user permissions do not allow removing the following packages. Do you want to skip these packages, or do you want to proceed with administrator privileges (you will be prompted for the password)?"), not_writable, i18n ("Insufficient user permissions"), KGuiItem ("Become root"), KGuiItem ("Skip these packages"));
+		int res = KMessageBox::questionTwoActionsList (this, i18n ("Your current user permissions do not allow removing the following packages. Do you want to skip these packages, or do you want to proceed with administrator privileges (you will be prompted for the password)?"), not_writable, i18n ("Insufficient user permissions"), KGuiItem (i18nc("@action:button", "Become root")), KGuiItem (i18nc("@action:button", "Skip these packages")));
 #endif
-		if (res == KMessageBox::Yes) as_root = true;
+		if (res == KMessageBox::PrimaryAction) as_root = true;
 		else {
 			for (int i = not_writable_int.count () - 1; i >= 0; --i) {
 				packages.removeAt (not_writable_int[i]);
@@ -248,9 +248,9 @@ bool RKLoadLibsDialog::installPackages (const QStringList &packages, QString to_
 		if (res == KMessageBox::Continue) to_libloc = altlibloc;
 #else
 		message.append (i18n ("<p>Alternatively, if you are the administrator of this machine, you can try to install the packages as root (you'll be prompted for the root password).</p>"));
-		int res = KMessageBox::warningYesNoCancel (this, message, mcaption, KGuiItem (i18n ("Install to %1", altlibloc)), KGuiItem (i18n ("Become root")));
-		if (res == KMessageBox::Yes) to_libloc = altlibloc;
-		if (res == KMessageBox::No) as_root = true;
+		int res = KMessageBox::warningTwoActionsCancel (this, message, mcaption, KGuiItem (i18n ("Install to %1", altlibloc)), KGuiItem (i18n ("Become root")));
+		if (res == KMessageBox::PrimaryAction) to_libloc = altlibloc;
+		if (res == KMessageBox::SecondaryAction) as_root = true;
 #endif
 		if (res == KMessageBox::Cancel) return false;
 	}
@@ -766,7 +766,7 @@ void InstallPackagesWidget::trySelectPackages (const QStringList &package_names)
 			}
 		}
 		if (!failed_names.isEmpty()) {
-			KMessageBox::error(0, i18n("The following package(s) requested by the backend have not been found in the package repositories: \"%1\". Maybe the package name was mis-spelled. Or maybe you need to add additional repositories via the \"Configure Repositories\" button.", failed_names.join("\", \"")), i18n("Package not available"));
+			KMessageBox::error(nullptr, i18n("The following package(s) requested by the backend have not been found in the package repositories: \"%1\". Maybe the package name was mis-spelled. Or maybe you need to add additional repositories via the \"Configure Repositories\" button.", failed_names.join("\", \"")), i18n("Package not available"));
 		}
 	}, parent->chain);
 }
@@ -1051,7 +1051,7 @@ Qt::ItemFlags RKRPackageInstallationStatus::flags (const QModelIndex &index) con
 	qint64 pos = index.internalId ();
 	Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
 	if (pos >= 0) flags |= Qt::ItemIsUserCheckable;
-	if (pos == InstalledPackages) flags |= Qt::ItemIsTristate;
+	if (pos == InstalledPackages) flags |= Qt::ItemIsUserTristate;
 	return flags;
 }
 
@@ -1170,9 +1170,9 @@ bool RKRPackageInstallationStatusSortFilterModel::filterAcceptsRow (int source_r
 	}
 // filter on Name and Title
 	QString name = sourceModel()->index(source_row, RKRPackageInstallationStatus::PackageName, source_parent).data().toString();
-	if (name.contains (filterRegExp ())) return true;
+	if (name.contains (filterRegularExpression ())) return true;
 	QString title = sourceModel()->index(source_row, RKRPackageInstallationStatus::PackageTitle, source_parent).data().toString();
-	return (title.contains (filterRegExp ()));
+	return (title.contains (filterRegularExpression ()));
 }
 
 void RKRPackageInstallationStatusSortFilterModel::setRKWardOnly (bool only) {
diff --git a/rkward/dialogs/rkrecoverdialog.cpp b/rkward/dialogs/rkrecoverdialog.cpp
index 46613edb9..99e59ae96 100644
--- a/rkward/dialogs/rkrecoverdialog.cpp
+++ b/rkward/dialogs/rkrecoverdialog.cpp
@@ -7,9 +7,8 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "rkrecoverdialog.h"
 
-#include <krun.h>
 #include <KLocalizedString>
-#include <kmessagebox.h>
+#include <KMessageBox>
 
 #include <QDir>
 #include <QFileInfo>
@@ -36,7 +35,7 @@ RKRecoverDialog::RKRecoverDialog (const QStringList &recovery_files) : QDialog (
 
 	QString text = QString ("<p><b>%1</b></p>").arg (caption);
 	text.append (i18n ("<p>It looks like RKWard has crashed, recently. We are sorry about that! However, not everything is lost, and with a bit of luck, your data has been saved in time.</p>"));
-	text.append (i18np ("<p>A workspace recovery file exists, dating from <i>%2</i>.</p>", "<p>%1 workspace recovery files exist, the most recent one of which dates from <i>%2</i>.</p>", recovery_files.count (), QFileInfo (recovery_files.first ()).lastModified ().toString (Qt::SystemLocaleShortDate)));
+	text.append (i18np ("<p>A workspace recovery file exists, dating from <i>%2</i>.</p>", "<p>%1 workspace recovery files exist, the most recent one of which dates from <i>%2</i>.</p>", recovery_files.count (),  QLocale::system().toString(QFileInfo (recovery_files.first ()).lastModified (), QLocale::ShortFormat)));
 	text.append (i18n ("<p>Do you want to open this file, now, save it for later (as <i>%1</i>), or discard it?</p>", saveFileFor (recovery_files.first ())));
 	layout->addWidget (RKCommonFunctions::wordWrappedLabel (text));
 
diff --git a/rkward/icons/CMakeLists.txt b/rkward/icons/CMakeLists.txt
index 9452760b4..34360f894 100644
--- a/rkward/icons/CMakeLists.txt
+++ b/rkward/icons/CMakeLists.txt
@@ -21,4 +21,4 @@ INSTALL(FILES
 	s4_slots.png
 	paste_inside_selection.png
 	paste_inside_table.png
-	DESTINATION ${DATA_INSTALL_DIR}/rkward/icons)
+    DESTINATION ${KDE_INSTALL_DATADIR}/rkward/icons)
diff --git a/rkward/main.cpp b/rkward/main.cpp
index 83dbe592f..549bab078 100644
--- a/rkward/main.cpp
+++ b/rkward/main.cpp
@@ -399,7 +399,7 @@ int main (int argc, char *argv[]) {
 	RKSessionVars::r_binary = r_exe;
 
 	if (app.isSessionRestored ()) {
-		RESTORE(RKWardMainWindow);	// well, whatever this is supposed to do -> TODO
+		kRestoreMainWindows<RKWardMainWindow>();	// well, whatever this is supposed to do -> TODO
 	} else {
 		new RKWardMainWindow ();
 	}
diff --git a/rkward/misc/celleditor.h b/rkward/misc/celleditor.h
index fc13f5d9d..6f47b5ad7 100644
--- a/rkward/misc/celleditor.h
+++ b/rkward/misc/celleditor.h
@@ -13,7 +13,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../core/robject.h"
 #include "rktableview.h"
 
-class QStringList;
 class QMenu;
 class QEvent;
 class QKeyEvent;
diff --git a/rkward/misc/getfilenamewidget.cpp b/rkward/misc/getfilenamewidget.cpp
index 057c1b9c6..6bdc862d8 100644
--- a/rkward/misc/getfilenamewidget.cpp
+++ b/rkward/misc/getfilenamewidget.cpp
@@ -85,7 +85,7 @@ void GetFileNameWidget::setFilter (const QString &filter) {
 	RK_TRACE (MISC);
 
 	RK_ASSERT (edit);
-	edit->setFilter (filter);
+	edit->setNameFilter (filter);
 }
 
 void GetFileNameWidget::updateLastUsedUrl (const QUrl& url) {
diff --git a/rkward/misc/rkcommonfunctions.cpp b/rkward/misc/rkcommonfunctions.cpp
index 421420192..aef31ebb6 100644
--- a/rkward/misc/rkcommonfunctions.cpp
+++ b/rkward/misc/rkcommonfunctions.cpp
@@ -8,7 +8,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include <qstringlist.h>
 #include <qdom.h>
-#include <qregexp.h>
 #include <QDir>
 #include <QStandardPaths>
 #include <QCoreApplication>
@@ -17,7 +16,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <KLocalizedString>
 #include <kxmlguiclient.h>
 
-#include "../settings/rksettingsmodulegeneral.h"
 #include "../windows/rkworkplace.h"
 #include "../version.h"
 #include "../debug.h"
diff --git a/rkward/misc/rkdbusapi.cpp b/rkward/misc/rkdbusapi.cpp
index 3504740e3..bead200e1 100644
--- a/rkward/misc/rkdbusapi.cpp
+++ b/rkward/misc/rkdbusapi.cpp
@@ -8,8 +8,8 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "rkdbusapi.h"
 
 #include <QDBusConnection>
-#include <kwindowsystem.h>
-#include "../windows/rkworkplace.h"
+#include <KWindowSystem>
+#include <KStartupInfo>
 #include "../rkward.h"
 
 #include "../debug.h"
@@ -30,7 +30,7 @@ RKDBusAPI::RKDBusAPI (QObject* parent): QObject (parent) {
 	QDBusConnection::sessionBus ().registerObject ("/", this, QDBusConnection::ExportScriptableSlots);
 }
 
-void RKDBusAPI::openAnyUrl (const QStringList& urls, bool warn_external) {
+void RKDBusAPI::openAnyUrl (const QStringList& urls, const QString &token, bool warn_external) {
 	RK_TRACE (APP);
 
 	// ok, raising the app window is totally hard to do, reliably. This solution copied from kate.
@@ -38,9 +38,14 @@ void RKDBusAPI::openAnyUrl (const QStringList& urls, bool warn_external) {
 	main->show();
 	main->activateWindow();
 	main->raise();
-	KWindowSystem::forceActiveWindow (main->winId ());
-	KWindowSystem::raiseWindow (main->winId ());
-	KWindowSystem::demandAttention (main->winId ());
+
+	if (KWindowSystem::isPlatformX11()) {
+		KStartupInfo::setNewStartupId(main->windowHandle(), token.toUtf8());
+	} else if (KWindowSystem::isPlatformWayland()) {
+		KWindowSystem::setCurrentXdgActivationToken(token);
+	}
+
+	KWindowSystem::activateWindow(main->windowHandle());
 	// end
 
 	RKWardMainWindow::getMain ()->openUrlsFromCommandLineOrDBus (warn_external, urls);
diff --git a/rkward/misc/rkdbusapi.h b/rkward/misc/rkdbusapi.h
index 7116ae88b..23896eca1 100644
--- a/rkward/misc/rkdbusapi.h
+++ b/rkward/misc/rkdbusapi.h
@@ -19,7 +19,7 @@ public:
 	explicit RKDBusAPI (QObject *parent);
 	~RKDBusAPI () {};
 public Q_SLOTS:
-	Q_SCRIPTABLE void openAnyUrl (const QStringList &urls, bool warn_external=true);
+	Q_SCRIPTABLE void openAnyUrl (const QStringList &urls, const QString &token, bool warn_external=true);
 };
 
 #endif
diff --git a/rkward/misc/rkmessagecatalog.cpp b/rkward/misc/rkmessagecatalog.cpp
index 4e4b900ca..978136d0a 100644
--- a/rkward/misc/rkmessagecatalog.cpp
+++ b/rkward/misc/rkmessagecatalog.cpp
@@ -9,6 +9,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include <QFile>
 #include <KLocalizedString>
+#include <KLazyLocalizedString>
 
 #include "../debug.h"
 
@@ -31,28 +32,28 @@ RKMessageCatalog::~RKMessageCatalog () {
 
 QString RKMessageCatalog::translate(const QString &msgctxt, const QString &msgid, const QStringList &args) const {
 	RK_TRACE(MISC);
-	auto ret = ki18ndc(catalog_name, msgctxt.toUtf8(), msgid.toUtf8());
+	auto ret = ki18ndc(catalog_name.constData(), msgctxt.toUtf8().constData(), msgid.toUtf8().constData());
 	for(int i = 0; i < args.size(); ++i) ret = ret.subs(args[i]);
 	return ret.toString();
 }
 
 QString RKMessageCatalog::translate(const QString &msgctxt, const QString &msgid_singular, const QString &msgid_plural, unsigned long int count, const QStringList &args) const {
 	RK_TRACE(MISC);
-	auto ret = ki18ndcp(catalog_name, msgctxt.toUtf8(), msgid_singular.toUtf8(), msgid_plural.toUtf8()).subs(count);
+	auto ret = ki18ndcp(catalog_name.constData(), msgctxt.toUtf8().constData(), msgid_singular.toUtf8().constData(), msgid_plural.toUtf8().constData()).subs(count);
 	for(int i = 0; i < args.size(); ++i) ret = ret.subs(args[i]);
 	return ret.toString();
 }
 
 QString RKMessageCatalog::translate(const QString &msgid, const QStringList &args) const {
 	RK_TRACE(MISC);
-	auto ret = ki18nd(catalog_name, msgid.toUtf8());
+	auto ret = ki18nd(catalog_name.constData(), msgid.toUtf8().constData());
 	for(int i = 0; i < args.size(); ++i) ret = ret.subs(args[i]);
 	return ret.toString();
 }
 
 QString RKMessageCatalog::translate(const QString &msgid_singular, const QString &msgid_plural, unsigned long int count, const QStringList &args) const {
 	RK_TRACE(MISC);
-	auto ret = ki18ndp(catalog_name, msgid_singular.toUtf8(), msgid_plural.toUtf8()).subs(count);
+	auto ret = ki18ndp(catalog_name.constData(), msgid_singular.toUtf8().constData(), msgid_plural.toUtf8().constData()).subs(count);
 	for(int i = 0; i < args.size(); ++i) ret = ret.subs(args[i]);
 	return ret.toString();
 }
@@ -60,11 +61,11 @@ QString RKMessageCatalog::translate(const QString &msgid_singular, const QString
 RKMessageCatalog* RKMessageCatalog::CatalogHash::getCatalog (const QString& name, const QString& pathhint) {
 	RK_TRACE (MISC);
 
-	RKMessageCatalog *ret = catalogs.value (name, 0);
+	RKMessageCatalog *ret = catalogs.value (name, nullptr);
 	if (ret) return ret;
 	setup_mutex.lock ();
 		// try to look up again, in case initialized from another thread
-		ret = catalogs.value (name, 0);
+		ret = catalogs.value (name, nullptr);
 		if (!ret) {
 			ret = new RKMessageCatalog (name, pathhint);
 			catalogs.insert (name, ret);
diff --git a/rkward/misc/rkobjectlistview.cpp b/rkward/misc/rkobjectlistview.cpp
index 44106e38e..e8202bdf3 100644
--- a/rkward/misc/rkobjectlistview.cpp
+++ b/rkward/misc/rkobjectlistview.cpp
@@ -335,7 +335,7 @@ void RKObjectListViewSettings::resetFilters () {
 		hide_functions = hide_non_functions = false;
 		filter_on_class = filter_on_label = filter_on_name = true;
 		depth_limit = 1;
-		setFilterRegExp (QRegExp ());
+		setFilterRegularExpression (QRegularExpression{});
 	}
 	in_reset_filters = false;
 	updateSelf ();
@@ -432,13 +432,13 @@ bool RKObjectListViewSettings::acceptRow (int source_row, const QModelIndex& sou
 	if (hide_functions && object->isType (RObject::Function)) return false;
 	if (hide_non_functions && !object->isType (RObject::Function)) return false;
 
-	if (filterRegExp ().isEmpty ()) return true;
-	if (filter_on_name && object->getShortName ().contains (filterRegExp ())) return true;
-	if (filter_on_label && object->getLabel ().contains (filterRegExp ())) return true;
+	if (filterRegularExpression ().isValid ()) return true;
+	if (filter_on_name && object->getShortName ().contains (filterRegularExpression ())) return true;
+	if (filter_on_label && object->getLabel ().contains (filterRegularExpression ())) return true;
 	if (filter_on_class) {
 		QStringList cnames = object->classNames ();
 		for (int i = cnames.length () - 1; i >= 0; --i) {
-			if (cnames[i].contains (filterRegExp ())) return true;
+			if (cnames[i].contains (filterRegularExpression ())) return true;
 		}
 	}
 
diff --git a/rkward/misc/rkoutputdirectory.cpp b/rkward/misc/rkoutputdirectory.cpp
index 23f5207ad..6b2093e56 100644
--- a/rkward/misc/rkoutputdirectory.cpp
+++ b/rkward/misc/rkoutputdirectory.cpp
@@ -335,11 +335,11 @@ GenericRRequestResult RKOutputDirectory::purge(RKOutputDirectory::OverwriteBehav
 			return GenericRRequestResult::makeError(i18n("Output has been modified. Not closing it."));
 		}
 		if (discard == Ask) {
-			auto res = KMessageBox::questionYesNoCancel(RKWardMainWindow::getMain(), i18n("The output has been modified, and closing it will discard all changes. What do you want to do?"), i18n("Discard unsaved changes?"), KStandardGuiItem::discard(), KStandardGuiItem::save(), KStandardGuiItem::cancel());
+			auto res = KMessageBox::questionTwoActionsCancel(RKWardMainWindow::getMain(), i18n("The output has been modified, and closing it will discard all changes. What do you want to do?"), i18n("Discard unsaved changes?"), KStandardGuiItem::discard(), KStandardGuiItem::save(), KStandardGuiItem::cancel());
 			if (res == KMessageBox::Cancel) {
 				return GenericRRequestResult::makeError(i18n("User canceled"));
 			}
-			if (res == KMessageBox::No) {
+			if (res == KMessageBox::SecondaryAction) {
 				auto ret = save(save_filename);
 				if (ret.failed()) return ret;
 			}
diff --git a/rkward/misc/rkparsedversion.cpp b/rkward/misc/rkparsedversion.cpp
index f4362ed04..b713de49e 100644
--- a/rkward/misc/rkparsedversion.cpp
+++ b/rkward/misc/rkparsedversion.cpp
@@ -16,7 +16,7 @@ RKParsedVersion::RKParsedVersion(const QString& version) {
 		while (true) {
 			++pos;
 			if (!(pos < version.size () && version[pos].isDigit ())) {
-				int val = version.midRef(opos, pos - opos).toInt();
+				int val = QStringView{version}.mid(opos, pos - opos).toInt();
 				if ((val < 0) || (val > 255) || (pos == opos)) {
 					RK_DEBUG (MISC, DL_ERROR, "Invalid version specification '%s'", qPrintable (version));
 					if (val > 255) val = 255;
diff --git a/rkward/misc/rkprogresscontrol.cpp b/rkward/misc/rkprogresscontrol.cpp
index 5d37521d9..14120b30e 100644
--- a/rkward/misc/rkprogresscontrol.cpp
+++ b/rkward/misc/rkprogresscontrol.cpp
@@ -213,7 +213,7 @@ QString RKProgressControl::fullCommandOutput() {
 	RK_TRACE (MISC);
 
 	QString ret;
-	foreach (const ROutput& out, output_log) ret.append (out.output);
+	for (const ROutput& out : std::as_const(output_log)) ret.append (out.output);
 	return ret;
 }
 
diff --git a/rkward/misc/rkspecialactions.cpp b/rkward/misc/rkspecialactions.cpp
index 25ef58261..17c0af4cc 100644
--- a/rkward/misc/rkspecialactions.cpp
+++ b/rkward/misc/rkspecialactions.cpp
@@ -225,7 +225,7 @@ QString RKPasteSpecialDialog::resultingText () {
 
 	if (dim == DimSingleString) return prepString(clip, quot);
 
-	QRegExp fieldsep;
+	QRegularExpression fieldsep;
 	if (sep == SepCustom) fieldsep.setPattern (separator_freefield->text ());
 	else if (sep == SepWhitespace) fieldsep.setPattern ("\\s+");
 	else if (sep == SepSpace) fieldsep.setPattern (" ");
diff --git a/rkward/misc/rkstandardactions.cpp b/rkward/misc/rkstandardactions.cpp
index a9b481ee2..3f9a379d8 100644
--- a/rkward/misc/rkstandardactions.cpp
+++ b/rkward/misc/rkstandardactions.cpp
@@ -34,7 +34,7 @@ QAction* RKStandardActions::pasteSpecial (RKMDIWindow *window, const QObject *re
 	QAction* ret = new RKPasteSpecialAction (window->standardActionCollection ());
 	window->standardActionCollection ()->addAction ("paste_special", ret);
 	ret->connect (ret, SIGNAL (pasteText(QString)), receiver, member);
-	window->standardActionCollection ()->setDefaultShortcut (ret, Qt::ShiftModifier + Qt::ControlModifier + Qt::Key_V);
+	window->standardActionCollection ()->setDefaultShortcut (ret, Qt::ShiftModifier | Qt::ControlModifier | Qt::Key_V);
 	return ret;
 }
 
@@ -50,7 +50,10 @@ QAction* RKStandardActions::runCurrent (RKMDIWindow *window, const QObject *rece
 		ret->setText (i18n ("Run selection"));
 	}
 	ret->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionRunLine));
-	window->standardActionCollection ()->setDefaultShortcuts (ret, QList<QKeySequence>() << Qt::ControlModifier + Qt::Key_Return << Qt::ControlModifier + Qt::Key_Enter);
+	window->standardActionCollection ()->setDefaultShortcuts (ret, {
+		Qt::ControlModifier | Qt::Key_Return,
+		Qt::ControlModifier | Qt::Key_Enter
+	});
 
 	return ret;
 }
@@ -61,7 +64,10 @@ QAction* RKStandardActions::runAll (RKMDIWindow *window, const QObject *receiver
 	QAction* ret = window->standardActionCollection ()->addAction ("run_all", receiver, member);
 	ret->setText (i18n ("Run all"));
 	ret->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionRunAll));
-	window->standardActionCollection ()->setDefaultShortcuts (ret, QList<QKeySequence>() << Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Return << Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Enter);
+	window->standardActionCollection ()->setDefaultShortcuts (ret, {
+		Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Return,
+		Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Enter
+	});
 
 	return ret;
 }
diff --git a/rkward/misc/rkstyle.cpp b/rkward/misc/rkstyle.cpp
index a9b4a0736..c03195164 100644
--- a/rkward/misc/rkstyle.cpp
+++ b/rkward/misc/rkstyle.cpp
@@ -16,11 +16,11 @@ SPDX-License-Identifier: GPL-2.0-or-later
 KColorScheme* RKStyle::_view_scheme = nullptr;
 
 int RKStyle::marginHint() {
-	return QApplication::style()->pixelMetric(QStyle::PM_DefaultChildMargin);
+	return QApplication::style()->pixelMetric(QStyle::PM_LayoutTopMargin);
 }
 
 int RKStyle::spacingHint() {
-	return QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
+	return QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
 }
 
 KColorScheme* RKStyle::viewScheme() {
diff --git a/rkward/rbackend/CMakeLists.txt b/rkward/rbackend/CMakeLists.txt
index 1a0d17d68..0b4f50f41 100644
--- a/rkward/rbackend/CMakeLists.txt
+++ b/rkward/rbackend/CMakeLists.txt
@@ -48,7 +48,7 @@ ADD_DEFINITIONS (-DRKWARD_BACKEND_PATH="${KDE_INSTALL_FULL_LIBEXECDIR}")
 LINK_DIRECTORIES(${R_SHAREDLIBDIR})
 ADD_EXECUTABLE(rkward.rbackend ${rbackend_backend_SRCS} ${rbackend_shared_SRCS})
 ECM_MARK_NONGUI_EXECUTABLE(rkward.rbackend)
-TARGET_LINK_LIBRARIES(rkward.rbackend rkgraphicsdevice.backend ${R_USED_LIBS} ${CMAKE_THREAD_LIBS_INIT} Qt6::Network Qt6::Core KF6::I18n)
+TARGET_LINK_LIBRARIES(rkward.rbackend rkgraphicsdevice.backend ${R_USED_LIBS} ${CMAKE_THREAD_LIBS_INIT} Qt6::Network Qt6::Core KF6::I18n Qt6::Core5Compat)
 IF(WIN32)
 # 64MB stack size is what R itself is build with on Windows, while by default the stack size would be 1MB
 # Not sure, if 64MB is actually needed, but 1MB does cause trouble e.g. with some shiny apps.
diff --git a/rkward/rbackend/rkfrontendtransmitter.cpp b/rkward/rbackend/rkfrontendtransmitter.cpp
index 9cd872b8b..5dfa2a5c7 100644
--- a/rkward/rbackend/rkfrontendtransmitter.cpp
+++ b/rkward/rbackend/rkfrontendtransmitter.cpp
@@ -10,13 +10,13 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "rkrbackendprotocol_frontend.h"
 #include "rkwarddevice/rkgraphicsdevice_frontendtransmitter.h"
 #include "rksessionvars.h"
-#include "../misc/rkcommonfunctions.h"
 #include "../settings/rksettingsmodulegeneral.h"
 
 #include <KLocalizedString>
 #include <krandom.h>
 
 #include <QCoreApplication>
+#include <QRegularExpression>
 #include <QProcess>
 #include <QLocalServer>
 #include <QLocalSocket>
@@ -81,7 +81,7 @@ void RKFrontendTransmitter::run () {
 
 	// Try to synchronize language selection in frontend and backend
 	QStringList env = QProcess::systemEnvironment ();
-	int index = env.indexOf (QRegExp("^LANGUAGE=.*", Qt::CaseInsensitive));
+	int index = env.indexOf (QRegularExpression(QStringLiteral("^LANGUAGE=.*"), QRegularExpression::CaseInsensitiveOption));
 	if (index >= 0) env.removeAt (index);
 	env.append ("LANGUAGE=" + QLocale ().name ().section ('_', 0, 0));
 	backend->setEnvironment (env);
@@ -121,12 +121,12 @@ void RKFrontendTransmitter::run () {
 	args.append(backend_executable);
 #endif
 
-	args.append ("--debug-level=" + QString::number (RK_Debug::RK_Debug_Level));
-	// NOTE: QProcess quotes its arguments, *but* properly passing all spaces and quotes through the R CMD wrapper, seems near(?) impossible on Windows. Instead, we use percent encoding, internally.
-	args.append ("--server-name=" + server->fullServerName ().toUtf8 ().toPercentEncoding ());
-	args.append ("--rkd-server-name=" + rkd_transmitter->serverName ().toUtf8 ().toPercentEncoding ());
-	args.append ("--data-dir=" + RKSettingsModuleGeneral::filesPath ().toUtf8 ().toPercentEncoding ());
-	args.append ("--locale-dir=" + localeDir ().toUtf8 ().toPercentEncoding ());
+	args.append (QStringLiteral("--debug-level=") + QString::number (RK_Debug::RK_Debug_Level));
+	// NOTE: QProQByteArray(cess quotes its arguments, *but* properly passing all spaces and quotes through the R CMD wrapper, seems near(?) impossible on Windows. Instead, we use percent encoding, internally.
+	args.append (QStringLiteral("--server-name=") + server->fullServerName ().toUtf8 ().toPercentEncoding ());
+	args.append (QStringLiteral("--rkd-server-name=") + rkd_transmitter->serverName ().toUtf8 ().toPercentEncoding ());
+	args.append (QStringLiteral("--data-dir=") + RKSettingsModuleGeneral::filesPath ().toUtf8 ().toPercentEncoding ());
+	args.append (QStringLiteral("--locale-dir=") + localeDir ().toUtf8 ().toPercentEncoding ());
 	RK_DO({
 		RK_DEBUG(RBACKEND, DL_DEBUG, "R binary: %s", qPrintable(RKSessionVars::RBinary()));
 		RK_DEBUG(RBACKEND, DL_DEBUG, "%s", qPrintable(args.join("\n")));
@@ -243,7 +243,7 @@ void RKFrontendTransmitter::requestReceived (RBackendRequest* request) {
 			delete (out);
 		}
 		delete list;
-		request->output = 0;
+		request->output = nullptr;
 		RK_ASSERT (request->synchronous);
 		writeRequest (request);	// to tell the backend, that we are keeping up. Also deletes the request.
 		return;
diff --git a/rkward/rbackend/rkrbackend.cpp b/rkward/rbackend/rkrbackend.cpp
index 457eb0593..c8d65a225 100644
--- a/rkward/rbackend/rkrbackend.cpp
+++ b/rkward/rbackend/rkrbackend.cpp
@@ -23,7 +23,8 @@ RKRBackend *RKRBackend::this_pointer = nullptr;
 RKRBackend::RKReplStatus RKRBackend::repl_status = { QByteArray (), 0, true, 0, 0, RKRBackend::RKReplStatus::NoUserCommand, 0, RKRBackend::RKReplStatus::NotInBrowserContext, false };
 void* RKRBackend::default_global_context = nullptr;
 
-#include <qstring.h>
+#include <QString>
+#include <QTextCodec>
 #include <QStringList>
 #include <QThread>
 #include <QDir>
@@ -783,7 +784,7 @@ void RBusy (int busy) {
 			}
 			if (RKRBackend::this_pointer->current_command->type & RCommand::CCCommand) {
 				QByteArray chunk = RKRBackend::repl_status.user_command_buffer.mid (RKRBackend::repl_status.user_command_parsed_up_to, RKRBackend::repl_status.user_command_transmitted_up_to - RKRBackend::repl_status.user_command_parsed_up_to);
-				RKRBackend::this_pointer->printCommand (RKRBackend::toUtf8 (chunk));
+				RKRBackend::this_pointer->printCommand (RKRBackend::toUtf8 (chunk.data()));
 			}
 			RKRBackend::repl_status.user_command_parsed_up_to = RKRBackend::repl_status.user_command_transmitted_up_to;
 			RKRBackend::repl_status.user_command_status = RKRBackend::RKReplStatus::UserCommandRunning;
@@ -806,7 +807,6 @@ RKRBackend::RKRBackend() : stdout_stderr_mutex(DUMMY_MUTEX_FLAGS) {
 	RK_ASSERT (this_pointer == 0);
 	this_pointer = this;
 
-	current_locale_encoder = 0; // marks locale as not yet initialized
 	doUpdateLocale ();
 	r_running = false;
 
@@ -943,8 +943,8 @@ SEXP doSubstackCall (SEXP _call, SEXP _args) {
 
 	// For now, for simplicity, assume args are always strings, although possibly nested in lists
 	auto ret = RKRBackend::this_pointer->handleRequestWithSubcommands(call, RKRSupport::SEXPToNestedStrings(_args));
-	if (!ret.warning.isEmpty()) Rf_warning(RKRBackend::fromUtf8(ret.warning));  // print warnings, first, as errors will cause a stop
-	if (!ret.error.isEmpty()) Rf_error(RKRBackend::fromUtf8(ret.error));
+	if (!ret.warning.isEmpty()) Rf_warning(RKRBackend::fromUtf8(ret.warning).constData());  // print warnings, first, as errors will cause a stop
+	if (!ret.error.isEmpty()) Rf_error(RKRBackend::fromUtf8(ret.error.toLatin1()).constData());
 
 	return RKRSupport::QVariantToSEXP(ret.ret);
 }
@@ -955,8 +955,8 @@ SEXP doPlainGenericRequest (SEXP call, SEXP synchronous) {
 	R_CheckUserInterrupt ();
 
 	auto ret = RKRBackend::this_pointer->handlePlainGenericRequest(RKRSupport::SEXPToStringList(call), RKRSupport::SEXPToInt(synchronous));
-	if (!ret.warning.isEmpty()) Rf_warning(RKRBackend::fromUtf8(ret.warning));  // print warnings, first, as errors will cause a stop
-	if (!ret.error.isEmpty()) Rf_error(RKRBackend::fromUtf8(ret.error));
+	if (!ret.warning.isEmpty()) Rf_warning(RKRBackend::fromUtf8(ret.warning).constData());  // print warnings, first, as errors will cause a stop
+	if (!ret.error.isEmpty()) Rf_error(RKRBackend::fromUtf8(ret.error.toLatin1()).constData());
 
 	return RKRSupport::QVariantToSEXP(ret.ret);
 }
diff --git a/rkward/rbackend/rkrinterface.cpp b/rkward/rbackend/rkrinterface.cpp
index 849044a14..13f25e1a1 100644
--- a/rkward/rbackend/rkrinterface.cpp
+++ b/rkward/rbackend/rkrinterface.cpp
@@ -462,7 +462,7 @@ void RInterface::flushOutput (bool forced) {
 		}
 	}
 
-	for (ROutput *output, list) {
+	for (ROutput *output : list) {
 		if (all_current_commands.isEmpty ()) {
 			RK_DEBUG (RBACKEND, DL_DEBUG, "output without receiver'%s'", qPrintable (output->output));
 			if (RKConsole::mainConsole()) RKConsole::mainConsole()->insertSpontaneousROutput(output);  // the "if" is to prevent crash, should output arrive during exit
diff --git a/rkward/rbackend/rkrsupport.cpp b/rkward/rbackend/rkrsupport.cpp
index 7e7514c9a..a7ba9f710 100644
--- a/rkward/rbackend/rkrsupport.cpp
+++ b/rkward/rbackend/rkrsupport.cpp
@@ -14,8 +14,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #define IS_UTF8(x) (Rf_getCharCE(x) == CE_UTF8)
 #define IS_LATIN1(x) (Rf_getCharCE(x) == CE_LATIN1)
 
-#include <QTextCodec>
-
 #include "rkrbackend.h"
 #include "../debug.h"
 
@@ -123,7 +121,7 @@ SEXP RKRSupport::StringListToSEXP (const QStringList& list) {
 	SEXP ret = Rf_allocVector (STRSXP, list.size ());
 	for (int i = 0; i < list.size (); ++i) {
 #if R_VERSION >= R_Version(2,13,0)
-		SET_STRING_ELT (ret, i, Rf_mkCharCE (list[i].toUtf8 (), CE_UTF8));
+		SET_STRING_ELT (ret, i, Rf_mkCharCE (list[i].toUtf8 ().constData(), CE_UTF8));
 #else
 		// TODO Rf_mkCharCE _might_ have been introduced earlier. Check if still an ongoing concern.
 		SET_STRING_ELT (ret, i, Rf_mkChar (RKRBackend::fromUtf8 (list[i]).data ()));
@@ -154,7 +152,7 @@ SEXP RKRSupport::QVariantToSEXP(const QVariant& var) {
 	SEXP ret = Rf_allocVector (STRSXP, list.size ());
 	for (int i = 0; i < list.size (); ++i) {
 #if R_VERSION >= R_Version(2,13,0)
-		SET_STRING_ELT (ret, i, Rf_mkCharCE (list[i].toUtf8 (), CE_UTF8));
+		SET_STRING_ELT (ret, i, Rf_mkCharCE (list[i].toUtf8 ().constData(), CE_UTF8));
 #else
 		// TODO Rf_mkCharCE _might_ have been introduced earlier. Check if still an ongoing concern.
 		SET_STRING_ELT (ret, i, Rf_mkChar (RKRBackend::fromUtf8 (list[i]).data ()));
@@ -319,7 +317,7 @@ void RKRShadowEnvironment::updateCacheForGlobalenvSymbol(const QString& name) {
 
 void RKRShadowEnvironment::updateSymbolCache(const QString& name) {
 	RK_TRACE(RBACKEND);
-	SEXP rname = Rf_installChar(Rf_mkCharCE(name.toUtf8(), CE_UTF8));
+	SEXP rname = Rf_installChar(Rf_mkCharCE(name.toUtf8().constData(), CE_UTF8));
 	PROTECT(rname);
 	SEXP symbol_g = Rf_findVar(rname, R_GlobalEnv);
 	PROTECT(symbol_g);
diff --git a/rkward/rbackend/rkstructuregetter.cpp b/rkward/rbackend/rkstructuregetter.cpp
index 71d5d3db2..6109b5163 100644
--- a/rkward/rbackend/rkstructuregetter.cpp
+++ b/rkward/rbackend/rkstructuregetter.cpp
@@ -473,6 +473,6 @@ void RKStructureGetter::getStructureWorker (SEXP val, const QString &name, int a
 
 	UNPROTECT (1); /* value */
 
-	RK_ASSERT (!res.contains (0));
+	RK_ASSERT (!res.contains (nullptr));
 	storage->setData (res);
 }
diff --git a/rkward/rbackend/rpackages/CMakeLists.txt b/rkward/rbackend/rpackages/CMakeLists.txt
index 1614f0d36..588d2007c 100644
--- a/rkward/rbackend/rpackages/CMakeLists.txt
+++ b/rkward/rbackend/rpackages/CMakeLists.txt
@@ -62,4 +62,4 @@ createRpackage(rkward)
 createRpackage(rkwardtests)
 ADD_CUSTOM_TARGET(rpackages ALL DEPENDS rkward.tgz rkwardtests.tgz)
 
-INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/rkward.tgz" "${CMAKE_CURRENT_BINARY_DIR}/rkwardtests.tgz" DESTINATION ${DATA_INSTALL_DIR}/rkward/rpackages)
+INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/rkward.tgz" "${CMAKE_CURRENT_BINARY_DIR}/rkwardtests.tgz" DESTINATION ${KDE_INSTALL_DATADIR}/rkward/rpackages)
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index ed3b5afe1..1ef5eed2d 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -32,9 +32,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <kmessagebox.h>
 #include <kshellcompletion.h>
 #include <ktexteditor/editor.h>
-#include <ktexteditor/configinterface.h>
-#include <ktexteditor/codecompletioninterface.h>
-#include <ktexteditor/markinterface.h>
 #include <ktexteditor_version.h>
 #include <kxmlguifactory.h>
 #include <kio/filecopyjob.h>
@@ -135,11 +132,9 @@ RKConsole::RKConsole (QWidget *parent, bool tool_window, const char *name) : RKM
 	setMetaInfo (shortCaption (), QUrl ("rkward://page/rkward_console"), RKSettings::PageConsole);
 	initializeActivationSignals ();
 	initializeActions (getPart ()->actionCollection ());
-	KTextEditor::ConfigInterface *confint = qobject_cast<KTextEditor::ConfigInterface*> (view);
-	RK_ASSERT(confint);
-	QAction* action = RKSettingsModuleConsole::showMinimap()->makeAction(this, i18n("Scrollbar minimap"), [confint](bool val) { confint->setConfigValue("scrollbar-minimap", val); });
+	QAction* action = RKSettingsModuleConsole::showMinimap()->makeAction(this, i18n("Scrollbar minimap"), [this](bool val) { view->setConfigValue("scrollbar-minimap", val); });
 	getPart()->actionCollection()->addAction("view_show_minimap", action);
-	action = RKSettingsModuleConsole::wordWrap()->makeAction(this, i18n("Dynamic word wrap"), [confint](bool val) { confint->setConfigValue("dynamic-word-wrap", val); });
+	action = RKSettingsModuleConsole::wordWrap()->makeAction(this, i18n("Dynamic word wrap"), [this](bool val) { view->setConfigValue("dynamic-word-wrap", val); });
 	getPart()->actionCollection()->addAction("view_dynamic_word_wrap", action);
 
 	nprefix = "> ";
@@ -312,7 +307,7 @@ bool RKConsole::handleKeyPress (QKeyEvent *e) {
 		if (modifier == Qt::NoModifier) setCursorClear (para, pos - 1);
 		else if (modifier == Qt::ShiftModifier) triggerEditAction ("select_char_left");
 		else if (modifier == Qt::ControlModifier) triggerEditAction ("word_left");
-		else if (modifier == (Qt::ControlModifier + Qt::ShiftModifier)) triggerEditAction ("select_word_left");
+		else if (modifier == (Qt::ControlModifier | Qt::ShiftModifier)) triggerEditAction ("select_word_left");
 		else return false;
 
 		return true;
@@ -322,7 +317,7 @@ bool RKConsole::handleKeyPress (QKeyEvent *e) {
 		if (modifier == Qt::NoModifier) setCursorClear (para, pos + 1);
 		else if (modifier == Qt::ShiftModifier) triggerEditAction ("select_char_right");
 		else if (modifier == Qt::ControlModifier) triggerEditAction ("word_right");
-		else if (modifier == (Qt::ControlModifier + Qt::ShiftModifier)) triggerEditAction ("select_word_right");
+		else if (modifier == (Qt::ControlModifier | Qt::ShiftModifier)) triggerEditAction ("select_word_right");
 		else return false;
 
 		return true;
@@ -469,7 +464,7 @@ void RKConsole::submitCommand () {
 			last_line_end = 0;
 			RK_ASSERT (false);
 		}
-		command.append(input_buffer.leftRef(last_line_end));
+		command.append(QStringView{input_buffer}.left(last_line_end));
 		if (last_line_end < (input_buffer.size() - 1)) {
 			input_buffer = input_buffer.mid(last_line_end + 1);
 		} else {
@@ -581,10 +576,8 @@ void RKConsole::newOutput (RCommand *command, const ROutput *output) {
 
 	int end_line = doc->lines () -1;
 	if (output->type != ROutput::Output || (!command)) {
-		KTextEditor::MarkInterface *markiface = qobject_cast<KTextEditor::MarkInterface*> (doc);
-		RK_ASSERT (markiface);
 		for (int line = first_line; line < end_line; ++line) {
-			markiface->addMark (line, command ? KTextEditor::MarkInterface::BreakpointActive : KTextEditor::MarkInterface::BreakpointDisabled);
+			doc->addMark (line, command ? KTextEditor::Document::BreakpointActive : KTextEditor::Document::BreakpointDisabled);
 		}
 	}
 
@@ -634,7 +627,7 @@ void RKConsole::submitBatch (const QString &batch) {
 		int pos = currentCursorPositionInCommand ();
 		if (pos >= 0) {
 			setCurrentEditingLine(line.left(pos));
-			input_buffer.append(line.midRef(pos));
+			input_buffer.append(QStringView{line}.mid(pos));
 		}
 	}
 	if (!current_command) tryNextInBuffer ();
@@ -761,12 +754,12 @@ QString RKConsole::cleanSelection (const QString &origin) {
 
 	QString ret;
 	ret.reserve (origin.length ());
-	cosnt QStringList lines = origin.split ('\n');
+	const QStringList lines = origin.split ('\n');
 	for (const QString& line : lines) {
 		if (line.startsWith(nprefix)) {
-			ret.append(line.midRef(nprefix.length()));
+			ret.append(QStringView{line}.mid(nprefix.length()));
 		} else if (line.startsWith(iprefix)) {
-			ret.append(line.midRef(iprefix.length()));
+			ret.append(QStringView{line}.mid(iprefix.length()));
 		} else {
 			ret.append(line);
 		}
@@ -908,10 +901,10 @@ void RKConsole::pipeCommandThroughConsoleLocal (const QString &command_string) {
 
 	activate (false);
 	if (isBusy () && (!previous_chunk_was_piped)) {
-		int res = KMessageBox::questionYesNoCancel (this, i18n ("You have configured RKWard to pipe script editor commands through the R Console. However, another command is currently active in the console. Do you want to append it to the command in the console, or do you want to reset the console, first? Press cancel if you do not wish to run the new command, now."), i18n ("R Console is busy"), KGuiItem (i18n ("Append")), KGuiItem (i18n ("Reset, then submit")));
-		if (res == KMessageBox::No) {
+		int res = KMessageBox::questionTwoActionsCancel (this, i18n ("You have configured RKWard to pipe script editor commands through the R Console. However, another command is currently active in the console. Do you want to append it to the command in the console, or do you want to reset the console, first? Press cancel if you do not wish to run the new command, now."), i18n ("R Console is busy"), KGuiItem (i18n ("Append")), KGuiItem (i18n ("Reset, then submit")));
+		if (res == KMessageBox::Cancel) {
 			resetConsole ();
-		} else if (res != KMessageBox::Yes) {
+		} else if (res != KMessageBox::PrimaryAction) {
 			return;
 		}
 	}
diff --git a/rkward/rkconsole.h b/rkward/rkconsole.h
index a3bc03aa2..0ea316bfe 100644
--- a/rkward/rkconsole.h
+++ b/rkward/rkconsole.h
@@ -20,7 +20,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 class QEvent;
 class QKeyEvent;
-class QStringList;
 class QAction;
 class KActionCollection;
 class RKConsolePart;
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index 4216ab1b8..88e39d1f3 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -490,7 +490,7 @@ void RKWardMainWindow::initActions() {
 
 	fileOpenScript = actionCollection()->addAction(KStandardAction::Open, "file_open_script");
 	connect(fileOpenScript, &QAction::triggered, this, [this]() { slotOpenCommandEditor(); });
-	actionCollection()->setDefaultShortcut(fileOpenScript, Qt::ControlModifier + Qt::AltModifier + Qt::Key_O);
+	actionCollection()->setDefaultShortcut(fileOpenScript, Qt::ControlModifier | Qt::AltModifier | Qt::Key_O);
 	fileOpenScript->setText(i18n("Open R Script File..."));
 
 	fileOpenOutput = actionCollection()->addAction(KStandardAction::Open, "file_open_output", this, SLOT(slotOpenOutput()));
@@ -514,7 +514,7 @@ void RKWardMainWindow::initActions() {
 	fileOpenWorkspace = actionCollection()->addAction(KStandardAction::Open, "file_openx");
 	connect(fileOpenWorkspace, &QAction::triggered, this, [this](){ askOpenWorkspace(); });
 	fileOpenWorkspace->setText (i18n ("Open Workspace..."));
-	actionCollection ()->setDefaultShortcut (fileOpenWorkspace, Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_O);
+	actionCollection ()->setDefaultShortcut (fileOpenWorkspace, Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_O);
 	fileOpenWorkspace->setWhatsThis(i18n ("Opens an existing document"));
 
 	fileOpenRecentWorkspace = RKRecentUrls::claimAction(RKRecentUrls::workspaceId());
@@ -525,11 +525,11 @@ void RKWardMainWindow::initActions() {
 
 	fileSaveWorkspace = actionCollection ()->addAction (KStandardAction::Save, "file_savex", this, SLOT(slotFileSaveWorkspace()));
 	fileSaveWorkspace->setText (i18n ("Save Workspace"));
-	actionCollection ()->setDefaultShortcut (fileSaveWorkspace, Qt::ControlModifier + Qt::AltModifier + Qt::Key_S);
+	actionCollection ()->setDefaultShortcut (fileSaveWorkspace, Qt::ControlModifier | Qt::AltModifier | Qt::Key_S);
 	fileSaveWorkspace->setWhatsThis(i18n ("Saves the actual document"));
 
 	fileSaveWorkspaceAs = actionCollection ()->addAction (KStandardAction::SaveAs, "file_save_asx", this, SLOT(slotFileSaveWorkspaceAs()));
-	actionCollection ()->setDefaultShortcut (fileSaveWorkspaceAs, Qt::ControlModifier + Qt::AltModifier + Qt::ShiftModifier + Qt::Key_S);
+	actionCollection ()->setDefaultShortcut (fileSaveWorkspaceAs, Qt::ControlModifier | Qt::AltModifier | Qt::ShiftModifier | Qt::Key_S);
 	fileSaveWorkspaceAs->setText (i18n ("Save Workspace As"));
 	fileSaveWorkspaceAs->setWhatsThis(i18n ("Saves the actual document as..."));
 
@@ -538,7 +538,7 @@ void RKWardMainWindow::initActions() {
 
 	interrupt_all_commands = actionCollection ()->addAction ("cancel_all_commands", this, SLOT (slotCancelAllCommands()));
 	interrupt_all_commands->setText (i18n ("Interrupt all commands"));
-	actionCollection ()->setDefaultShortcut (interrupt_all_commands, Qt::ShiftModifier + Qt::Key_Escape);
+	actionCollection ()->setDefaultShortcut (interrupt_all_commands, Qt::ShiftModifier | Qt::Key_Escape);
 	interrupt_all_commands->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionInterrupt));
 	interrupt_all_commands->setEnabled (false);		// enabled from within setRStatus()
 
@@ -634,8 +634,8 @@ void RKWardMainWindow::initActions() {
 			while (!RInterface::instance()->backendIsDead() && !RInterface::instance()->backendIsIdle()) {
 				RK_DEBUG(APP, DL_DEBUG, "Backend not idle while restart requested.");
 				message = i18n("<p>One or more operations are pending.</p><p>If you have recently chosen to save your workspace, and you see this message, <b>your data may not be saved, yet!</b></p><p>How do you want to proceed?</p>");
-				auto res = KMessageBox::warningYesNoCancel(this, message, i18n("R commands still pending"), KGuiItem(i18n("Force restart now")), KGuiItem(i18n("Check again")), KGuiItem(i18n("Cancel restarting")));
-				if (res == KMessageBox::Yes) {
+				auto res = KMessageBox::warningTwoActionsCancel(this, message, i18n("R commands still pending"), KGuiItem(i18n("Force restart now")), KGuiItem(i18n("Check again")), KGuiItem(i18n("Cancel restarting")));
+				if (res == KMessageBox::PrimaryAction) {
 					forced = true;
 					break;
 				} else if (res == KMessageBox::Cancel) {
diff --git a/rkward/scriptbackends/CMakeLists.txt b/rkward/scriptbackends/CMakeLists.txt
index d06195c3f..16edc7002 100644
--- a/rkward/scriptbackends/CMakeLists.txt
+++ b/rkward/scriptbackends/CMakeLists.txt
@@ -15,4 +15,4 @@ SET(scriptbackends_STAT_SRCS
 ADD_LIBRARY(scriptbackends STATIC ${scriptbackends_STAT_SRCS})
 TARGET_LINK_LIBRARIES(scriptbackends Qt6::Qml Qt6::Widgets Qt6::Xml KF6::WidgetsAddons KF6::I18n)
 
-INSTALL(FILES common.js rkcomponentscripting.js DESTINATION ${DATA_INSTALL_DIR}/rkward/phpfiles )
+INSTALL(FILES common.js rkcomponentscripting.js DESTINATION ${KDE_INSTALL_DATADIR}/rkward/phpfiles )
diff --git a/rkward/settings/rksettings.h b/rkward/settings/rksettings.h
index 56bf8cfa8..4f2d19b0d 100644
--- a/rkward/settings/rksettings.h
+++ b/rkward/settings/rksettings.h
@@ -44,8 +44,8 @@ public:
 		NumPages = PageDebug + 1
 	};
 
-	static void configureSettings (SettingsPage page=NoPage, QWidget *parent=0, RCommandChain *chain=0);
-	static void configureSettings (const QString& page, QWidget *parent=0, RCommandChain *chain=0);
+	static void configureSettings (SettingsPage page=NoPage, QWidget *parent=nullptr, RCommandChain *chain=nullptr);
+	static void configureSettings (const QString& page, QWidget *parent=nullptr, RCommandChain *chain=nullptr);
 
 	static void loadSettings (KConfig *config);
 	static void saveSettings (KConfig *config);
@@ -58,7 +58,7 @@ public:
 public Q_SLOTS:
 	void pageChange (KPageWidgetItem *current, KPageWidgetItem *before);
 protected:
-	RKSettings (QWidget *parent = 0);
+	RKSettings (QWidget *parent = nullptr);
 	~RKSettings ();
 
 	void done (int result) override;
@@ -81,7 +81,7 @@ friend class RKWardMainWindow;
 	void registerPageModule(SettingsPage super, int child);
 };
 
-/** This class represents a very simple QObject. It's only purpose is to Q_EMIT signals when certain settings have changed. Classes that need to
+/** This class represents a very simple QObject. It's only purpose is to emit signals when certain settings have changed. Classes that need to
 update themselves on certain changed settings should connect to those signals. */
 class RKSettingsTracker : public QObject {
 	Q_OBJECT
diff --git a/rkward/windows/CMakeLists.txt b/rkward/windows/CMakeLists.txt
index d165c6f13..be6928e1f 100644
--- a/rkward/windows/CMakeLists.txt
+++ b/rkward/windows/CMakeLists.txt
@@ -31,4 +31,4 @@ SET(windows_STAT_SRCS
 )
 
 ADD_LIBRARY(windows STATIC ${windows_STAT_SRCS})
-TARGET_LINK_LIBRARIES(windows Qt6::Widgets Qt6::Xml Qt6::PrintSupport Qt6::WebEngineWidgets KF6::TextEditor KF6::Notifications KF6::WindowSystem KF6::KIOFileWidgets KF6::I18n)
+TARGET_LINK_LIBRARIES(windows Qt6::Widgets Qt6::PrintSupport Qt6::Core5Compat Qt6::WebEngineWidgets KF6::TextEditor KF6::Notifications KF6::WindowSystem KF6::KIOFileWidgets KF6::I18n)
diff --git a/rkward/windows/katepluginintegration.cpp b/rkward/windows/katepluginintegration.cpp
index bfdd458ae..5a2584fd6 100644
--- a/rkward/windows/katepluginintegration.cpp
+++ b/rkward/windows/katepluginintegration.cpp
@@ -15,7 +15,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <QStatusBar>
 
 #include <KPluginFactory>
-#include <KPluginLoader>
 #include <KPluginMetaData>
 #include <KTextEditor/Editor>
 #include <KTextEditor/Application>
@@ -42,17 +41,13 @@ SPDX-License-Identifier: GPL-2.0-or-later
 KatePluginIntegrationApp::KatePluginIntegrationApp(QObject *parent) : QObject (parent) {
 	RK_TRACE (APP);
 
-	dummy_view = 0;
+	dummy_view = nullptr;
 	window = new KatePluginIntegrationWindow(this);
 	app = new KTextEditor::Application(this);
 	KTextEditor::Editor::instance()->setApplication(app);
 
 	// enumerate all available kate plugins
-#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5,89,0)
 	QVector<KPluginMetaData> plugins = KPluginMetaData::findPlugins(QStringLiteral("ktexteditor"));
-#else
-	QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("ktexteditor"), [](const KPluginMetaData &) { return true; });
-#endif
 	for (int i = plugins.size() -1; i >= 0; --i) {
 		PluginInfo info;
 		info.plugin = 0;
@@ -97,43 +92,32 @@ QObject* KatePluginIntegrationApp::loadPlugin (const QString& identifier) {
 
 	if (!known_plugins.contains (identifier)) {
 		RK_DEBUG (APP, DL_WARNING, "Plugin %s is not known", qPrintable (identifier));
-		return 0;
+		return nullptr;
 	}
 
-#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5,86,0)
-	KPluginFactory *factory = KPluginLoader(known_plugins[identifier].data.fileName ()).factory ();
-	if (factory) {
-#endif
-		if (identifier == "katekonsoleplugin") {
-			// Workaround until https://invent.kde.org/utilities/kate/-/commit/cf11bcbf1f36e2a82b1a1b14090a3f0a2b09ecf4 can be assumed to be present (should be removed in KF6)
-			if (qEnvironmentVariableIsEmpty("EDITOR")) qputenv("EDITOR", "vi");
-		}
+	if (identifier == "katekonsoleplugin") {
+		// Workaround until https://invent.kde.org/utilities/kate/-/commit/cf11bcbf1f36e2a82b1a1b14090a3f0a2b09ecf4 can be assumed to be present (should be removed in KF6)
+		if (qEnvironmentVariableIsEmpty("EDITOR")) qputenv("EDITOR", "vi");
+	}
 
-#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5,86,0)
-		KTextEditor::Plugin *plugin = factory->create<KTextEditor::Plugin>(this, QVariantList () << identifier);
-#else
-		KTextEditor::Plugin *plugin = KPluginFactory::instantiatePlugin<KTextEditor::Plugin>(known_plugins[identifier].data, this, QVariantList() << identifier).plugin;
-#endif
-		if (plugin) {
-			known_plugins[identifier].plugin = plugin;
-			Q_EMIT KTextEditor::Editor::instance()->application()->pluginCreated(identifier, plugin);
-			QObject* created = mainWindow()->createPluginView(plugin);
-			if (created) {
-				Q_EMIT mainWindow()->main->pluginViewCreated(identifier, created);
-				KTextEditor::SessionConfigInterface *interface = qobject_cast<KTextEditor::SessionConfigInterface *>(created);
-				if (interface) {
-					// NOTE: Some plugins (noteably the Search in files plugin) will misbehave, unless readSessionConfig has been called!
-					KConfigGroup group = KSharedConfig::openConfig()->group(QStringLiteral("KatePlugin:%1:").arg(identifier));
-					interface->readSessionConfig(group);
-				}
+	KTextEditor::Plugin *plugin = KPluginFactory::instantiatePlugin<KTextEditor::Plugin>(known_plugins[identifier].data, this, QVariantList() << identifier).plugin;
+	if (plugin) {
+		known_plugins[identifier].plugin = plugin;
+		Q_EMIT KTextEditor::Editor::instance()->application()->pluginCreated(identifier, plugin);
+		QObject* created = mainWindow()->createPluginView(plugin);
+		if (created) {
+			Q_EMIT mainWindow()->main->pluginViewCreated(identifier, created);
+			KTextEditor::SessionConfigInterface *interface = qobject_cast<KTextEditor::SessionConfigInterface *>(created);
+			if (interface) {
+				// NOTE: Some plugins (noteably the Search in files plugin) will misbehave, unless readSessionConfig has been called!
+				KConfigGroup group = KSharedConfig::openConfig()->group(QStringLiteral("KatePlugin:%1:").arg(identifier));
+				interface->readSessionConfig(group);
 			}
-			return plugin;
 		}
-#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5,86,0)
+		return plugin;
 	}
-#endif
 
-	return 0;
+	return nullptr;
 }
 
 void KatePluginIntegrationApp::loadPlugins(const QStringList& plugins) {
@@ -190,7 +174,7 @@ void KatePluginIntegrationApp::unloadPlugin(const QString &identifier) {
 	}
 	Q_EMIT app->pluginDeleted(identifier, info.plugin);
 	delete info.plugin;
-	info.plugin = 0;
+	info.plugin = nullptr;
 }
 
 void KatePluginIntegrationApp::saveConfigAndUnload() {
@@ -224,7 +208,7 @@ RKCommandEditorWindow* findWindowForView(KTextEditor::View *view) {
 			return static_cast<RKCommandEditorWindow*>(w[i]);
 		}
 	}
-	return 0;
+	return nullptr;
 }
 
 RKCommandEditorWindow* findWindowForDocument(KTextEditor::Document *document) {
@@ -237,7 +221,7 @@ RKCommandEditorWindow* findWindowForDocument(KTextEditor::Document *document) {
 			return static_cast<RKCommandEditorWindow*>(w[i]);
 		}
 	}
-	return 0;
+	return nullptr;
 }
 
 QList<KTextEditor::Document *> KatePluginIntegrationApp::documents() {
@@ -267,7 +251,7 @@ KTextEditor::Document *KatePluginIntegrationApp::findUrl(const QUrl &url) {
 			if (v) return v->document();
 		}
 	}
-	return 0;
+	return nullptr;
 }
 
 KTextEditor::Document *KatePluginIntegrationApp::openUrl(const QUrl &url, const QString &encoding) {
@@ -275,7 +259,7 @@ KTextEditor::Document *KatePluginIntegrationApp::openUrl(const QUrl &url, const
 
 	KTextEditor::View *v = window->openUrl(url, encoding);
 	if (v) return v->document();
-	return 0;
+	return nullptr;
 }
 
 bool KatePluginIntegrationApp::closeDocument(KTextEditor::Document *document) {
@@ -314,7 +298,7 @@ KTextEditor::Plugin *KatePluginIntegrationApp::plugin(const QString &name) {
 	if (known_plugins.contains(name)) {
 		return known_plugins[name].plugin;
 	}
-	return 0;
+	return nullptr;
 }
 
 ///  END  KTextEditor::Application interface
@@ -505,7 +489,7 @@ KTextEditor::View *KatePluginIntegrationWindow::activateView(KTextEditor::Docume
 		return w->getView();
 	}
 	if (app->dummy_view && document == app->dummy_view->document()) return app->dummy_view;
-	return 0;
+	return nullptr;
 }
 
 KTextEditor::View *KatePluginIntegrationWindow::openUrl(const QUrl &url, const QString &encoding) {
@@ -514,7 +498,7 @@ KTextEditor::View *KatePluginIntegrationWindow::openUrl(const QUrl &url, const Q
 	if (w) return static_cast<RKCommandEditorWindow*>(w)->getView();
 
 	RK_ASSERT(w);  // should not happen
-	return 0;
+	return nullptr;
 }
 
 QObject *KatePluginIntegrationWindow::pluginView(const QString &name) {
diff --git a/rkward/windows/rkcallstackviewer.cpp b/rkward/windows/rkcallstackviewer.cpp
index 1ecfdfa32..24da8f215 100644
--- a/rkward/windows/rkcallstackviewer.cpp
+++ b/rkward/windows/rkcallstackviewer.cpp
@@ -145,7 +145,7 @@ void RKCallstackViewerWidget::frameChanged (int frame_number) {
 		QStringList lines = RKDebugHandler::instance ()->functions ().value (frame_number).split ('\n');
 		QString call = RKDebugHandler::instance ()->calls ().value (frame_number + 1);
 		call = call.left (call.indexOf ('(')).trimmed ();
-		QRegExp call_exp (QRegExp::escape (call) + "\\s*\\(");
+		QRegularExpression call_exp (QRegularExpression::escape (call) + "\\s*\\(");
 		for (int i = lines.size () - 1; i >= 0; --i) {
 			if (lines.at (i).contains (call_exp)) frame_source->highlightLine (i);
 		}
diff --git a/rkward/windows/rkcodecompletion.cpp b/rkward/windows/rkcodecompletion.cpp
index 3639418c2..56bad4e9f 100644
--- a/rkward/windows/rkcodecompletion.cpp
+++ b/rkward/windows/rkcodecompletion.cpp
@@ -16,6 +16,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <QIcon>
 #include <QDir>
 #include <QAction>
+#include <QTimer>
 
 #include "../misc/rkcommonfunctions.h"
 #include "../misc/rkstandardicons.h"
@@ -76,36 +77,30 @@ RKCompletionManager::RKCompletionManager(KTextEditor::View* view, const RKCodeCo
 	update_call = true;
 	cached_position = KTextEditor::Cursor (-1, -1);
 
-	cc_iface = qobject_cast<KTextEditor::CodeCompletionInterface*> (view);
-	if (cc_iface) {
-		cc_iface->setAutomaticInvocationEnabled (false);
-		completion_model = new RKCodeCompletionModel (this);
-		file_completion_model = new RKFileCompletionModel (this);
-		callhint_model = new RKCallHintModel (this);
-		arghint_model = new RKArgumentHintModel (this);
-		cc_iface->registerCompletionModel (new RKCompletionNotifierModel (this));  // (at least) one model needs to be registered, so we will know, when completion was triggered by the user (shortcut)
-		completion_timer = new QTimer (this);
-		completion_timer->setSingleShot (true);
-		connect (completion_timer, &QTimer::timeout, this, &RKCompletionManager::tryCompletion);
-		connect (view->document (), &KTextEditor::Document::textInserted, this, &RKCompletionManager::textInserted);
-		connect (view->document (), &KTextEditor::Document::textRemoved, this, &RKCompletionManager::textRemoved);
-		connect (view->document (), &KTextEditor::Document::lineWrapped, this, &RKCompletionManager::lineWrapped);
-		connect (view->document (), &KTextEditor::Document::lineUnwrapped, this, &RKCompletionManager::lineUnwrapped);
-		connect (view, &KTextEditor::View::cursorPositionChanged, this, &RKCompletionManager::cursorPositionChanged);
-		const QObjectList children = _view->children ();
-		for (QObjectList::const_iterator it = children.constBegin(); it != children.constEnd (); ++it) {
-			(*it)->installEventFilter (this);  // to handle Tab-key; installing on the view, alone, is not enough.
-		}
-
-		// HACK: I just can't see to make the object name completion model play nice with automatic invocation.
-		//       However, there is no official way to invoke all registered models, manually. So we try to hack our way
-		//       to a pointer to the default kate keyword completion model
-		kate_keyword_completion_model = KTextEditor::Editor::instance ()->findChild<KTextEditor::CodeCompletionModel *> ();
-		if (!kate_keyword_completion_model) kate_keyword_completion_model = view->findChild<KTextEditor::CodeCompletionModel *> (QString());
-
-	} else {
-		RK_ASSERT (false);  // Not a katepart?
+	view->setAutomaticInvocationEnabled (false);
+	completion_model = new RKCodeCompletionModel (this);
+	file_completion_model = new RKFileCompletionModel (this);
+	callhint_model = new RKCallHintModel (this);
+	arghint_model = new RKArgumentHintModel (this);
+	view->registerCompletionModel (new RKCompletionNotifierModel (this));  // (at least) one model needs to be registered, so we will know, when completion was triggered by the user (shortcut)
+	completion_timer = new QTimer (this);
+	completion_timer->setSingleShot (true);
+	connect (completion_timer, &QTimer::timeout, this, &RKCompletionManager::tryCompletion);
+	connect (view->document (), &KTextEditor::Document::textInserted, this, &RKCompletionManager::textInserted);
+	connect (view->document (), &KTextEditor::Document::textRemoved, this, &RKCompletionManager::textRemoved);
+	connect (view->document (), &KTextEditor::Document::lineWrapped, this, &RKCompletionManager::lineWrapped);
+	connect (view->document (), &KTextEditor::Document::lineUnwrapped, this, &RKCompletionManager::lineUnwrapped);
+	connect (view, &KTextEditor::View::cursorPositionChanged, this, &RKCompletionManager::cursorPositionChanged);
+	const QObjectList children = _view->children ();
+	for (QObjectList::const_iterator it = children.constBegin(); it != children.constEnd (); ++it) {
+		(*it)->installEventFilter (this);  // to handle Tab-key; installing on the view, alone, is not enough.
 	}
+
+	// HACK: I just can't see to make the object name completion model play nice with automatic invocation.
+	//       However, there is no official way to invoke all registered models, manually. So we try to hack our way
+	//       to a pointer to the default kate keyword completion model
+	kate_keyword_completion_model = KTextEditor::Editor::instance ()->findChild<KTextEditor::CodeCompletionModel *> ();
+	if (!kate_keyword_completion_model) kate_keyword_completion_model = view->findChild<KTextEditor::CodeCompletionModel *> (QString());
 }
 
 RKCompletionManager::~RKCompletionManager () {
@@ -113,7 +108,7 @@ RKCompletionManager::~RKCompletionManager () {
 }
 
 void RKCompletionManager::tryCompletionProxy () {
-	if (cc_iface->isCompletionActive ()) {
+	if (_view->isCompletionActive ()) {
 		// Handle this in the next event cycle, as more than one event may trigger
 		completion_timer->start (0);
 	} else if (settings->autoEnabled ()) {
@@ -139,9 +134,9 @@ void RKCompletionManager::userTriggeredCompletion () {
 
 void RKCompletionManager::tryCompletion () {
 	RK_TRACE (COMMANDEDITOR);
-	if (!cc_iface) {
+	if (!_view) {
 		// NOTE: This should not be possible, because the connections  have not been set up in the constructor, in this case.
-		RK_ASSERT (cc_iface);
+		RK_ASSERT (_view);
 		return;
 	}
 	if (ignore_next_trigger) {
@@ -164,7 +159,7 @@ void RKCompletionManager::tryCompletion () {
 		if (end > cursor_pos) {
 			symbol_range = KTextEditor::Range ();   // Only hint when at the end of a word/symbol: https://mail.kde.org/pipermail/rkward-devel/2015-April/004122.html
 		} else {
-			if (doc->defaultStyleAt (c) == KTextEditor::dsComment) symbol_range = KTextEditor::Range ();	// do not hint while in comments
+			if (doc->defaultStyleAt (c) == KSyntaxHighlighting::Theme::TextStyle::Comment) symbol_range = KTextEditor::Range ();	// do not hint while in comments
 		}
 	}
 
@@ -210,17 +205,17 @@ void RKCompletionManager::tryCompletion () {
 }
 
 bool isCode (KTextEditor::Document* doc, int line, int column) {
-	KTextEditor::DefaultStyle style = doc->defaultStyleAt (KTextEditor::Cursor (line, column));
-	if (style == KTextEditor::dsComment) return false;
-	if (style == KTextEditor::dsString) return false;
-	if (style == KTextEditor::dsChar) return false;
+	KSyntaxHighlighting::Theme::TextStyle style = doc->defaultStyleAt (KTextEditor::Cursor (line, column));
+	if (style == KSyntaxHighlighting::Theme::TextStyle::Comment) return false;
+	if (style == KSyntaxHighlighting::Theme::TextStyle::String) return false;
+	if (style == KSyntaxHighlighting::Theme::TextStyle::Char) return false;
 	return true;
 }
 
 void RKCompletionManager::updateCallHint () {
 	RK_TRACE (COMMANDEDITOR);
 
-	if (cc_iface->isCompletionActive () && !update_call) return;
+	if (_view->isCompletionActive () && !update_call) return;
 	update_call = false;
 
 	int line = cached_position.line () + 1;
@@ -270,7 +265,7 @@ void RKCompletionManager::updateCallHint () {
 	}
 
 	// now identify the symbol and object (if any)
-	RObject *object = 0;
+	RObject *object = nullptr;
 	call_opening = KTextEditor::Cursor (-1, -1);
 	if (potential_symbol_end > 0) {
 		QString effective_symbol = RKCommonFunctions::getCurrentSymbol (full_context, potential_symbol_end);
@@ -289,7 +284,7 @@ void RKCompletionManager::startModel( KTextEditor::CodeCompletionModel *model, b
 	}
 	if (start) {
 		if (!started_models.contains (model)) {
-			cc_iface->startCompletion (range, model);
+			_view->startCompletion (range, model);
 			started_models.append (model);
 		}
 		auto ci = dynamic_cast<KTextEditor::CodeCompletionModelControllerInterface*>(model);
@@ -302,7 +297,7 @@ void RKCompletionManager::startModel( KTextEditor::CodeCompletionModel *model, b
 void RKCompletionManager::updateVisibility () {
 	RK_TRACE (COMMANDEDITOR);
 
-	if (user_triggered || !cc_iface->isCompletionActive()) {
+	if (user_triggered || !_view->isCompletionActive()) {
 		started_models.clear ();
 	}
 
@@ -327,7 +322,7 @@ void RKCompletionManager::modelGainedLateData(RKCompletionModelBase* model) {
 }
 
 void RKCompletionManager::textInserted (KTextEditor::Document*, const KTextEditor::Cursor& position, const QString& text) {
-	if (cc_iface->isCompletionActive ()) {
+	if (_view->isCompletionActive ()) {
 		if (position < call_opening) update_call = true;
 		else if (text.contains (QChar ('(')) || text.contains (QChar (')'))) update_call = true;
 	}
@@ -335,7 +330,7 @@ void RKCompletionManager::textInserted (KTextEditor::Document*, const KTextEdito
 }
 
 void RKCompletionManager::textRemoved (KTextEditor::Document*, const KTextEditor::Range& range, const QString& text) {
-	if (cc_iface->isCompletionActive ()) {
+	if (_view->isCompletionActive ()) {
 		if (range.start () < call_opening) update_call = true;
 		else if (text.contains (QChar ('(')) || text.contains (QChar (')'))) update_call = true;
 	}
@@ -353,7 +348,7 @@ void RKCompletionManager::lineUnwrapped (KTextEditor::Document* , int ) {
 }
 
 void RKCompletionManager::cursorPositionChanged (KTextEditor::View* view, const KTextEditor::Cursor& newPosition) {
-	if (cc_iface->isCompletionActive ()) {
+	if (_view->isCompletionActive ()) {
 		if (newPosition < call_opening) update_call = true;
 		else {
 			QString text = view->document ()->text (KTextEditor::Range (newPosition, cached_position));
@@ -469,7 +464,7 @@ bool RKCompletionManager::eventFilter (QObject*, QEvent* event) {
 		RK_TRACE (COMMANDEDITOR);	// avoid loads of empty traces, putting this here
 		QKeyEvent *k = static_cast<QKeyEvent *> (event);
 
-		if (!cc_iface->isCompletionActive()) {
+		if (!_view->isCompletionActive()) {
 			if (k->type () == QEvent::ShortcutOverride) return true; // retriggered as key event
 			if (settings->tabKeyInvokesCompletion() && k->key() == Qt::Key_Tab && k->modifiers() == Qt::NoModifier) {
 				userTriggeredCompletion();
@@ -482,7 +477,7 @@ bool RKCompletionManager::eventFilter (QObject*, QEvent* event) {
 		if ((k->key() == Qt::Key_Tab) || (k->key() == Qt::Key_Return) || (k->key() == Qt::Key_Enter) || (k->key() == Qt::Key_Backtab) || (k->key() == Qt::Key_Up) || (k->key() == Qt::Key_Down)) {
 			if (onlyCallHintShown()) {
 				completion_timer->start(0);
-				cc_iface->abortCompletion(); // That's a bit lame, but the least hacky way to get the key into the document. completion_timer was started, so
+				_view->abortCompletion(); // That's a bit lame, but the least hacky way to get the key into the document. completion_timer was started, so
 							// the completion window should come back up, without delay
 				return false;
 			}
@@ -494,7 +489,7 @@ bool RKCompletionManager::eventFilter (QObject*, QEvent* event) {
 				return true;
 			}
 			bool callhint_active = started_models.contains(callhint_model);
-			cc_iface->forceCompletion();
+			_view->forceCompletion();
 			started_models.clear();  // forceCompletion(), also aborts. Keep track of that.
 // TODO: If nothing was actually modified, should return press be sent? Configurable?
 			completion_timer->stop();  // do not bring up completion right again, but do restore the call-hint, if applicable
@@ -526,7 +521,7 @@ bool RKCompletionManager::eventFilter (QObject*, QEvent* event) {
 				if (candidate_completions.size() == 1) {
 					// Ouch, how messy. We want to make sure completion stops (except for any call hints), and is not re-triggered by the insertion, itself
 					bool callhint_active = started_models.contains(callhint_model);
-					cc_iface->abortCompletion ();
+					_view->abortCompletion ();
 					started_models.clear ();
 					completion_timer->stop();
 					if (callhint_active) startModel(callhint_model, true, currentCallRange());
@@ -535,7 +530,7 @@ bool RKCompletionManager::eventFilter (QObject*, QEvent* event) {
 				QApplication::beep ();
 			}
 			return true;
-		} else if ((k->key () == Qt::Key_Up || k->key () == Qt::Key_Down) && cc_iface->isCompletionActive ()) {
+		} else if ((k->key () == Qt::Key_Up || k->key () == Qt::Key_Down) && _view->isCompletionActive ()) {
 			bool navigate = (settings->cursorNavigatesCompletions() && k->modifiers() == Qt::NoModifier) || (!settings->cursorNavigatesCompletions() && k->modifiers() == Qt::AltModifier);
 
 			// Make up / down-keys (without alt) navigate in the document (aborting the completion)
@@ -559,7 +554,7 @@ bool RKCompletionManager::eventFilter (QObject*, QEvent* event) {
 				else RK_ASSERT (action);
 				return true;
 			} else {
-				cc_iface->abortCompletion ();
+				_view->abortCompletion ();
 				return false;
 			}
 		}
diff --git a/rkward/windows/rkcodecompletion.h b/rkward/windows/rkcodecompletion.h
index 88f0107d1..95beb8df0 100644
--- a/rkward/windows/rkcodecompletion.h
+++ b/rkward/windows/rkcodecompletion.h
@@ -14,7 +14,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <ktexteditor/view.h>
 
 #include <ktexteditor/codecompletionmodel.h>
-#include <ktexteditor/codecompletioninterface.h>
 #include <ktexteditor/codecompletionmodelcontrollerinterface.h>
 
 class QEvent;
@@ -57,7 +56,6 @@ private:
 /** called whenever it might be appropriate to show a code completion box. The box is not shown immediately, but only after a timeout (if at all) */
 	void tryCompletionProxy ();
 	void updateCallHint ();
-	KTextEditor::CodeCompletionInterface *cc_iface;
 	RKCodeCompletionModel *completion_model;
 	RKFileCompletionModel *file_completion_model;
 	RKCallHintModel *callhint_model;
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 0d3f61a7e..11d561a84 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -9,13 +9,12 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <kxmlguifactory.h>
 
 #include <ktexteditor/editor.h>
-#include <ktexteditor/modificationinterface.h>
-#include <ktexteditor/markinterface.h>
 #include <KTextEditor/Application>
 
-#include <qapplication.h>
-#include <qfile.h>
-#include <qtimer.h>
+#include <QApplication>
+#include <QActionGroup>
+#include <QFile>
+#include <QTimer>
 #include <QHBoxLayout>
 #include <QCloseEvent>
 #include <QFrame>
@@ -170,7 +169,7 @@ RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, const QUrl &_url,
 					m_doc->readSessionConfig (conf);
 				}
 			} else {
-				KMessageBox::messageBox (this, KMessageBox::Error, i18n ("Unable to open \"%1\"", url.toDisplayString ()), i18n ("Could not open command file"));
+				KMessageBox::error(this, i18n ("Unable to open \"%1\"", url.toDisplayString ()), i18n ("Could not open command file"));
 			}
 		}
 	}
@@ -189,9 +188,7 @@ RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, const QUrl &_url,
 	// yes, we want to be notified, if the file has changed on disk.
 	// why, oh why is this not the default?
 	// this needs to be set *before* the view is created!
-	KTextEditor::ModificationInterface* em_iface = qobject_cast<KTextEditor::ModificationInterface*> (m_doc);
-	if (em_iface) em_iface->setModifiedOnDiskWarning (true);
-	else RK_ASSERT (false);
+	m_doc->setModifiedOnDiskWarning (true);
 	m_view = m_doc->createView (this, RKWardMainWindow::getMain ()->katePluginIntegration ()->mainWindow ()->mainWindow());
 	if (visible_to_kateplugins) {
 		Q_EMIT RKWardMainWindow::getMain ()->katePluginIntegration ()->mainWindow ()->mainWindow()->viewCreated (m_view);
@@ -515,9 +512,9 @@ QString RKCommandEditorWindow::fullCaption () {
 
 void RKCommandEditorWindow::closeEvent (QCloseEvent *e) {
 	if (isModified ()) {
-		int status = KMessageBox::warningYesNo (this, i18n ("The document \"%1\" has been modified. Close it anyway?", windowTitle ()), i18n ("File not saved"));
+		int status = KMessageBox::warningTwoActions (this, i18n ("The document \"%1\" has been modified. Close it anyway?", windowTitle ()), i18n ("File not saved"), KStandardGuiItem::close(), KStandardGuiItem::cancel());
 	
-		if (status != KMessageBox::Yes) {
+		if (status != KMessageBox::PrimaryAction) {
 			e->ignore ();
 			return;
 		}
@@ -635,7 +632,7 @@ void RKCommandEditorWindow::doAutoSave () {
 	QTemporaryFile save (QDir::tempPath () + QLatin1String ("/rkward_XXXXXX") + RKSettingsModuleCommandEditor::autosaveSuffix ());
 	RK_ASSERT (save.open ());
 	QTextStream out (&save);
-	out.setCodec ("UTF-8");		// make sure that all characters can be saved, without nagging the user
+	out.setEncoding (QStringConverter::Utf8);		// make sure that all characters can be saved, without nagging the user
 	out << m_doc->text ();
 	save.close ();
 	save.setAutoRemove (false);
@@ -741,22 +738,16 @@ void RKCommandEditorWindow::setText (const QString &text) {
 	bool old_rw = m_doc->isReadWrite ();
 	if (!old_rw) m_doc->setReadWrite (true);
 	m_doc->setText (text);
-	KTextEditor::MarkInterface *markiface = qobject_cast<KTextEditor::MarkInterface*> (m_doc);
-	if (markiface) markiface->clearMarks ();
+	m_doc->clearMarks ();
 	if (!old_rw) m_doc->setReadWrite (false);
 }
 
 void RKCommandEditorWindow::highlightLine (int linenum) {
 	RK_TRACE (COMMANDEDITOR);
 
-	KTextEditor::MarkInterface *markiface = qobject_cast<KTextEditor::MarkInterface*> (m_doc);
-	if (!markiface) {
-		RK_ASSERT (markiface);
-		return;
-	}
 	bool old_rw = m_doc->isReadWrite ();
 	if (!old_rw) m_doc->setReadWrite (true);
-	markiface->addMark (linenum, KTextEditor::MarkInterface::Execution);
+	m_doc->addMark (linenum, KTextEditor::Document::Execution);
 	m_view->setCursorPosition (KTextEditor::Cursor (linenum, 0));
 	if (!old_rw) m_doc->setReadWrite (false);
 }
@@ -897,7 +888,7 @@ void RKCommandEditorWindow::doRenderPreview () {
 
 	RK_ASSERT (preview_input_file->open (QIODevice::WriteOnly));
 	QTextStream out (preview_input_file);
-	out.setCodec ("UTF-8");     // make sure that all characters can be saved, without nagging the user
+	out.setEncoding (QStringConverter::Utf8);     // make sure that all characters can be saved, without nagging the user
 	out << m_doc->text ();
 	preview_input_file->close ();
 
@@ -1047,7 +1038,7 @@ void RKCommandEditorWindow::addBlock (int index, const KTextEditor::Range& range
 	clearUnusedBlocks ();
 	removeBlock (index);
 
-	KTextEditor::MovingRange* srange = doc->newMovingRange (range);
+	KTextEditor::MovingRange* srange = m_doc->newMovingRange (range);
 	srange->setInsertBehaviors (KTextEditor::MovingRange::ExpandRight);
 
 	QString actiontext = i18n ("%1 (Active)", index + 1);
@@ -1169,7 +1160,7 @@ QString RKCommandHighlighter::commandToHTML (const QString &r_command, Highlight
 	QString ret;
 
 	QString opening;
-	KTextEditor::Attribute::Ptr m_defaultAttribute = view->defaultStyleAttribute (KTextEditor::dsNormal);
+	KTextEditor::Attribute::Ptr m_defaultAttribute = view->defaultStyleAttribute (KSyntaxHighlighting::Theme::TextStyle::Normal);
 	if ( !m_defaultAttribute ) {
 		opening = "<pre class=\"%3\">";
 	} else {
@@ -1179,7 +1170,7 @@ QString RKCommandHighlighter::commandToHTML (const QString &r_command, Highlight
 				// Note: copying the default text/background colors is pointless in our case, and leads to subtle inconsistencies.
 	}
 
-	const KTextEditor::Attribute::Ptr noAttrib(0);
+	const KTextEditor::Attribute::Ptr noAttrib(nullptr);
 
 	if (mode == RScript) ret = opening.arg ("code");
 	enum {
diff --git a/rkward/windows/rkfilebrowser.cpp b/rkward/windows/rkfilebrowser.cpp
index a6256183e..f8d4a15d3 100644
--- a/rkward/windows/rkfilebrowser.cpp
+++ b/rkward/windows/rkfilebrowser.cpp
@@ -100,10 +100,10 @@ RKFileBrowserWidget::RKFileBrowserWidget (QWidget *parent) : QWidget (parent) {
 	layout->addWidget (urlbox);
 
 	dir = new KDirOperator (QUrl (), this);
-	dir->setPreviewWidget (0);
+	dir->setPreviewWidget (nullptr);
 	KConfigGroup config = KSharedConfig::openConfig ()->group ("file browser window");
 	dir->readConfig (config);
-	dir->setView (KFile::Tree);
+	dir->setViewMode (KFile::Tree);
 	connect (RKWardMainWindow::getMain (), &RKWardMainWindow::aboutToQuitRKWard, this, &RKFileBrowserWidget::saveConfig);
 	layout->addWidget (dir);
 
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index d22730345..677e036de 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -836,8 +836,8 @@ void RKHTMLWindow::flushOutput () {
 	}
 
 	// TODO: remove legacy code below, eventually
-	int res = KMessageBox::questionYesNo (this, i18n ("Do you really want to clear the output? This will also remove all image files used in the output. It will not be possible to restore it."), i18n ("Flush output?"));
-	if (res==KMessageBox::Yes) {
+	int res = KMessageBox::questionTwoActions (this, i18n ("Do you really want to clear the output? This will also remove all image files used in the output. It will not be possible to restore it."), i18n ("Flush output?"), KStandardGuiItem::clear(), KStandardGuiItem::cancel());
+	if (res==KMessageBox::PrimaryAction) {
 		QFile out_file (current_url.toLocalFile ());
 		RCommand *c = new RCommand ("rk.flush.output (" + RCommand::rQuote (out_file.fileName ()) + ", ask=FALSE)\n", RCommand::App);
 		connect (c->notifier (), &RCommandNotifier::commandFinished, this, &RKHTMLWindow::refresh);
@@ -892,11 +892,12 @@ void RKHTMLWindowPart::initActions () {
 	KCodecAction *encoding = new KCodecAction (QIcon::fromTheme("character-set"), i18n ("Default &Encoding"), this, true);
 	encoding->setWhatsThis(i18n ("Set the encoding to assume in case no explicit encoding has been set in the page or in the HTTP headers."));
 	actionCollection ()->addAction ("view_encoding", encoding);
-#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5,78,0)
-	connect (encoding, static_cast<void (KCodecAction::*)(QTextCodec *)>(&KCodecAction::triggered), window, &RKHTMLWindow::setTextEncoding);
-#else
-	connect (encoding, &KCodecAction::codecTriggered, window, &RKHTMLWindow::setTextEncoding);
-#endif
+	connect (encoding, &KCodecAction::codecNameTriggered, window, [this](const QByteArray &name) {
+		auto encoding = QStringConverter::encodingForName(name.constData());
+		if (encoding) {
+			window->setTextEncoding(encoding.value());
+		}
+	});
 
 	print = actionCollection()->addAction(KStandardAction::Print, "print_html", window, SLOT (slotPrint()));
 	export_page = actionCollection()->addAction("save_html", new QAction(QIcon::fromTheme("file-save"), i18n("Export Page as HTML"), this));
diff --git a/rkward/windows/rkhtmlwindow.h b/rkward/windows/rkhtmlwindow.h
index 4bbf6404c..6c310fd03 100644
--- a/rkward/windows/rkhtmlwindow.h
+++ b/rkward/windows/rkhtmlwindow.h
@@ -89,7 +89,7 @@ public Q_SLOTS:
 	void refresh ();
 	void zoomIn ();
 	void zoomOut ();
-	void setTextEncoding (QTextCodec* encoding);
+	void setTextEncoding (QStringConverter::Encoding encoding);
 	void updateState();
 private Q_SLOTS:
 	void scrollToBottom ();
diff --git a/rkward/windows/rkmdiwindow.cpp b/rkward/windows/rkmdiwindow.cpp
index a8d185f4a..1518b8399 100644
--- a/rkward/windows/rkmdiwindow.cpp
+++ b/rkward/windows/rkmdiwindow.cpp
@@ -220,8 +220,8 @@ bool RKMDIWindow::eventFilter (QObject *watched, QEvent *e) {
 			} else {
 				active = false;
 			}
-			if (layout()->margin () < 1) {
-				layout()->setMargin (1);
+			if (layout()->contentsMargins ().top() < 1) {
+				layout()->setContentsMargins (1, 1, 1, 1);
 			}
 			update ();
 		}
diff --git a/rkward/windows/rkmdiwindow.h b/rkward/windows/rkmdiwindow.h
index cd60cd40a..59c071ebd 100644
--- a/rkward/windows/rkmdiwindow.h
+++ b/rkward/windows/rkmdiwindow.h
@@ -13,7 +13,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <QUrl>
 #include <QTimer>
 
-#include <kparts/part.h>
+#include <KParts/Part>
 
 #include "../settings/rksettings.h"
 
diff --git a/rkward/windows/rktexthints.cpp b/rkward/windows/rktexthints.cpp
index a16b64544..3c4f8205d 100644
--- a/rkward/windows/rktexthints.cpp
+++ b/rkward/windows/rktexthints.cpp
@@ -7,6 +7,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "rktexthints.h"
 
 #include <KLocalizedString>
+#include <KTextEditor/Document>
 
 #include "../misc/rkcommonfunctions.h"
 #include "../core/robjectlist.h"
@@ -16,12 +17,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 RKTextHints::RKTextHints(KTextEditor::View *view, const RKCodeCompletionSettings *settings) : QObject(view), KTextEditor::TextHintProvider(), settings(settings) {
 	RK_TRACE(COMMANDEDITOR);
-	auto iface = qobject_cast<KTextEditor::TextHintInterface*>(view);
-	if (iface) {
-		iface->registerTextHintProvider(this);
-	} else {
-		RK_ASSERT(iface);
-	}
+	view->registerTextHintProvider(this);
 }
 
 RKTextHints::~RKTextHints() {
diff --git a/rkward/windows/rktoolwindowbar.cpp b/rkward/windows/rktoolwindowbar.cpp
index 85160c177..beda6b991 100644
--- a/rkward/windows/rktoolwindowbar.cpp
+++ b/rkward/windows/rktoolwindowbar.cpp
@@ -116,7 +116,6 @@ void RKToolWindowBar::setSplitter (QSplitter *splitter) {
 	splitter->setContentsMargins (0, 0, 0, 0);
 	container->layout ()->setContentsMargins (0, 0, 0, 0);
 	container->layout ()->setSpacing (0);
-	container->layout ()->setMargin (0);
 	container->hide ();
 
 	connect (splitter, &QSplitter::splitterMoved, this, &RKToolWindowBar::splitterMoved);
diff --git a/rkward/windows/rktoplevelwindowgui.cpp b/rkward/windows/rktoplevelwindowgui.cpp
index 32df30964..7678b79fc 100644
--- a/rkward/windows/rktoplevelwindowgui.cpp
+++ b/rkward/windows/rktoplevelwindowgui.cpp
@@ -8,8 +8,9 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "rktoplevelwindowgui.h"
 
 #include <KLocalizedString>
-#include <kmessagebox.h>
+#include <KMessageBox>
 #include <KAboutData>
+#include <KColorSchemeMenu>
 #include <kaboutapplicationdialog.h>
 #include <kactioncollection.h>
 #include <kxmlguifactory.h>
@@ -78,11 +79,11 @@ RKTopLevelWindowGUI::RKTopLevelWindowGUI(KXmlGuiWindow *for_window) : QObject(fo
 	next_action = actionCollection ()->addAction ("next_window", this, SLOT (nextWindow()));
 	next_action->setText (i18n ("Next Window"));
 	next_action->setIcon (QIcon (RKCommonFunctions::getRKWardDataDir () + "icons/window_forward.png"));
-	actionCollection ()->setDefaultShortcut (next_action, Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Tab);
+	actionCollection ()->setDefaultShortcut (next_action, Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Tab);
 
 	QAction* action = actionCollection ()->addAction ("window_activate_docview", this, SLOT(activateDocumentView()));
 	action->setText (i18n ("Activate Document view"));
-	actionCollection ()->setDefaultShortcut (action, Qt::AltModifier + Qt::Key_0);
+	actionCollection ()->setDefaultShortcut (action, Qt::AltModifier | Qt::Key_0);
 
 	action = actionCollection()->addAction("output_show");
 	action->setText(i18n("Show Output"));
@@ -96,11 +97,7 @@ RKTopLevelWindowGUI::RKTopLevelWindowGUI(KXmlGuiWindow *for_window) : QObject(fo
 	KStandardAction::configureToolbars (this, SLOT (configureToolbars()), actionCollection ());
 	// Color scheme action. NOTE: selection is non-permanent for KF5 <= 5.87.0, auto-saved afterwards. Apparently, auto-save cannot be implemented for earlier versions within a few lines of code
 	KColorSchemeManager *manager = new KColorSchemeManager(this);
-#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 67, 0)
-	actionCollection()->addAction(QStringLiteral("colorscheme_menu"), manager->createSchemeSelectionMenu(i18n("Color Scheme"), QString(), this));
-#else
-	actionCollection()->addAction(QStringLiteral("colorscheme_menu"), manager->createSchemeSelectionMenu(this));
-#endif
+	actionCollection()->addAction(QStringLiteral("colorscheme_menu"), KColorSchemeMenu::createMenu(manager, this));
 	// our "status bar" is inlined, and always visible. Action below would only hide and show a useless proxy
 	// KF6 TODO: Still needed at all?
 	QAction *a = for_window->action("options_show_statusbar");
diff --git a/rkward/windows/rkwindowcatcher.cpp b/rkward/windows/rkwindowcatcher.cpp
index 79d991550..1f3916019 100644
--- a/rkward/windows/rkwindowcatcher.cpp
+++ b/rkward/windows/rkwindowcatcher.cpp
@@ -20,6 +20,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <KLocalizedString>
 #include <KWindowSystem>
 #include <KWindowInfo>
+#include <KX11Extras>
 
 #include "../settings/rksettingsmodulegraphics.h"
 #include "../dialogs/rkerrordialog.h"
@@ -78,7 +79,7 @@ void RKWindowCatcher::start (int prev_cur_device) {
 #ifdef Q_OS_WIN
 	windows_before_add = RKWindowCatcherPrivate::toplevelWindows ();
 #else
-	windows_before_add = KWindowSystem::windows ();
+	windows_before_add = KX11Extras::windows ();
 #endif
 }
 
@@ -92,7 +93,7 @@ WId RKWindowCatcher::createdWindow () {
 	}
 #else
 	// A whole lot of windows appear to get created, but it does look like the last one is the one we need.
-	QList<WId> windows_after_add = KWindowSystem::windows ();
+	QList<WId> windows_after_add = KX11Extras::windows ();
 	WId candidate = windows_after_add.value (windows_after_add.size () - 1);
 	if (!windows_before_add.contains (windows_after_add.last ())) {
 		return candidate;
@@ -123,7 +124,7 @@ void RKWindowCatcher::stop (int new_cur_device) {
 #if defined Q_OS_MACOS
 			KMessageBox::information (0, i18n ("You have tried to embed a new R graphics device window in RKWard. However, this is not currently supported in this build of RKWard on Mac OS X. See https://rkward.kde.org/mac for more information."), i18n ("Could not embed R X11 window"), "embed_x11_device_not_supported");
 #else
-			RKErrorDialog::reportableErrorMessage (0, i18n ("You have tried to embed a new R graphics device window in RKWard. However, either no window was created, or RKWard failed to detect the new window. If you think RKWard should have done better, consider reporting this as a bug. Alternatively, you may want to adjust Settings->Configure RKWard->Onscreen Graphics."), QString (), i18n ("Could not embed R X11 window"), "failure_to_detect_x11_device");
+			RKErrorDialog::reportableErrorMessage (nullptr, i18n ("You have tried to embed a new R graphics device window in RKWard. However, either no window was created, or RKWard failed to detect the new window. If you think RKWard should have done better, consider reporting this as a bug. Alternatively, you may want to adjust Settings->Configure RKWard->Onscreen Graphics."), QString (), i18n ("Could not embed R X11 window"), "failure_to_detect_x11_device");
 #endif
 		}
 	}
@@ -376,11 +377,11 @@ void RKCaughtX11Window::commonClose(bool in_destructor) {
 		close_attempted = true;
 	} else {
 		if (in_destructor) return;
-		if (KMessageBox::questionYesNo(this, i18n("<p>The graphics device is being closed, saving the last plot to the plot history. This may take a while, if the R backend is still busy. You can close the graphics device immediately, in case it is stuck. However, the last plot may be missing from the plot history, if you do this.</p>")
+		if (KMessageBox::questionTwoActions(this, i18n("<p>The graphics device is being closed, saving the last plot to the plot history. This may take a while, if the R backend is still busy. You can close the graphics device immediately, in case it is stuck. However, the last plot may be missing from the plot history, if you do this.</p>")
 #if !defined Q_OS_WIN
 		+ i18n("<p>Note: On X11, the embedded window may be expurged, and you will have to close it manually in this case.</p>")
 #endif
-		, status, KGuiItem(i18n("Close immediately")), KGuiItem(i18n("Keep waiting"))) == KMessageBox::Yes) forceClose();
+		, status, KGuiItem(i18n("Close immediately")), KGuiItem(i18n("Keep waiting"))) == KMessageBox::PrimaryAction) forceClose();
 	}
 }
 
diff --git a/rkward/windows/rkworkplace.cpp b/rkward/windows/rkworkplace.cpp
index a259e4271..49bda5f62 100644
--- a/rkward/windows/rkworkplace.cpp
+++ b/rkward/windows/rkworkplace.cpp
@@ -7,13 +7,13 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "rkworkplace.h"
 
-#include <kparts/partmanager.h>
-#include <kmessagebox.h>
+#include <KParts/PartManager>
+#include <KMessageBox>
 #include <KLocalizedString>
-#include <kactioncollection.h>
-#include <krun.h>
+#include <KActionCollection>
 #include <KSharedConfig>
 #include <KMessageWidget>
+#include <KIO/OpenUrlJob>
 
 #include <QFileInfo>
 #include <QCryptographicHash>
@@ -52,17 +52,17 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../debug.h"
 
 // static
-RKWorkplace *RKWorkplace::main_workplace = 0;
+RKWorkplace *RKWorkplace::main_workplace = nullptr;
 
 #include <QLabel> // remove ME
 
 RKWorkplace::RKWorkplace (QWidget *parent) : QWidget (parent) {
 	RK_TRACE (APP);
-	RK_ASSERT (main_workplace == 0);
+	RK_ASSERT (main_workplace == nullptr);
 
 	main_workplace = this;
 	QDesktopServices::setUrlHandler("rkward", this, "openRKWardUrl");
-	_workspace_config = 0;
+	_workspace_config = nullptr;
 	window_placement_override = RKMDIWindow::AnyWindowState;
 
 	// message area
@@ -124,7 +124,7 @@ RKWorkplace::~RKWorkplace () {
 	delete _workspace_config;
 //	closeAll ();	// not needed, as the windows will autodelete themselves using QObject mechanism. Of course, closeAll () should be called *before* quitting.
 	for (int i = 0; i < windows.size (); ++i) {
-		disconnect (windows[i], 0, this, 0);
+		disconnect (windows[i], nullptr, this, nullptr);
 	}
 }
 
@@ -172,7 +172,7 @@ void RKWorkplace::setWorkspaceURL (const QUrl &url, bool keep_config) {
 			_workspace_config = _new_config;
 		} else {
 			delete _workspace_config;
-			_workspace_config = 0;
+			_workspace_config = nullptr;
 		}
 		Q_EMIT workspaceUrlChanged(url);
 	}
@@ -450,11 +450,11 @@ bool RKWorkplace::openAnyUrl (const QUrl &url, const QString &known_mimetype, bo
 		RK_DEBUG (APP, DL_INFO, "Don't know how to handle mimetype %s.", qPrintable (mimetype.name ()));
 	}
 
-	if (KMessageBox::questionYesNo (this, i18n ("The url you are trying to open ('%1') is not a local file or the filetype is not supported by RKWard. Do you want to open the url in the default application?", url.toDisplayString ()), i18n ("Open in default application?")) != KMessageBox::Yes) {
+	if (KMessageBox::questionTwoActions (this, i18n ("The url you are trying to open ('%1') is not a local file or the filetype is not supported by RKWard. Do you want to open the url in the default application?", url.toDisplayString ()), i18n ("Open in default application?"), KStandardGuiItem::open(), KStandardGuiItem::cancel()) != KMessageBox::PrimaryAction) {
 		return false;
 	}
-	KRun *runner = new KRun (url, topLevelWidget());		// according to KRun-documentation, KRun will self-destruct when done.
-	runner->setRunExecutables (false);
+	auto openUrlJob = new KIO::OpenUrlJob(url);
+	openUrlJob->start();
 	return false;
 }
 
@@ -642,7 +642,7 @@ RKEditor *RKWorkplace::editObject (RObject *object) {
 	if (!ed) {
 		unsigned long size = 1;
 		const auto objDims = iobj->getDimensions ();
-		for (int dim, objDims) {
+		for (int dim : objDims) {
 			size *= dim;
 		}
 		if ((RKSettingsModuleGeneral::warnLargeObjectThreshold () != 0) && (size > RKSettingsModuleGeneral::warnLargeObjectThreshold ())) {
diff --git a/rkward/windows/rkworkplaceview.cpp b/rkward/windows/rkworkplaceview.cpp
index 32269793d..0989cd9ea 100644
--- a/rkward/windows/rkworkplaceview.cpp
+++ b/rkward/windows/rkworkplaceview.cpp
@@ -236,24 +236,30 @@ void RKWorkplaceView::initActions (KActionCollection *ac) {
 
 	action_page_left = (QAction *) ac->addAction ("left_window", this, SLOT (pageLeft()));
 	action_page_left->setText (i18n ("Window Left"));
-	ac->setDefaultShortcuts (action_page_left, QList<QKeySequence>() << Qt::ControlModifier + Qt::Key_Less << Qt::ControlModifier + Qt::Key_Comma);
+	ac->setDefaultShortcuts (action_page_left, {
+		Qt::ControlModifier | Qt::Key_Less,
+		Qt::ControlModifier | Qt::Key_Comma
+	});
 
 	action_page_right = (QAction *) ac->addAction ("right_window", this, SLOT (pageRight()));
 	action_page_right->setText (i18n ("Window Right"));
-	ac->setDefaultShortcuts (action_page_right, QList<QKeySequence>() << Qt::ControlModifier + Qt::Key_Greater << Qt::ControlModifier + Qt::Key_Period);
+	ac->setDefaultShortcuts (action_page_right, {
+		Qt::ControlModifier | Qt::Key_Greater,
+		Qt::ControlModifier | Qt::Key_Period
+	});
 
 	// NOTE: Icons, shortcuts, action names for split view actions as in kate
 	action_split_vert = ac->addAction (QStringLiteral ("view_split_vert"));
 	action_split_vert->setIcon (QIcon::fromTheme(QStringLiteral ("view-split-left-right")));
 	action_split_vert->setText (i18n("Split Ve&rtical"));
-	ac->setDefaultShortcut (action_split_vert, Qt::CTRL + Qt::SHIFT + Qt::Key_L);
+	ac->setDefaultShortcut (action_split_vert, Qt::CTRL | Qt::SHIFT | Qt::Key_L);
 	connect (action_split_vert, &QAction::triggered, this, &RKWorkplaceView::splitViewVert);
 	action_split_vert->setWhatsThis (i18n ("Split the currently active view into two views, vertically."));
 
 	action_split_horiz = ac->addAction (QStringLiteral ("view_split_horiz"));
 	action_split_horiz->setIcon (QIcon::fromTheme(QStringLiteral ("view-split-top-bottom")));
 	action_split_horiz->setText (i18n ("Split &Horizontal"));
-	ac->setDefaultShortcut (action_split_horiz, Qt::CTRL + Qt::SHIFT + Qt::Key_T);
+	ac->setDefaultShortcut (action_split_horiz, Qt::CTRL | Qt::SHIFT | Qt::Key_T);
 	connect (action_split_horiz, &QAction::triggered, this, &RKWorkplaceView::splitViewHoriz);
 	action_split_horiz->setWhatsThis (i18n ("Split the currently active view into two views, horizontally."));
 



More information about the rkward-tracker mailing list