Commit 92019daa authored by Kurt Hindenburg's avatar Kurt Hindenburg
Browse files

Add Dialog warning when huge amounts of text is about to be pasted

Currently there is no way to stop an accidently paste into the terminal.
This patch adds a dialog when 8000+ characters are pasted asking if
the user really wants to do this.  At most the user will see this once
as there is a "Don't show again" box.

Previously commit trigger a sysadmin issue.

FEATURE: 162625
REVIEW: 107570
FIXED-IN: 4.11
GUI:
parent 616597bd
......@@ -51,6 +51,7 @@
#include <KIO/NetAccess>
#include <konq_operations.h>
#include <KFileItem>
#include <KMessageBox>
// Konsole
#include "Filter.h"
......@@ -2571,6 +2572,17 @@ void TerminalDisplay::doPaste(QString text, bool appendReturn)
if (appendReturn)
text.append("\r");
if (text.length() > 8000) {
if (KMessageBox::warningContinueCancel(window(),
i18n("Are you sure you want to paste %1 characters?",
text.length()),
i18n("Confirm Paste"),
KStandardGuiItem::cont(),
KStandardGuiItem::cancel(),
"ShowPasteHugeTextWarning") == KMessageBox::Cancel)
return;
}
if (!text.isEmpty()) {
text.replace('\n', '\r');
// perform paste by simulating keypress events
......
Markdown is supported
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