From 17796fb8f4d94d7b757cc0f077cdc63360771cf2 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Sun, 17 Jul 2022 19:12:16 +0200 Subject: [PATCH] Port away from deprecated KMessageBox::sorry GIT_SILENT --- src/KeyBindingEditor.cpp | 2 +- src/SaveHistoryTask.cpp | 4 ++-- src/ViewManager.cpp | 4 ++-- src/filterHotSpots/FileFilterHotspot.cpp | 6 +++--- .../SSHManager/sshmanagerpluginwidget.cpp | 18 ++---------------- src/profile/ProfileManager.cpp | 2 +- src/session/SessionController.cpp | 6 +++--- 7 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/KeyBindingEditor.cpp b/src/KeyBindingEditor.cpp index a5df10a4..07dc92ac 100644 --- a/src/KeyBindingEditor.cpp +++ b/src/KeyBindingEditor.cpp @@ -283,7 +283,7 @@ void KeyBindingEditor::accept() const auto newTranslator = new KeyboardTranslator(*_translator); if (newTranslator->description().isEmpty()) { - KMessageBox::sorry(this, i18n("A key bindings scheme cannot be saved with an empty description.")); + KMessageBox::error(this, i18n("A key bindings scheme cannot be saved with an empty description.")); delete newTranslator; return; } diff --git a/src/SaveHistoryTask.cpp b/src/SaveHistoryTask.cpp index 5a1489cb..350046b6 100644 --- a/src/SaveHistoryTask.cpp +++ b/src/SaveHistoryTask.cpp @@ -77,7 +77,7 @@ void SaveHistoryTask::execute() if (!url.isValid()) { // UI: Can we make this friendlier? - KMessageBox::sorry(nullptr, i18n("%1 is an invalid URL, the output could not be saved.", url.url())); + KMessageBox::error(nullptr, i18n("%1 is an invalid URL, the output could not be saved.", url.url())); continue; } @@ -158,7 +158,7 @@ void SaveHistoryTask::jobDataRequested(KIO::Job *job, QByteArray &data) void SaveHistoryTask::jobResult(KJob *job) { if (job->error() != 0) { - KMessageBox::sorry(nullptr, i18n("A problem occurred when saving the output.\n%1", job->errorString())); + KMessageBox::error(nullptr, i18n("A problem occurred when saving the output.\n%1", job->errorString())); } TerminalCharacterDecoder *decoder = _jobSession[job].decoder; diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index 6a785190..166032c6 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -1009,7 +1009,7 @@ void ViewManager::saveLayoutFile() QFile file(QFileDialog::getSaveFileName(this->widget(), i18n("Save File"), QStringLiteral("~/"), i18n("Konsole View Layout (*.json)"))); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - KMessageBox::sorry(this->widget(), i18n("A problem occurred when saving the Layout.\n%1", file.fileName())); + KMessageBox::error(this->widget(), i18n("A problem occurred when saving the Layout.\n%1", file.fileName())); } QJsonObject jsonSplit = saveSessionsRecurse(_viewContainer->activeViewSplitter()); @@ -1065,7 +1065,7 @@ void ViewManager::loadLayout(QString file) QFile jsonFile(file); if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - KMessageBox::sorry(this->widget(), i18n("A problem occurred when loading the Layout.\n%1", jsonFile.fileName())); + KMessageBox::error(this->widget(), i18n("A problem occurred when loading the Layout.\n%1", jsonFile.fileName())); } auto json = QJsonDocument::fromJson(jsonFile.readAll()); if (!json.isEmpty()) { diff --git a/src/filterHotSpots/FileFilterHotspot.cpp b/src/filterHotSpots/FileFilterHotspot.cpp index 41c7633f..0ebca795 100644 --- a/src/filterHotSpots/FileFilterHotspot.cpp +++ b/src/filterHotSpots/FileFilterHotspot.cpp @@ -156,9 +156,9 @@ void FileFilterHotSpot::openWithEditorFromProfile(const QString &fullCmd, const connect(job, &KJob::result, this, [this, path, job]() { if (job->error() != 0) { // TODO: use KMessageWidget (like the "terminal is read-only" message) - KMessageBox::sorry(QApplication::activeWindow(), - i18n("Could not open file with the text editor specified in the profile settings;\n" - "it will be opened with the system default editor.")); + KMessageBox::information(QApplication::activeWindow(), + i18n("Could not open file with the text editor specified in the profile settings;\n" + "it will be opened with the system default editor.")); openWithSysDefaultApp(path); } diff --git a/src/plugins/SSHManager/sshmanagerpluginwidget.cpp b/src/plugins/SSHManager/sshmanagerpluginwidget.cpp index 4aa380e5..dacd0994 100644 --- a/src/plugins/SSHManager/sshmanagerpluginwidget.cpp +++ b/src/plugins/SSHManager/sshmanagerpluginwidget.cpp @@ -462,14 +462,7 @@ void SSHManagerTreeWidget::connectRequested(const QModelIndex &idx) bool ok = false; QString processName = info->name(&ok); if (!ok) { - KMessageBox::messageBox(this, - KMessageBox::DialogType::Sorry, - i18n("Could not get the process name, assume that we can't request a connection"), - i18n("Error issuing SSH Command"), - KStandardGuiItem::yes(), - KStandardGuiItem::no(), - KStandardGuiItem::cancel(), - QStringLiteral("error_process_name")); + KMessageBox::error(this, i18n("Could not get the process name, assume that we can't request a connection"), i18n("Error issuing SSH Command")); return; } @@ -481,14 +474,7 @@ void SSHManagerTreeWidget::connectRequested(const QModelIndex &idx) QStringLiteral("ksh"), QStringLiteral("zsh")}) .contains(processName)) { - KMessageBox::messageBox(this, - KMessageBox::DialogType::Sorry, - i18n("Can't issue SSH command outside the shell application (eg, bash, zsh, sh)"), - i18n("Error issuing SSH Command"), - KStandardGuiItem::yes(), - KStandardGuiItem::no(), - KStandardGuiItem::cancel(), - QStringLiteral("error_process_not_shell")); + KMessageBox::error(this, i18n("Can't issue SSH command outside the shell application (eg, bash, zsh, sh)"), i18n("Error issuing SSH Command")); return; } diff --git a/src/profile/ProfileManager.cpp b/src/profile/ProfileManager.cpp index 73748f28..21c19a47 100644 --- a/src/profile/ProfileManager.cpp +++ b/src/profile/ProfileManager.cpp @@ -261,7 +261,7 @@ QString ProfileManager::saveProfile(const Profile::Ptr &profile) QString newPath = writer.getPath(profile); if (!writer.writeProfile(newPath, profile)) { - KMessageBox::sorry(nullptr, i18n("Konsole does not have permission to save this profile to %1", newPath)); + KMessageBox::error(nullptr, i18n("Konsole does not have permission to save this profile to %1", newPath)); } return newPath; diff --git a/src/session/SessionController.cpp b/src/session/SessionController.cpp index 9b3d854f..ad1487a6 100644 --- a/src/session/SessionController.cpp +++ b/src/session/SessionController.cpp @@ -435,7 +435,7 @@ void SessionController::openUrl(const QUrl &url) } else { // TODO Implement handling for other Url types - KMessageBox::sorry(view()->window(), i18n("Konsole does not know how to open the bookmark: ") + url.toDisplayString()); + KMessageBox::error(view()->window(), i18n("Konsole does not know how to open the bookmark: ") + url.toDisplayString()); qCDebug(KonsoleDebug) << "Unable to open bookmark at url" << url << ", I do not know" << " how to handle the protocol " << url.scheme(); @@ -2016,7 +2016,7 @@ void SessionController::zmodemDownload() void SessionController::zmodemUpload() { if (session()->isZModemBusy()) { - KMessageBox::sorry(view(), i18n("

The current session already has a ZModem file transfer in progress.

")); + KMessageBox::information(view(), i18n("

The current session already has a ZModem file transfer in progress.

")); return; } @@ -2025,7 +2025,7 @@ void SessionController::zmodemUpload() zmodem = QStandardPaths::findExecutable(QStringLiteral("lsz")); } if (zmodem.isEmpty()) { - KMessageBox::sorry(view(), + KMessageBox::error(view(), i18n("

No suitable ZModem software was found on this system.

" "

You may wish to install the 'rzsz' or 'lrzsz' package.

")); return;