Changed daemon to auto disconnect if network connection was initialized by itself.
[jenirok] / src / daemon / main.cpp
index e069e26..a07d28e 100644 (file)
 #include <QtCore/QCoreApplication>
 #include <QtCore/QTranslator>
 #include <QtCore/QLocale>
 #include <QtCore/QCoreApplication>
 #include <QtCore/QTranslator>
 #include <QtCore/QLocale>
+#include <QtCore/QString>
+#include <QtCore/QList>
+#include <QDebug>
 #include <QtGui/QApplication>
 #include "calllistener.h"
 #include <QtGui/QApplication>
 #include "calllistener.h"
+#include "settings.h"
 
 int main(int argc, char *argv[])
 {
 
 int main(int argc, char *argv[])
 {
+    // If daemon was started on boot, the first parameter is set to "-boot"
+    if(argc >= 2 && QString(argv[1]) == "-boot")
+    {
+        if(Settings::instance()->get("autostart") == "0")
+        {
+            // Autostart is disabled -> exit
+            return 0;
+        }
+    }
+
     QApplication app(argc, argv);
 
     QTranslator translator;
     QApplication app(argc, argv);
 
     QTranslator translator;