Port away from deprecated KMessageBox::sorry

GIT_SILENT
wilder
Friedrich W. H. Kossebau 4 years ago
parent 05a4d48991
commit 17796fb8f4
  1. 2
      src/KeyBindingEditor.cpp
  2. 4
      src/SaveHistoryTask.cpp
  3. 4
      src/ViewManager.cpp
  4. 6
      src/filterHotSpots/FileFilterHotspot.cpp
  5. 18
      src/plugins/SSHManager/sshmanagerpluginwidget.cpp
  6. 2
      src/profile/ProfileManager.cpp
  7. 6
      src/session/SessionController.cpp

@ -283,7 +283,7 @@ void KeyBindingEditor::accept()
const auto newTranslator = new KeyboardTranslator(*_translator); const auto newTranslator = new KeyboardTranslator(*_translator);
if (newTranslator->description().isEmpty()) { 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; delete newTranslator;
return; return;
} }

@ -77,7 +77,7 @@ void SaveHistoryTask::execute()
if (!url.isValid()) { if (!url.isValid()) {
// UI: Can we make this friendlier? // 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; continue;
} }
@ -158,7 +158,7 @@ void SaveHistoryTask::jobDataRequested(KIO::Job *job, QByteArray &data)
void SaveHistoryTask::jobResult(KJob *job) void SaveHistoryTask::jobResult(KJob *job)
{ {
if (job->error() != 0) { 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; TerminalCharacterDecoder *decoder = _jobSession[job].decoder;

@ -1009,7 +1009,7 @@ void ViewManager::saveLayoutFile()
QFile file(QFileDialog::getSaveFileName(this->widget(), i18n("Save File"), QStringLiteral("~/"), i18n("Konsole View Layout (*.json)"))); QFile file(QFileDialog::getSaveFileName(this->widget(), i18n("Save File"), QStringLiteral("~/"), i18n("Konsole View Layout (*.json)")));
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { 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()); QJsonObject jsonSplit = saveSessionsRecurse(_viewContainer->activeViewSplitter());
@ -1065,7 +1065,7 @@ void ViewManager::loadLayout(QString file)
QFile jsonFile(file); QFile jsonFile(file);
if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text)) { 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()); auto json = QJsonDocument::fromJson(jsonFile.readAll());
if (!json.isEmpty()) { if (!json.isEmpty()) {

@ -156,9 +156,9 @@ void FileFilterHotSpot::openWithEditorFromProfile(const QString &fullCmd, const
connect(job, &KJob::result, this, [this, path, job]() { connect(job, &KJob::result, this, [this, path, job]() {
if (job->error() != 0) { if (job->error() != 0) {
// TODO: use KMessageWidget (like the "terminal is read-only" message) // TODO: use KMessageWidget (like the "terminal is read-only" message)
KMessageBox::sorry(QApplication::activeWindow(), KMessageBox::information(QApplication::activeWindow(),
i18n("Could not open file with the text editor specified in the profile settings;\n" i18n("Could not open file with the text editor specified in the profile settings;\n"
"it will be opened with the system default editor.")); "it will be opened with the system default editor."));
openWithSysDefaultApp(path); openWithSysDefaultApp(path);
} }

@ -462,14 +462,7 @@ void SSHManagerTreeWidget::connectRequested(const QModelIndex &idx)
bool ok = false; bool ok = false;
QString processName = info->name(&ok); QString processName = info->name(&ok);
if (!ok) { if (!ok) {
KMessageBox::messageBox(this, KMessageBox::error(this, i18n("Could not get the process name, assume that we can't request a connection"), i18n("Error issuing SSH Command"));
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"));
return; return;
} }
@ -481,14 +474,7 @@ void SSHManagerTreeWidget::connectRequested(const QModelIndex &idx)
QStringLiteral("ksh"), QStringLiteral("ksh"),
QStringLiteral("zsh")}) QStringLiteral("zsh")})
.contains(processName)) { .contains(processName)) {
KMessageBox::messageBox(this, KMessageBox::error(this, i18n("Can't issue SSH command outside the shell application (eg, bash, zsh, sh)"), i18n("Error issuing SSH Command"));
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"));
return; return;
} }

@ -261,7 +261,7 @@ QString ProfileManager::saveProfile(const Profile::Ptr &profile)
QString newPath = writer.getPath(profile); QString newPath = writer.getPath(profile);
if (!writer.writeProfile(newPath, 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; return newPath;

@ -435,7 +435,7 @@ void SessionController::openUrl(const QUrl &url)
} else { } else {
// TODO Implement handling for other Url types // 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" qCDebug(KonsoleDebug) << "Unable to open bookmark at url" << url << ", I do not know"
<< " how to handle the protocol " << url.scheme(); << " how to handle the protocol " << url.scheme();
@ -2016,7 +2016,7 @@ void SessionController::zmodemDownload()
void SessionController::zmodemUpload() void SessionController::zmodemUpload()
{ {
if (session()->isZModemBusy()) { if (session()->isZModemBusy()) {
KMessageBox::sorry(view(), i18n("<p>The current session already has a ZModem file transfer in progress.</p>")); KMessageBox::information(view(), i18n("<p>The current session already has a ZModem file transfer in progress.</p>"));
return; return;
} }
@ -2025,7 +2025,7 @@ void SessionController::zmodemUpload()
zmodem = QStandardPaths::findExecutable(QStringLiteral("lsz")); zmodem = QStandardPaths::findExecutable(QStringLiteral("lsz"));
} }
if (zmodem.isEmpty()) { if (zmodem.isEmpty()) {
KMessageBox::sorry(view(), KMessageBox::error(view(),
i18n("<p>No suitable ZModem software was found on this system.</p>" i18n("<p>No suitable ZModem software was found on this system.</p>"
"<p>You may wish to install the 'rzsz' or 'lrzsz' package.</p>")); "<p>You may wish to install the 'rzsz' or 'lrzsz' package.</p>"));
return; return;

Loading…
Cancel
Save