summaryrefslogtreecommitdiff
path: root/daemon/daemon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/daemon.cpp')
-rw-r--r--daemon/daemon.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/daemon/daemon.cpp b/daemon/daemon.cpp
index 30341d8..ab61171 100644
--- a/daemon/daemon.cpp
+++ b/daemon/daemon.cpp
@@ -28,8 +28,21 @@
#include "manager.h"
+#include <signal.h>
#include <QCoreApplication>
+void signalhandler(int sig)
+{
+ if (sig == SIGINT) {
+ qDebug() << "quit by SIGINT";
+ qApp->quit();
+ }
+ else if (sig == SIGTERM) {
+ qDebug() << "quit by SIGTERM";
+ qApp->quit();
+ }
+}
+
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
@@ -40,5 +53,9 @@ int main(int argc, char *argv[])
Manager manager(&watch, &dbus, &voice);
+ signal(SIGINT, signalhandler);
+ signal(SIGTERM, signalhandler);
+ QObject::connect(&app, SIGNAL(aboutToQuit()), &watch, SLOT(endPhoneCall()));
+
return app.exec();
}