acd5e06e66b241a044b06b19af79f2f2529f9616
[toast/confclerk.git] / src / app / main.cpp
1 #include <mainwindow.h>
2
3 #include <QtGui/QApplication>
4 #include <sqlengine.h>
5
6 #include "eventdialog.h"
7
8 #ifdef MAEMO
9 //#include <alarmdialog.h>
10 #include <alarmdbus.h>
11 #include <alarmdbusadaptorp.h>
12 #endif /* MAEMO */
13
14
15 int main(int argc, char *argv[])
16 {
17     Q_INIT_RESOURCE(icons);
18     Q_INIT_RESOURCE(maps);
19     Q_INIT_RESOURCE(db);
20
21     QApplication a(argc, argv);
22     QApplication::setWindowIcon(QIcon(":/icons/fosdem.png"));
23
24     SqlEngine::initialize(); // creates "SQLITE" DB connection
25
26     QWidget *window;
27
28     window = new MainWindow;
29
30
31 #ifdef MAEMO
32     // Alarm Dbus
33     CAlarmDBus *alarmDBus = new CAlarmDBus(window);
34     new AlarmDBusAdaptor(alarmDBus);
35     QDBusConnection connection = QDBusConnection::sessionBus();
36
37     if(connection.registerObject("/Fosdem", alarmDBus) == true)
38     {
39         if( connection.registerService("org.fosdem.schedule") == false)
40         {
41                 if(argc>1)
42                 {
43                         QDBusInterface *interface = new QDBusInterface("org.fosdem.schedule",
44                                                                        "/Fosdem",
45                                                                        "org.fosdem.schedule.AlarmInterface",
46                                                                        connection);
47                         interface->call("Alarm",atoi(argv[1]));
48                         return 0;
49                 }
50         }
51     }
52
53     if(argc > 1)
54     {
55         EventDialog dialog(atoi(argv[1]),window);
56         dialog.exec();
57     }
58 #endif
59
60     window->show();
61
62     return a.exec();
63 }
64