+
+ if(lineSep.isEmpty())
+ return;
+
+ QStringList lines = newText.split(lineSep);
+ clear();
+
+ if(lines.count() >= 4) {
+ QString msg = tr("Do you really want to paste %1 lines?").arg(lines.count());
+ msg += "<p>";
+ for(int i = 0; i < 3; i++) {
+ msg += lines[i].left(40);
+ if(lines[i].count() > 40)
+ msg += "...";
+ msg += "<br />";
+ }
+ msg += "...</p>";
+ QMessageBox question(QMessageBox::NoIcon, tr("Paste Protection"), msg, QMessageBox::Yes|QMessageBox::No);
+ question.setDefaultButton(QMessageBox::No);
+#ifdef Q_WS_MAC
+ question.setWindowFlags(question.windowFlags() | Qt::Sheet);
+#endif
+ if(question.exec() == QMessageBox::No)
+ return;
+ }
+
+ foreach(QString line, lines) {
+ if(!line.isEmpty()) {
+ clear();
+ insert(line);
+ emit returnPressed();
+ }
+ }
+// if(newText.contains(lineSep)) {
+// clear();
+// QString line = newText.section(lineSep, 0, 0);
+// QString remainder = newText.section(lineSep, 1);
+// insert(line);
+// emit returnPressed();
+// insert(remainder);
+// }
+}
+
+void InputLine::resetLine() {
+ // every time the InputLine is cleared we also reset history index
+ idx = history.count();
+ clear();
+}
+
+void InputLine::showHistoryEntry() {
+ // if the user changed the history, display the changed line
+ tempHistory.contains(idx) ? setText(tempHistory[idx]) : setText(history[idx]);