[education/rkward] rkward: Set QT_NO_CAST_FROM_ASCII in dialogs folder

Thomas Friedrichsmeier null at kde.org
Fri Apr 25 10:57:36 BST 2025


Git commit 91bf16f305652ed68a41a337e5f4654bb41bd11b by Thomas Friedrichsmeier.
Committed on 25/04/2025 at 09:57.
Pushed by tfry into branch 'master'.

Set QT_NO_CAST_FROM_ASCII in dialogs folder

M  +1    -0    rkward/dialogs/CMakeLists.txt
M  +49   -40   rkward/dialogs/rkerrordialog.cpp
M  +3    -3    rkward/dialogs/rkimportdialog.cpp
M  +57   -52   rkward/dialogs/rkloadlibsdialog.cpp
M  +26   -26   rkward/dialogs/rkrecoverdialog.cpp
M  +5    -5    rkward/dialogs/rksetupwizard.cpp
M  +2    -0    rkward/plugin/rkcomponent.h
M  +1    -1    rkward/plugin/rkcomponentproperties.h
M  +2    -0    rkward/rkward.h

https://invent.kde.org/education/rkward/-/commit/91bf16f305652ed68a41a337e5f4654bb41bd11b

diff --git a/rkward/dialogs/CMakeLists.txt b/rkward/dialogs/CMakeLists.txt
index b7399a38a..538deb668 100644
--- a/rkward/dialogs/CMakeLists.txt
+++ b/rkward/dialogs/CMakeLists.txt
@@ -18,3 +18,4 @@ SET(dialogs_STAT_SRCS
 ADD_DEFINITIONS(-DLIBEXECDIR="${KDE_INSTALL_LIBEXECDIR}")
 ADD_LIBRARY(dialogs STATIC ${dialogs_STAT_SRCS})
 TARGET_LINK_LIBRARIES(dialogs Qt6::Widgets KF6::Parts KF6::ConfigWidgets KF6::TextEditor KF6::I18n KF6::KIOWidgets)
+add_definitions(-DQT_NO_CAST_FROM_ASCII) # TODO remove, here, once enabled on top level
diff --git a/rkward/dialogs/rkerrordialog.cpp b/rkward/dialogs/rkerrordialog.cpp
index 0d6862dd8..dd32bfe6d 100644
--- a/rkward/dialogs/rkerrordialog.cpp
+++ b/rkward/dialogs/rkerrordialog.cpp
@@ -61,27 +61,27 @@ public:
 		connect (this, &QDialog::finished, this, &RKBugzillaReportDialog::deleteLater);
 	}
 
-	void accept () override {
+	void accept() override {
 		// The report template is just too large to pass it via GET, so we use a local proxy page to pass it in a POST request
 		QTemporaryFile proxy;
-		proxy.setFileTemplate (QDir::tempPath () + "/rkwardbugXXXXXX.html"); // Force .html-suffix, as it appears to be required on Windows
-		proxy.setAutoRemove (false);
-		proxy.open ();
-		QTextStream out (&proxy);
+		proxy.setFileTemplate(QDir::tempPath() + u"/rkwardbugXXXXXX.html"_s);  // Force .html-suffix, as it appears to be required on Windows
+		proxy.setAutoRemove(false);
+		proxy.open();
+		QTextStream out(&proxy);
 		out << "<html><head><title>Relaying to " SUBMIT_ADDRESS "</title></head><body onLoad=\"document.getElementById('form').submit();\">\n";
-		out << "<h1>" + i18n ("Forwarding you to the KDE bugtracking system") + "</h1>\n";
-		out << "<p>" + i18n ("You are now being forwarded to the KDE bugtracking system. Should you continue to see this page for more than a few seconds (e.g. if JavaScript is disabled), please click \"Proceed\", below.") + "</p>\n";
+		out << "<h1>" << i18n("Forwarding you to the KDE bugtracking system") << "</h1>\n";
+		out << "<p>" << i18n("You are now being forwarded to the KDE bugtracking system. Should you continue to see this page for more than a few seconds (e.g. if JavaScript is disabled), please click \"Proceed\", below.") << "</p>\n";
 		out << "<form name=\"form\" id=\"form\" action=\"" SUBMIT_ADDRESS "\" method=\"POST\">\n";
 		out << "<input name=\"product\" type=\"hidden\" value=\"rkward\"/>\n";
 		out << "<input name=\"component\" type=\"hidden\" value=\"general\"/>\n";
 		out << "<input name=\"version\" type=\"hidden\" value=\"" RKWARD_VERSION "\"/>\n";
-		out << "<input name=\"comment\" type=\"hidden\" value=\"" << report_template.toHtmlEscaped () << "\"/>\n";
-		out << "<input type=\"submit\" value=\"" << i18n ("Proceed") << "\"/>\n";
+		out << "<input name=\"comment\" type=\"hidden\" value=\"" << report_template.toHtmlEscaped() << "\"/>\n";
+		out << "<input type=\"submit\" value=\"" << i18n("Proceed") << "\"/>\n";
 		out << "</form></body></html>";
-		proxy.close ();
+		proxy.close();
 
-		QDesktopServices::openUrl (QUrl::fromLocalFile (proxy.fileName ()));
-		QDialog::accept ();
+		QDesktopServices::openUrl(QUrl::fromLocalFile(proxy.fileName()));
+		QDialog::accept();
 	}
 private:
 	QString report_template;
@@ -115,46 +115,55 @@ void RKErrorDialog::reportableErrorMessage (QWidget* parent_widget, const QStrin
 	}
 }
 
-void RKErrorDialog::reportBug (QWidget* parent_widget, const QString& message_info) {
-	RK_TRACE (APP);
+void RKErrorDialog::reportBug(QWidget *parent_widget, const QString &message_info) {
+	RK_TRACE(APP);
 
-	if (!parent_widget) parent_widget = RKWardMainWindow::getMain ();
+	if (!parent_widget) parent_widget = RKWardMainWindow::getMain();
 
-	QString report_template = i18n ("---Problem description---\nPlease fill in the missing bits *in English*.\n\n");
-	if (message_info.isEmpty ()) {
-		report_template.append (i18n ("Please give a brief summary on the problem:\n###Please fill in###\n\n"));
+	QString report_template = i18n("---Problem description---\nPlease fill in the missing bits *in English*.\n\n");
+	if (message_info.isEmpty()) {
+		report_template.append(i18n("Please give a brief summary on the problem:\n###Please fill in###\n\n"));
 	} else {
-		report_template.append (i18n ("I encountered the error message quoted below. Additionally, I saw the following symptoms:\n###Please fill in (if applicable)###\n\n"));
+		report_template.append(
+		    i18n("I encountered the error message quoted below. Additionally, I saw the following symptoms:\n###Please fill in (if applicable)###\n\n"));
 	}
-	report_template.append (i18n ("What - in detail - did you do directly before you encountered this problem?\n###Please fill in###\n\n"));
-	report_template.append (i18n ("When you try to repeat the above, does the problem occur again (no, sometimes, always)?\n###Please fill in###\n\n"));
-	report_template.append (i18n ("If applicable: When doing the same thing in an R session outside of RKWard, do you see the same problem?\n###Please fill in###\n\n"));
-	report_template.append (i18n ("Do you have any further information that might help us to track this problem down? In particular, if applicable, can you provide sample data and sample R code to reproduce this problem?\n###Please fill in###\n\n"));
-	report_template.append (i18n ("RKWard is available in many different packagings, and sometimes problems are specific to one method of installation. How did you install RKWard (which file(s) did you download)?\n###Please fill in###\n\n"));
-
-	if (!message_info.isEmpty ()) {
-		report_template.append ("\n---Error Message---\n");
-		report_template.append (message_info);
-		report_template.append ("\n");
+	report_template.append(i18n("What - in detail - did you do directly before you encountered this problem?\n###Please fill in###\n\n"));
+	report_template.append(i18n("When you try to repeat the above, does the problem occur again (no, sometimes, always)?\n###Please fill in###\n\n"));
+	report_template.append(
+	    i18n("If applicable: When doing the same thing in an R session outside of RKWard, do you see the same problem?\n###Please fill in###\n\n"));
+	report_template.append(
+	    i18n("Do you have any further information that might help us to track this problem down? In particular, if applicable, can you provide sample data and "
+	         "sample R code to reproduce this problem?\n###Please fill in###\n\n"));
+	report_template.append(
+	    i18n("RKWard is available in many different packagings, and sometimes problems are specific to one method of installation. How did you install RKWard "
+	         "(which file(s) did you download)?\n###Please fill in###\n\n"));
+
+	if (!message_info.isEmpty()) {
+		report_template.append(u"\n---Error Message---\n"_s); // deliberately no i18n, here
+		report_template.append(message_info);
+		report_template.append(u'\n');
 	}
 
-	report_template.append ("\n---Session Info---\n");
+	report_template.append(u"\n---Session Info---\n"_s);
 	bool ok = false;
-	if (!RInterface::instance()->backendIsDead ()) {
-		RCommand *command = new RCommand (QStringLiteral("rk.sessionInfo()"), RCommand::App);
-		RKProgressControl *control = new RKProgressControl (parent_widget, i18n ("Please stand by while gathering some information on your setup.\nIn case the backend has died or hung up, you may want to press 'Cancel' to skip this step."), i18n ("Gathering setup information"), RKProgressControl::CancellableNoProgress);
-		control->addRCommand (command, true);
+	if (!RInterface::instance()->backendIsDead()) {
+		RCommand *command = new RCommand(u"rk.sessionInfo()"_s, RCommand::App);
+		RKProgressControl *control = new RKProgressControl(parent_widget,
+		                                                   i18n("Please stand by while gathering some information on your setup.\nIn case the backend has died "
+		                                                        "or hung up, you may want to press 'Cancel' to skip this step."),
+		                                                   i18n("Gathering setup information"), RKProgressControl::CancellableNoProgress);
+		control->addRCommand(command, true);
 		RInterface::issueCommand(command);
-		ok = control->doModal (false);
+		ok = control->doModal(false);
 		// NOTE: command is already deleted at this point
-		report_template.append (control->fullCommandOutput ());
+		report_template.append(control->fullCommandOutput());
 		delete control;
 	}
 	if (!ok) {
-		report_template.append (RKSessionVars::frontendSessionInfo ().join (QStringLiteral("\n")));
-		report_template.append ("\n- backend not available or rk.sessionInfo() canceled -\n");
+		report_template.append(RKSessionVars::frontendSessionInfo().join(u"\n"_s));
+		report_template.append(u"\n- backend not available or rk.sessionInfo() canceled -\n"_s);
 	}
 
-	RKBugzillaReportDialog *dialog = new RKBugzillaReportDialog (parent_widget, report_template);
-	dialog->show ();
+	RKBugzillaReportDialog *dialog = new RKBugzillaReportDialog(parent_widget, report_template);
+	dialog->show();
 }
diff --git a/rkward/dialogs/rkimportdialog.cpp b/rkward/dialogs/rkimportdialog.cpp
index c4ad683d1..2054f7946 100644
--- a/rkward/dialogs/rkimportdialog.cpp
+++ b/rkward/dialogs/rkimportdialog.cpp
@@ -42,9 +42,9 @@ RKImportDialog::RKImportDialog(const QString &context_id, QWidget *parent) : KAs
 		QString label = handle->getAttributeLabel(QStringLiteral("format"));
 
 		QString elabel = label;
-		elabel.replace ('(', QLatin1String("["));
-		elabel.replace (')', QLatin1String("]"));
-		filters.append (elabel + " [" + filter + "] (" + filter + ')');
+		elabel.replace(u'(', u"["_s);
+		elabel.replace(u')', u"]"_s);
+		filters.append(elabel + u" ["_s + filter + u"] ("_s + filter + u')');
 	}
 
 	QWidget *page = new QWidget();
diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index a9f718ab1..de8243bd3 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -204,7 +204,7 @@ bool RKLoadLibsDialog::removePackages (QStringList packages, QStringList from_li
 	for (int i = 0; i < packages.count (); ++i) {
 		descriptions.append (i18n ("Package %1 at %2", packages[i], from_liblocs[i]));
 		// NOTE: the "lib"-parameter to remove.packages is NOT matched to the pkgs-parameter. Therefore, we simply concatenate a bunch of single removals.
-		command.append ("remove.packages (" + RObject::rQuote (packages[i]) + ", " + RObject::rQuote (from_liblocs[i]) + ")\n");
+		command.append(u"remove.packages ("_s + RObject::rQuote (packages[i]) + u", "_s + RObject::rQuote (from_liblocs[i]) + u")\n"_s);
 	}
 
 	// last check. This may be an annoying third dialog, in the worst case, but at least it can be turned off.
@@ -219,10 +219,10 @@ bool RKLoadLibsDialog::removePackages (QStringList packages, QStringList from_li
 #ifdef Q_OS_WIN
 extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
 #endif
-bool RKLoadLibsDialog::installPackages (const QStringList &packages, QString to_libloc, bool install_suggested_packages) {
-	RK_TRACE (DIALOGS);
+bool RKLoadLibsDialog::installPackages(const QStringList &packages, QString to_libloc, bool install_suggested_packages) {
+	RK_TRACE(DIALOGS);
 
-	if (packages.isEmpty ()) return false;
+	if (packages.isEmpty()) return false;
 
 	bool as_root = false;
 	// It is ok, if the selected location does not yet exist. In order to know, whether we can write to it, we have to create it first.
@@ -232,23 +232,30 @@ bool RKLoadLibsDialog::installPackages (const QStringList &packages, QString to_
 	extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
 	qt_ntfs_permission_lookup++;
 #endif
-	QFileInfo fi = QFileInfo (to_libloc);
-	bool writable = fi.isWritable ();
+	QFileInfo fi = QFileInfo(to_libloc);
+	bool writable = fi.isWritable();
 #ifdef Q_OS_WIN
 	qt_ntfs_permission_lookup--;
 #endif
 	if (!writable) {
-		QString mcaption = i18n ("Selected library location not writable");
-		QString message = i18n ("<p>The directory you have selected for installation (%1) is not writable with your current user permissions.</p>"
-			"<p>Would you like to install to %2, instead (you can also press \"Cancel\" and use the \"Configure Repositories\"-button to set up a different directory)?</p>", to_libloc, altlibloc);
+		QString mcaption = i18n("Selected library location not writable");
+		QString message = i18n(
+		    "<p>The directory you have selected for installation (%1) is not writable with your current user permissions.</p>"
+		    "<p>Would you like to install to %2, instead (you can also press \"Cancel\" and use the \"Configure Repositories\"-button to set up a different "
+		    "directory)?</p>",
+		    to_libloc, altlibloc);
 #ifdef Q_OS_WIN
-		message.append (i18n ("<p>Alternatively, if you have access to an administrator account on this machine, you can use that to install the package(s), or "
-			"you could change the permissions of '%1'. Sorry, automatic switching to Administrator is not yet supported in RKWard on Windows.</p>", to_libloc));
-		int res = KMessageBox::warningContinueCancel (this, message, mcaption, KGuiItem (i18n ("Install to %1", altlibloc)));
+		message.append(
+		    i18n("<p>Alternatively, if you have access to an administrator account on this machine, you can use that to install the package(s), or "
+		         "you could change the permissions of '%1'. Sorry, automatic switching to Administrator is not yet supported in RKWard on Windows.</p>",
+		         to_libloc));
+		int res = KMessageBox::warningContinueCancel(this, message, mcaption, KGuiItem(i18n("Install to %1", altlibloc)));
 		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::warningTwoActionsCancel (this, message, mcaption, KGuiItem (i18n ("Install to %1", altlibloc)), KGuiItem (i18n ("Become root")));
+		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::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
@@ -257,16 +264,16 @@ bool RKLoadLibsDialog::installPackages (const QStringList &packages, QString to_
 
 	addLibraryLocation(to_libloc);
 
-	QString command_string = "install.packages (c (\"" + packages.join(QStringLiteral("\", \"")) + "\")" + ", lib=" + RObject::rQuote(to_libloc);
-	QString downloaddir = QDir (RKSettingsModuleGeneral::filesPath ()).filePath (QStringLiteral("package_archive"));
-	if (RKSettingsModuleRPackages::archivePackages ()) {
-		QDir (RKSettingsModuleGeneral::filesPath ()).mkdir (QStringLiteral("package_archive"));
-		command_string += ", destdir=" + RObject::rQuote (downloaddir);
+	QString command_string = u"install.packages (c (\""_s + packages.join(u"\", \""_s) + u"\")"_s + u", lib="_s + RObject::rQuote(to_libloc);
+	QString downloaddir = QDir(RKSettingsModuleGeneral::filesPath()).filePath(u"package_archive"_s);
+	if (RKSettingsModuleRPackages::archivePackages()) {
+		QDir(RKSettingsModuleGeneral::filesPath()).mkdir(u"package_archive"_s);
+		command_string += u", destdir="_s + RObject::rQuote(downloaddir);
 	}
-	if (install_suggested_packages) command_string += QLatin1String(", dependencies=TRUE");
-	command_string += QLatin1String(")");
+	if (install_suggested_packages) command_string += u", dependencies=TRUE"_s;
+	command_string += u')';
 
-	runInstallationCommand (command_string, as_root, i18n ("Please stand by while installing selected packages"), i18n ("Installing packages"));
+	runInstallationCommand(command_string, as_root, i18n("Please stand by while installing selected packages"), i18n("Installing packages"));
 
 	return true;
 }
@@ -280,8 +287,8 @@ void RKLoadLibsDialog::runInstallationCommand (const QString& command, bool as_r
 
 	RCommand *rcommand;
 	if (as_root) {
-		QStringList libexecpath(LIBEXECDIR "/kf5");
-		libexecpath << QString(LIBEXECDIR "/kf6");
+		QStringList libexecpath(QStringLiteral(LIBEXECDIR "/kf5"));
+		libexecpath << QString(QStringLiteral(LIBEXECDIR "/kf6"));
 		QString call = QStandardPaths::findExecutable(QStringLiteral("kdesu"));
 		if (call.isEmpty()) call = QStandardPaths::findExecutable(QStringLiteral("kdesu"), libexecpath);
 		if (call.isEmpty ()) call = QStandardPaths::findExecutable(QStringLiteral("kdesudo"));
@@ -294,20 +301,20 @@ void RKLoadLibsDialog::runInstallationCommand (const QString& command, bool as_r
 		QStringList call_with_params(call);
 		call_with_params << QStringLiteral("-t") << QStringLiteral("--") << RKSessionVars::RBinary() << QStringLiteral("--no-save") << QStringLiteral("--no-restore") << QStringLiteral("--file=");
 		KUser user;
-		QString aux_command = QString("local({ "
+		QString aux_command = QStringLiteral("local({ "
 			"install_script <- tempfile(\".R\"); f <- file(install_script, \"w\")\n"
 			"repos <- options()$repos\n"
 			"pkgType <- options()$pkgType\n"
 			"libPaths <- .libPaths()\n"
 			"dump(c(\"repos\", \"pkgType\", \"libPaths\"), f)\n"
 			"cat(\"\\n\", file=f, append=TRUE)\n"
-			"cat(") + RObject::rQuote(QStringLiteral("options(\"repos\"=repos, \"pkgType\"=pkgType)\n")) + QString(", file=f, append=TRUE)\n"
-			"cat(\".libPaths(libPaths)\\n\"") + QString(", file=f, append=TRUE)\n"
-			"cat(") + RObject::rQuote(command + "\n") + QString(", file=f, append=TRUE)\n"
-			"cat(") + RObject::rQuote("system(\"chown " + user.loginName() + ' ' + QDir(RKSettingsModuleGeneral::filesPath()).filePath(QStringLiteral("package_archive")) + "/*\")") + QString(", file=f, append=TRUE)\n"
+			"cat(") + RObject::rQuote(QStringLiteral("options(\"repos\"=repos, \"pkgType\"=pkgType)\n")) + QStringLiteral(", file=f, append=TRUE)\n"
+			"cat(\".libPaths(libPaths)\\n\"") + QStringLiteral(", file=f, append=TRUE)\n"
+			"cat(") + RObject::rQuote(command + u"\n"_s) + QStringLiteral(", file=f, append=TRUE)\n"
+			"cat(") + RObject::rQuote(u"system(\"chown "_s + user.loginName() + u' ' + QDir(RKSettingsModuleGeneral::filesPath()).filePath(QStringLiteral("package_archive")) + u"/*\")"_s) + QStringLiteral(", file=f, append=TRUE)\n"
 			"cat(\"\\n\", file=f, append=TRUE)\n"
 			"close(f)\n"
-			"system(paste0(" + RObject::rQuote(call_with_params.join(' ')) + ", install_script))\n"
+			"system(paste0(") + RObject::rQuote(call_with_params.join(u' ')) + QStringLiteral(", install_script))\n"
 			"unlink(install_script)\n"
 		"})");
 
@@ -493,40 +500,38 @@ void LoadUnloadWidget::updateCurrentList () {
 	}
 }
 
-void LoadUnloadWidget::doLoadUnload () {
-	RK_TRACE (DIALOGS);
+void LoadUnloadWidget::doLoadUnload() {
+	RK_TRACE(DIALOGS);
 
 	RKInlineProgressControl *control = new RKInlineProgressControl(this, false);
 	control->setText(i18n("There has been an error while trying to load / unload packages. See transcript below for details"));
 
 	// load packages previously not loaded
-	for (int i = 0; i < loaded_view->topLevelItemCount (); ++i) {
-		QTreeWidgetItem* loaded = loaded_view->topLevelItem (i);
-		if (!prev_packages.contains (loaded->text (0))) {
-			RCommand *command = new RCommand ("library (\"" + loaded->text (0) + "\")", RCommand::App | RCommand::ObjectListUpdate);
-			control->addRCommand (command);
-			RInterface::issueCommand (command, parent->chain);
+	for (int i = 0; i < loaded_view->topLevelItemCount(); ++i) {
+		QTreeWidgetItem *loaded = loaded_view->topLevelItem(i);
+		if (!prev_packages.contains(loaded->text(0))) {
+			RCommand *command = new RCommand(u"library (\""_s + loaded->text(0) + u"\")"_s, RCommand::App | RCommand::ObjectListUpdate);
+			control->addRCommand(command);
+			RInterface::issueCommand(command, parent->chain);
 		}
 	}
-	
+
 	// detach packages previously attached
 	QStringList packages_to_remove;
-	for (QStringList::Iterator it = prev_packages.begin (); it != prev_packages.end (); ++it) {
-		QList<QTreeWidgetItem*> loaded = loaded_view->findItems ((*it), Qt::MatchExactly, 0);
-		if (loaded.isEmpty ()) {	// no longer in the list
-			packages_to_remove.append ("package:" + *it);
+	for (QStringList::Iterator it = prev_packages.begin(); it != prev_packages.end(); ++it) {
+		QList<QTreeWidgetItem *> loaded = loaded_view->findItems((*it), Qt::MatchExactly, 0);
+		if (loaded.isEmpty()) {  // no longer in the list
+			packages_to_remove.append(u"package:"_s + *it);
 		}
 	}
-	if (!packages_to_remove.isEmpty ()) {
-		QStringList messages = RObjectList::getObjectList ()->detachPackages (packages_to_remove, parent->chain, control);
-		if (!messages.isEmpty ()) KMessageBox::error(this, messages.join(QStringLiteral("\n")));
+	if (!packages_to_remove.isEmpty()) {
+		QStringList messages = RObjectList::getObjectList()->detachPackages(packages_to_remove, parent->chain, control);
+		if (!messages.isEmpty()) KMessageBox::error(this, messages.join(QStringLiteral("\n")));
 	}
 
 	// find out, when we're done
 	RCommand *command = new RCommand(QString(), RCommand::EmptyCommand);
-	connect(command->notifier(), &RCommandNotifier::commandFinished, this, [this](RCommand *) {
-		clearChanged();
-	});
+	connect(command->notifier(), &RCommandNotifier::commandFinished, this, [this](RCommand *) { clearChanged(); });
 	control->addRCommand(command);  // this is actually important, in case no commands had been generated, above
 	RInterface::issueCommand(command, parent->chain);
 	control->setAutoCloseWhenCommandsDone(true);
@@ -559,7 +564,7 @@ public:
 		QStyledItemDelegate::initStyleOption (option, index);
 		if (!index.parent ().isValid ()) {
 			int ccount = index.model ()->rowCount (index);
-			option->text = option->text + " (" + QString::number (ccount) + ')';
+			option->text = option->text + u" ("_s + QString::number(ccount) + u')';
 			if (ccount) {
 				option->icon = table->isExpanded (index) ? expanded : collapsed;
 			} else {
@@ -1048,7 +1053,7 @@ QVariant RKRPackageInstallationStatus::data (const QModelIndex &index, int role)
 			if (role == Qt::DisplayRole) {
 				if (prow == InstalledPackages) return installed_versions.value (irow);
 				else if (prow == NewPackages) return available_versions.value (arow);
-				else return QVariant (installed_versions.value (irow) + " -> " + available_versions.value (arow));
+				else return QVariant(installed_versions.value(irow) + u" -> "_s + available_versions.value(arow));
 			}
 		} else if (col == Location) {
 			if (role == Qt::DisplayRole) {
@@ -1056,7 +1061,7 @@ QVariant RKRPackageInstallationStatus::data (const QModelIndex &index, int role)
 				else if (prow == NewPackages) return available_repos.value (arow);
 				else {
 					RK_ASSERT (prow == UpdateablePackages);
-					return QVariant (installed_libpaths.value (irow) + " -> " + available_repos.value (arow));
+					return QVariant(installed_libpaths.value(irow) + u" -> "_s + available_repos.value(arow));
 				}
 			}
 		}
diff --git a/rkward/dialogs/rkrecoverdialog.cpp b/rkward/dialogs/rkrecoverdialog.cpp
index 5c6fda6a4..d3a938009 100644
--- a/rkward/dialogs/rkrecoverdialog.cpp
+++ b/rkward/dialogs/rkrecoverdialog.cpp
@@ -66,49 +66,49 @@ void RKRecoverDialog::deleteButtonClicked () {
 	reject ();
 }
 
-//static
-QString RKRecoverDialog::saveFileFor (const QString& recovery_file) {
-	RK_TRACE (DIALOGS);
+// static
+QString RKRecoverDialog::saveFileFor(const QString& recovery_file) {
+	RK_TRACE(DIALOGS);
 
-	QFileInfo fi (recovery_file);
-	QDateTime mtime = fi.lastModified ();
-	QDir dir = fi.absoluteDir ();
+	QFileInfo fi(recovery_file);
+	QDateTime mtime = fi.lastModified();
+	QDir dir = fi.absoluteDir();
 	QString new_name;
-	for (int i = 0; i < 100; ++i) {	// If we just had more than 100 crashes per minutes, you'll excuse another small bug, at this point
+	for (int i = 0; i < 100; ++i) {  // If we just had more than 100 crashes per minutes, you'll excuse another small bug, at this point
 		QString num;
-		if (i > 0) num = '_' + QString::number (i+1);
-		new_name = dir.absoluteFilePath ("recovered_workspace_" + mtime.toString (QStringLiteral("yyyy-MM-dd_hh:mm")) + num + ".RData");
+		if (i > 0) num = u'_' + QString::number(i + 1);
+		new_name = dir.absoluteFilePath(u"recovered_workspace_"_s + mtime.toString(u"yyyy-MM-dd_hh:mm"_s) + num + u".RData"_s);
 		if (!QFileInfo::exists(new_name)) break;
 	}
 	return new_name;
 }
 
-//static
-QUrl RKRecoverDialog::checkRecoverCrashedWorkspace () {
-	RK_TRACE (DIALOGS);
+// static
+QUrl RKRecoverDialog::checkRecoverCrashedWorkspace() {
+	RK_TRACE(DIALOGS);
 
-	QDir dir (RKSettingsModuleGeneral::filesPath ());
-	dir.setNameFilters (QStringList ("rkward_recover*.RData"));
-	QStringList matches = dir.entryList (QDir::Files, QDir::Time);
-	for (int i = 0; i < matches.count (); ++i) {
-		matches[i] = dir.absoluteFilePath (matches[i]);
+	QDir dir(RKSettingsModuleGeneral::filesPath());
+	dir.setNameFilters(QStringList(u"rkward_recover*.RData"_s));
+	QStringList matches = dir.entryList(QDir::Files, QDir::Time);
+	for (int i = 0; i < matches.count(); ++i) {
+		matches[i] = dir.absoluteFilePath(matches[i]);
 	}
 
-	if (!matches.isEmpty ()) {
-		RKRecoverDialog dialog (matches);
-		dialog.exec ();
+	if (!matches.isEmpty()) {
+		RKRecoverDialog dialog(matches);
+		dialog.exec();
 
 		// "Save" recovery files, so they want be matched, again
-		matches = dialog.files;	// May have been modified, notably deleted
-		for (int i = matches.count () - 1; i >= 0; --i) {
-			QString new_name = saveFileFor (matches[i]);
-			QFile::rename (matches[i], new_name);
+		matches = dialog.files;  // May have been modified, notably deleted
+		for (int i = matches.count() - 1; i >= 0; --i) {
+			QString new_name = saveFileFor(matches[i]);
+			QFile::rename(matches[i], new_name);
 			matches[i] = new_name;
 		}
 
-		if (dialog.result () == QDialog::Accepted) return (QUrl::fromLocalFile (dir.absoluteFilePath (matches.first ())));
+		if (dialog.result() == QDialog::Accepted) return (QUrl::fromLocalFile(dir.absoluteFilePath(matches.first())));
 	}
 
-	return QUrl ();
+	return QUrl();
 }
 
diff --git a/rkward/dialogs/rksetupwizard.cpp b/rkward/dialogs/rksetupwizard.cpp
index 5a9d20506..a8ca5cb78 100644
--- a/rkward/dialogs/rksetupwizard.cpp
+++ b/rkward/dialogs/rksetupwizard.cpp
@@ -221,7 +221,7 @@ void RKSetupWizardItem::createWidget(QGridLayout *layout, int row) {
 	auto label = new QLabel();
 	label->setPixmap(iconForStatus(status));
 	layout->addWidget(label, row, 0);
-	layout->addWidget(new QLabel(shortlabel + ": " + shortstatuslabel), row, 1);
+	layout->addWidget(new QLabel(shortlabel + u": "_s + shortstatuslabel), row, 1);
 
 	if (options.isEmpty()) {
 		layout->addWidget(new QLabel(i18n("No action needed.")), row, 2);
@@ -353,7 +353,7 @@ RKSetupWizard::RKSetupWizard(QWidget* parent, InvokationReason reason, const QLi
 
 	// TODO: Remove, eventually
 	auto legacy_output = new RKSetupWizardItem(i18n("Pre 0.7.3 output file"));
-	QString legacy_output_path = RKSettingsModuleGeneral::filesPath() + "rk_out.html";
+	QString legacy_output_path = RKSettingsModuleGeneral::filesPath() + u"rk_out.html"_s;
 	if (QFileInfo::exists(legacy_output_path)) {
 		legacy_output->setStatus(RKSetupWizardItem::Warning, i18n("Exists"));
 		legacy_output->setLongLabel(QStringLiteral("<p>An output file from before RKWard version 0.7.3 was found (%1). You will probably want to convert this to the new format. Alternatively, if it is no longer needed, you can delete it, manually.</p>").arg(legacy_output_path));
@@ -456,11 +456,11 @@ RKSetupWizard::RKSetupWizard(QWidget* parent, InvokationReason reason, const QLi
 		if (!software_to_install.isEmpty()) {
 			QString install_info;
 			for (int i = 0; i < software_to_install.size(); ++i) {
-				install_info.append("<ul>* <a href=\"");
+				install_info.append(u"<ul>* <a href=\""_s);
 				install_info.append(software_to_install_urls.value(i));
-				install_info.append("\">");
+				install_info.append(u"\">"_s);
 				install_info.append(software_to_install[i]);
-				install_info.append("</a></ul>");
+				install_info.append(u"</a></ul>"_s);
 			}
 			label_text.append(i18n("<p>The following software is recommended for installation, but automatic installation is not (yet) supported. Click on the links, below, for download information:</p><li>%1</li>", install_info));
 		} else {
diff --git a/rkward/plugin/rkcomponent.h b/rkward/plugin/rkcomponent.h
index 73b50aaa1..4810c85fd 100644
--- a/rkward/plugin/rkcomponent.h
+++ b/rkward/plugin/rkcomponent.h
@@ -15,6 +15,8 @@ SPDX-License-Identifier: GPL-2.0-or-later
 class RKComponentPropertyBase;
 class RKStandardComponent;
 
+using namespace Qt::Literals::StringLiterals;
+
 /** a very low level base for RKComponent and RKComponentProperty. */
 class RKComponentBase {
 public:
diff --git a/rkward/plugin/rkcomponentproperties.h b/rkward/plugin/rkcomponentproperties.h
index 3abc4092a..8c2c8fa2a 100644
--- a/rkward/plugin/rkcomponentproperties.h
+++ b/rkward/plugin/rkcomponentproperties.h
@@ -430,7 +430,7 @@ public:
 	bool isValid () override;
 
 /** string representation of the options in ConvertMode. For use in XMLHelper::getMultiChoiceAttribute */
-	static QString convertModeOptionString () { return ("equals;notequals;range;and;or"); };
+	static QString convertModeOptionString () { return (u"equals;notequals;range;and;or"_s); };
 /** reimplemented to do raise a warning, and do nothing else. */
 	void connectToGovernor (RKComponentPropertyBase *governor, const QString &modifier=QString (), bool reconcile_requirements=true) override;
 /** reimplemented to do raise a warning, and do nothing else. */
diff --git a/rkward/rkward.h b/rkward/rkward.h
index a6bc9b948..2df12b9f6 100644
--- a/rkward/rkward.h
+++ b/rkward/rkward.h
@@ -22,6 +22,8 @@ class QAction;
 class KatePluginIntegrationApp;
 class RKRApiMenu;
 
+using namespace Qt::Literals::StringLiterals;
+
 /**
 The main class of rkward. This is where all strings are tied together, controls the initialization, and there are some of the most important slots for user actions. All real work is done elsewhere.
 */


More information about the rkward-tracker mailing list