Commit 7e37cbab authored by Tomaz  Canabrava's avatar Tomaz Canabrava Committed by Tomaz Canabrava
Browse files

Offer a choice for the user, to run a snippet, even with errors

parent cfd07464
Pipeline #180033 passed with stage
in 2 minutes and 24 seconds
......@@ -16,6 +16,8 @@
#include <QTabWidget>
#include <QTemporaryFile>
#include <QTimer>
#include <kmessagebox.h>
#include <kstandardguiitem.h>
struct QuickCommandsWidget::Private {
QuickCommandsModel *model = nullptr;
......@@ -176,8 +178,15 @@ void QuickCommandsWidget::invokeCommand(const QModelIndex &idx)
void QuickCommandsWidget::runCommand()
{
if (!ui->warning->toPlainText().isEmpty()) {
QMessageBox::warning(this, QStringLiteral("Shell Errors"), i18n("Please fix all the warnings before trying to execute this script"));
return;
auto choice = KMessageBox::questionYesNo(this,
i18n("There are some errors on the script, do you really want to execute it?"),
i18n("Shell Errors"),
KStandardGuiItem::yes(),
KStandardGuiItem::no(),
QStringLiteral("quick-commands-question"));
if (choice == KMessageBox::ButtonCode::No) {
return;
}
}
const QString command = ui->command->toPlainText();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment