Expose session signal sending to QML

As QTermWidget's `Session` class already offers support for sending signals to the contained process it makes sense to expose this functionality to it's QML version.

Otherwise one would have to resort to fiddling around with process ids and system calls or further external applications inside QML to send signals to processes launched using the widget.

Adding a `stopShellProgram`  method to `KSession` complementing `startShellProgram` was also considered but exposing `sendSignal` offers a more general interface.
This commit is contained in:
Adrian Kummerlaender
2015-09-04 21:37:54 +02:00
parent 0d755b010f
commit df551b8812
2 changed files with 11 additions and 0 deletions
+9
View File
@@ -131,6 +131,15 @@ void KSession::startShellProgram()
m_session->run();
}
bool KSession::sendSignal(int signal)
{
if ( !m_session->isRunning() ) {
return false;
}
return m_session->sendSignal(signal);
}
int KSession::getShellPID()
{
return m_session->processId();
+2
View File
@@ -118,6 +118,8 @@ public slots:
void startShellProgram();
bool sendSignal(int signal);
// Shell program, default is /bin/bash
void setShellProgram(const QString & progname);