Imported Upstream version 0.6.1
[debian/confclerk.git] / src / app / main.cpp
index d70f890959ce14ac970761130509d77d1108faf9..4721306198f8542316600b312faf557028e1d984 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010 Ixonos Plc.
 /*
  * Copyright (C) 2010 Ixonos Plc.
- * Copyright (C) 2011 Philipp Spitzer, gregor herrmann
+ * Copyright (C) 2011-2014 Philipp Spitzer, gregor herrmann, Stefan Stahl
  *
  * This file is part of ConfClerk.
  *
  *
  * This file is part of ConfClerk.
  *
  * You should have received a copy of the GNU General Public License along with
  * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
  */
  * You should have received a copy of the GNU General Public License along with
  * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
  */
-#include <mainwindow.h>
+#include "mainwindow.h"
 
 
-#include <sqlengine.h>
+#include "sqlengine.h"
 
 #include "eventdialog.h"
 #include "application.h"
 
 
 #include "eventdialog.h"
 #include "application.h"
 
-#ifdef MAEMO
-//#include <alarmdialog.h>
-#include <alarmdbus.h>
-#include <alarmdbusadaptorp.h>
-#endif /* MAEMO */
-
-
 int main(int argc, char *argv[])
 {
     Q_INIT_RESOURCE(icons);
 int main(int argc, char *argv[])
 {
     Q_INIT_RESOURCE(icons);
@@ -44,44 +37,17 @@ int main(int argc, char *argv[])
     QCoreApplication::setOrganizationName("Toastfreeware");
     QCoreApplication::setApplicationName("ConfClerk");
     QCoreApplication::setApplicationVersion(VERSION);
     QCoreApplication::setOrganizationName("Toastfreeware");
     QCoreApplication::setApplicationName("ConfClerk");
     QCoreApplication::setApplicationVersion(VERSION);
-    SqlEngine::initialize(); // creates "SQLITE" DB connection
-
-    QWidget *window;
-
-    window = new MainWindow;
 
 
+    MainWindow window;
 
 
-#ifdef MAEMO
-    // Alarm Dbus
-    CAlarmDBus *alarmDBus = new CAlarmDBus(window);
-    new AlarmDBusAdaptor(alarmDBus);
-    QDBusConnection connection = QDBusConnection::sessionBus();
-
-    if(connection.registerObject("/ConfClerk", alarmDBus) == true)
-    {
-       if( connection.registerService("at.priv.toastfreeware.confclerk") == false)
-       {
-               if(argc>1)
-               {
-                       QDBusInterface *interface = new QDBusInterface("at.priv.toastfreeware.confclerk",
-                                                                      "/ConfClerk",
-                                                                      "at.priv.toastfreeware.confclerk.AlarmInterface",
-                                                                      connection);
-                       interface->call("Alarm",atoi(argv[1]));
-                       return 0;
-               }
-       }
-    }
-
-    if(argc > 1)
-    {
-        EventDialog dialog(atoi(argv[1]),window);
+    // If we were started with the parameters confernceid and eventid, show the corresponding event (alarm)
+    if (argc >= 3) {
+        QString conferenceIdStr = argv[1];
+        QString eventIdStr = argv[2];
+        EventDialog dialog(conferenceIdStr.toInt(), eventIdStr.toInt(), &window);
         dialog.exec();
     }
         dialog.exec();
     }
-#endif
-
-    window->show();
+    window.show();
 
     return a.exec();
 }
 
     return a.exec();
 }