[education/rkward] rkward: Replace deprecated KMessageBox::sorry with KMessageBox::error

Thomas Friedrichsmeier null at kde.org
Thu Oct 6 09:03:27 BST 2022


Git commit 9603e1bc3b9b7712e362c6e05ce1cfa73a31d815 by Thomas Friedrichsmeier.
Committed on 06/10/2022 at 08:03.
Pushed by tfry into branch 'master'.

Replace deprecated KMessageBox::sorry with KMessageBox::error

M  +1    -1    rkward/agents/rkprintagent.cpp
M  +1    -1    rkward/dataeditor/rkeditordataframe.cpp
M  +3    -3    rkward/dialogs/rkloadlibsdialog.cpp
M  +2    -2    rkward/plugin/rkcomponentmap.cpp
M  +1    -1    rkward/windows/rkdebugconsole.cpp
M  +1    -1    rkward/windows/rkhelpsearchwindow.cpp
M  +1    -1    rkward/windows/rkworkplace.cpp
M  +4    -4    rkward/windows/robjectbrowser.cpp

https://invent.kde.org/education/rkward/commit/9603e1bc3b9b7712e362c6e05ce1cfa73a31d815

diff --git a/rkward/agents/rkprintagent.cpp b/rkward/agents/rkprintagent.cpp
index c941686e..764d595d 100644
--- a/rkward/agents/rkprintagent.cpp
+++ b/rkward/agents/rkprintagent.cpp
@@ -79,7 +79,7 @@ void RKPrintAgent::printPostscript (const QString &file, bool delete_file) {
 
 	if (!provider) {
 		RK_DEBUG (APP, DL_WARNING, "No valid postscript provider was found");
-		KMessageBox::sorry (RKWardMainWindow::getMain (), i18n ("No service was found to provide a KDE print dialog for PostScript files. We will try to open a generic PostScript viewer (if any), instead.<br><br>Consider installing 'okular', or configure RKWard not to attempt to print using a KDE print dialog."), i18n ("Unable to open KDE print dialog"));
+		KMessageBox::error(RKWardMainWindow::getMain(), i18n("No service was found to provide a KDE print dialog for PostScript files. We will try to open a generic PostScript viewer (if any), instead.<br><br>Consider installing 'okular', or configure RKWard not to attempt to print using a KDE print dialog."), i18n("Unable to open KDE print dialog"));
 		// fallback: If we can't find a proper part, try to invoke a standalone PS reader, instead
 #if KIO_VERSION < QT_VERSION_CHECK(5, 77, 0)
 		KRun::runUrl (QUrl::fromLocalFile(file), "application/postscript", RKWardMainWindow::getMain(), KRun::RunFlags());
diff --git a/rkward/dataeditor/rkeditordataframe.cpp b/rkward/dataeditor/rkeditordataframe.cpp
index ff03e059..45a5c4d6 100644
--- a/rkward/dataeditor/rkeditordataframe.cpp
+++ b/rkward/dataeditor/rkeditordataframe.cpp
@@ -48,7 +48,7 @@ RKEditorDataFrame::RKEditorDataFrame (const QString& new_object_name, QWidget* p
 	commonInit ();
 
 	QString valid = RObjectList::getGlobalEnv ()->validizeName (new_object_name);
-	if (valid != new_object_name) KMessageBox::sorry (this, i18n ("The name you specified was already in use or not valid. Renamed to %1", valid), i18n ("Invalid Name"));
+	if (valid != new_object_name) KMessageBox::error(this, i18n("The name you specified was already in use or not valid. Renamed to %1", valid), i18n("Invalid Name"));
 
 	RKVarEditDataFrameModel* model = new RKVarEditDataFrameModel (valid, RObjectList::getGlobalEnv (), open_chain, 5, this);
 
diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index f60e5449..24bc131a 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -289,7 +289,7 @@ void RKLoadLibsDialog::runInstallationCommand (const QString& command, bool as_r
 		if (call.isEmpty ()) call = QStandardPaths::findExecutable("kdesudo");
 		if (call.isEmpty ()) call = QStandardPaths::findExecutable("kdesudo", libexecpath);
 		if (call.isEmpty()) {
-			KMessageBox::sorry(this, i18n("Neither kdesu nor kdesudo could be found. To install as root, please install one of these packages."), i18n("kdesu not found"));
+			KMessageBox::error(this, i18n("Neither kdesu nor kdesudo could be found. To install as root, please install one of these packages."), i18n("kdesu not found"));
 			return;
 		}
 
@@ -522,7 +522,7 @@ void LoadUnloadWidget::doLoadUnload () {
 	}
 	if (!packages_to_remove.isEmpty ()) {
 		QStringList messages = RObjectList::getObjectList ()->detachPackages (packages_to_remove, parent->chain, control);
-		if (!messages.isEmpty ()) KMessageBox::sorry (this, messages.join ("\n"));
+		if (!messages.isEmpty ()) KMessageBox::error(this, messages.join("\n"));
 	}
 
 	// find out, when we're done
@@ -768,7 +768,7 @@ void InstallPackagesWidget::trySelectPackages (const QStringList &package_names)
 			}
 		}
 		if (!failed_names.isEmpty()) {
-			KMessageBox::sorry (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(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"));
 		}
 	}, parent->chain);
 }
diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp
index b88d8f4a..fc177079 100644
--- a/rkward/plugin/rkcomponentmap.cpp
+++ b/rkward/plugin/rkcomponentmap.cpp
@@ -462,7 +462,7 @@ bool RKComponentMap::invokeComponent (const QString &component_id, const QString
 	if (!handle) {
 		_message = i18n ("You tried to invoke a plugin called '%1', but that plugin is currently unknown. Probably you need to load the corresponding PluginMap (Settings->Configure RKWard->Plugins), or perhaps the plugin was renamed.", component_id);
 		if (message) *message = _message;
-		else KMessageBox::sorry (RKWardMainWindow::getMain (), _message, i18n ("No such plugin"));
+		else KMessageBox::error(RKWardMainWindow::getMain(), _message, i18n("No such plugin"));
 		return false;
 	}
 
@@ -523,7 +523,7 @@ bool RKComponentMap::invokeComponent (const QString &component_id, const QString
 
 		_message.append (i18n ("\nThe plugin could not be auto-submitted with these settings."));
 		if (message) *message = _message;
-		else KMessageBox::sorry (RKWardMainWindow::getMain (), _message, i18n ("Could not submit"));
+		else KMessageBox::error(RKWardMainWindow::getMain(), _message, i18n("Could not submit"));
 
 		return (submit_mode != AutoSubmitOrFail);
 	}
diff --git a/rkward/windows/rkdebugconsole.cpp b/rkward/windows/rkdebugconsole.cpp
index f5ffedb4..fa2b1521 100644
--- a/rkward/windows/rkdebugconsole.cpp
+++ b/rkward/windows/rkdebugconsole.cpp
@@ -134,7 +134,7 @@ bool RKDebugConsole::close (CloseWindowMode ask_save) {
 	RK_TRACE (APP);
 
 	if (RKDebugHandler::instance ()->state () != RKDebugHandler::NotInDebugger) {
-		KMessageBox::sorry (this, i18n ("This window cannot be closed, while a debugger is active. If you have no idea what this means, and you want to get out, press the 'Cancel' button on the right hand side of this window."));
+		KMessageBox::error(this, i18n("This window cannot be closed, while a debugger is active. If you have no idea what this means, and you want to get out, press the 'Cancel' button on the right hand side of this window."));
 		return false;
 	}
 	return RKMDIWindow::close (ask_save);
diff --git a/rkward/windows/rkhelpsearchwindow.cpp b/rkward/windows/rkhelpsearchwindow.cpp
index 8e105def..d36f58af 100644
--- a/rkward/windows/rkhelpsearchwindow.cpp
+++ b/rkward/windows/rkhelpsearchwindow.cpp
@@ -157,7 +157,7 @@ void RKHelpSearchWindow::getFunctionHelp (const QString &function_name, const QS
 	auto c = new RCommand(command, RCommand::App | RCommand::GetStringVector, i18n("Find HTML help for %1", function_name));
 	c->whenFinished(this, [this](RCommand* command) {
 		if (command->failed ()) {
-			KMessageBox::sorry (this, i18n ("No help found on '%1'. Maybe the corresponding package is not installed/loaded, or maybe you mistyped the command. Try using Help->Search R Help for more options.", command->command ().section ('\"', 1, 1)), i18n ("No help found"));
+			KMessageBox::error(this, i18n("No help found on '%1'. Maybe the corresponding package is not installed/loaded, or maybe you mistyped the command. Try using Help->Search R Help for more options.", command->command().section('\"', 1, 1)), i18n("No help found"));
 		}
 	});
 	RInterface::issueCommand(c);
diff --git a/rkward/windows/rkworkplace.cpp b/rkward/windows/rkworkplace.cpp
index 260c00fd..518e31ec 100644
--- a/rkward/windows/rkworkplace.cpp
+++ b/rkward/windows/rkworkplace.cpp
@@ -536,7 +536,7 @@ RKMDIWindow* RKWorkplace::openOutputWindow(const QUrl &url, bool create) {
 
 	RKOutputDirectoryCallResult res = RKOutputDirectory::get(url.toLocalFile(), create);
 	if (res.failed()) {
-		KMessageBox::sorry(this, i18n("Failed to open output file. Error message was '%1'", res.error));
+		KMessageBox::error(this, i18n("Failed to open output file. Error message was '%1'", res.error));
 		return nullptr;
 	}
 	RK_ASSERT(res.dir());
diff --git a/rkward/windows/robjectbrowser.cpp b/rkward/windows/robjectbrowser.cpp
index 94bdff34..87305f40 100644
--- a/rkward/windows/robjectbrowser.cpp
+++ b/rkward/windows/robjectbrowser.cpp
@@ -186,7 +186,7 @@ void RObjectBrowserInternal::popupCopy () {
 
 	if (ok) {
 		QString valid = RObjectList::getGlobalEnv ()->validizeName (name);
-		if (valid != name) KMessageBox::sorry (this, i18n ("The name you specified was already in use or not valid. Renamed to %1", valid), i18n ("Invalid Name"));
+		if (valid != name) KMessageBox::error(this, i18n("The name you specified was already in use or not valid. Renamed to %1", valid), i18n("Invalid Name"));
 		RInterface::issueCommand (RObject::rQuote (valid) + " <- " + object->getFullName (), RCommand::App | RCommand::ObjectListUpdate);
 	}
 }
@@ -198,7 +198,7 @@ void RObjectBrowserInternal::popupCopyToGlobalEnv () {
 	QString name = object->getShortName ();
 
 	QString valid = RObjectList::getGlobalEnv ()->validizeName (name);
-	if (valid != name) KMessageBox::sorry (this, i18n ("An object named '%1' already exists in the GlobalEnv. Created the copy as '%2' instead.", name, valid), i18n ("Name already in use"));
+	if (valid != name) KMessageBox::error(this, i18n("An object named '%1' already exists in the GlobalEnv. Created the copy as '%2' instead.", name, valid), i18n("Name already in use"));
 	RInterface::issueCommand (RObject::rQuote (valid) + " <- " + object->getFullName (), RCommand::App | RCommand::ObjectListUpdate);
 }
 
@@ -222,7 +222,7 @@ void RObjectBrowserInternal::popupUnload () {
 
 	QStringList messages = RObjectList::getObjectList ()->detachPackages (QStringList (object->getShortName ()));
 
-	if (!messages.isEmpty ()) KMessageBox::sorry (this, messages.join ("\n"));
+	if (!messages.isEmpty()) KMessageBox::error(this, messages.join("\n"));
 }
 
 void RObjectBrowserInternal::popupRename () {
@@ -232,7 +232,7 @@ void RObjectBrowserInternal::popupRename () {
 	
 	if (ok) {
 		QString valid = static_cast<RContainerObject*> (list_view->menuObject ()->parentObject ())->validizeName (name);
-		if (valid != name) KMessageBox::sorry (this, i18n ("The name you specified was already in use or not valid. Renamed to %1", valid), i18n ("Invalid Name"));
+		if (valid != name) KMessageBox::error(this, i18n("The name you specified was already in use or not valid. Renamed to %1", valid), i18n("Invalid Name"));
 		RKModificationTracker::instance()->renameObject (list_view->menuObject (), valid);
 	}
 }


More information about the rkward-tracker mailing list