/usr/share/qterm/scripts/senddelay.js is in qterm 1:0.5.12-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | QTerm.loadScript("utils.js");
var SendDelay = SendDelay ? SendDelay : new Object;
SendDelay.stringQueue = new Array;
SendDelay.t = new QTimer;
SendDelay.q = new QEventLoop;
SendDelay.text = "";
SendDelay.times = 0;
SendDelay.delay = 0;
SendDelay.send = function(text, times, delay)
{
SendDelay.text = text;
SendDelay.times = times;
SendDelay.delay = delay;
for (var i = 0; i < times; i++) {
this.addSendString(text);
}
this.t.start(delay);
this.t.timeout.connect(this,this.sendOneChar);
QTerm.eventFinished.connect(this,this.q.quit);
this.q.exec();
QTerm.showMessage("QTerm","Send String Finished");
this.t.timeout.disconnect(this,this.sendOneChar);
QTerm.eventFinished.disconnect(this,this.q.quit);
}
SendDelay.addSendString = function(str)
{
this.stringQueue[this.stringQueue.length] = str;
}
SendDelay.sendOneChar = function()
{
var text = this.stringQueue.shift();
QTerm.sendParsedString(text);
if (this.stringQueue.length == 0) {
this.t.stop();
QTerm.eventFinished();
return;
}
}
QTerm.SendDelay = SendDelay;
QTerm.onSendDelay = function()
{
var UIloader = new QUiLoader(this);
var uifile = new QFile(QTerm.findFile("ui/senddelay.ui"));
uifile.open(QIODevice.ReadOnly);
var dialog = UIloader.load(uifile, this);
uifile.close();
dialog.stringLineEdit.text = QTerm.SendDelay.text;
dialog.repeatingSpinBox.value = QTerm.SendDelay.times;
dialog.delaySpinBox.value = QTerm.SendDelay.delay/1000;
if ( dialog.exec() == 0 )
return;
var text = dialog.stringLineEdit.text;
var times = dialog.repeatingSpinBox.value;
var delay = dialog.delaySpinBox.value*1000;
if (text.length != 0 && times != 0) {
QTerm.osdMessage("send \""+text+"\" "+times+" times with "+delay+" ms delay", QTerm.OSDType.Info, 2000);
QTerm.SendDelay.send(text,times,delay);
}
}
if (QTerm.addPopupMenu( "sendDelay", qsTr("Send String With Delay...") ) ) {
QTerm.sendDelay.triggered.connect(QTerm.onSendDelay);
}
|