From 7ea306a61a7769042012ec267db64ca3b1a2c3ac Mon Sep 17 00:00:00 2001 From: Edward Jones Date: Fri, 27 Jan 2017 23:00:36 +0000 Subject: [PATCH] Prompt the user before executing a command in a cmd:// URL Fixes #51. (Does not have a "don't ask me anymore" option.) --- src/gui/DatabaseWidget.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 6e3398c2..9b19d161 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -497,7 +497,16 @@ void DatabaseWidget::openUrlForEntry(Entry* entry) if (urlString.startsWith("cmd://")) { if (urlString.length() > 6) { - QProcess::startDetached(urlString.mid(6)); + QMessageBox::StandardButton result; + result = MessageBox::question( + this, tr("Execute command?"), + tr("Do you really want to execute the following command?

%1") + .arg(urlString.left(200).toHtmlEscaped()), + QMessageBox::Yes | QMessageBox::No); + + if (result == QMessageBox::Yes) { + QProcess::startDetached(urlString.mid(6)); + } } } else {