summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJekyll Wu <adaptee@gmail.com>2012-03-24 13:30:42 (GMT)
committerJekyll Wu <adaptee@gmail.com>2012-03-24 19:14:18 (GMT)
commitba204b106577aa0e1c5662272d68b17a9e35cc9b (patch)
treebde2ed31afce4684150ffed94d1658ed9dccb39d
parent7b3340bcceb797ac1dee8be4359bef69a8f19bad (diff)
Add dbus method runCommand(QString) for running command
Although the existing dbus method sendText(QString) can be used to do the same job, it is not very friendly since users have to deal with the problem of how to represent and send the final newline. FEATURE: 283719 REVIEW: 104398 FIXED-IN: 4.9.0
-rw-r--r--src/Session.cpp5
-rw-r--r--src/Session.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/Session.cpp b/src/Session.cpp
index 2913b87..5bf759f 100644
--- a/src/Session.cpp
+++ b/src/Session.cpp
@@ -789,6 +789,11 @@ void Session::sendText(const QString& text) const
_emulation->sendText(text);
}
+void Session::runCommand(const QString& command) const
+{
+ _emulation->sendText( command + "\n");
+}
+
void Session::sendMouseEvent(int buttons, int column, int line, int eventType)
{
_emulation->sendMouseEvent(buttons, column, line, eventType);
diff --git a/src/Session.h b/src/Session.h
index fde006e..36e3a98 100644
--- a/src/Session.h
+++ b/src/Session.h
@@ -459,6 +459,11 @@ public slots:
Q_SCRIPTABLE void sendText(const QString& text) const;
/**
+ * Sends @p command to the current foreground terminal program.
+ */
+ Q_SCRIPTABLE void runCommand(const QString& command) const;
+
+ /**
* Sends a mouse event of type @p eventType emitted by button
* @p buttons on @p column/@p line to the current foreground
* terminal program