6a32ae9e8dfbe385abe3b9c6ddbc3998d8f481eb
[toast/confclerk.git] / src / app / main.cpp
1 /*
2  * Copyright (C) 2010 Ixonos Plc.
3  *
4  * This file is part of fosdem-schedule.
5  *
6  * fosdem-schedule is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation, either version 2 of the License, or (at your option)
9  * any later version.
10  *
11  * fosdem-schedule is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * fosdem-schedule.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 #include <mainwindow.h>
20
21 #include <sqlengine.h>
22
23 #include "eventdialog.h"
24 #include "application.h"
25
26 #ifdef MAEMO
27 //#include <alarmdialog.h>
28 #include <alarmdbus.h>
29 #include <alarmdbusadaptorp.h>
30 #endif /* MAEMO */
31
32
33 int main(int argc, char *argv[])
34 {
35     Q_INIT_RESOURCE(icons);
36     Q_INIT_RESOURCE(maps);
37     Q_INIT_RESOURCE(db);
38
39     Application a(argc, argv);
40     Application::setWindowIcon(QIcon(":/icons/fosdem.png"));
41
42     SqlEngine::initialize(); // creates "SQLITE" DB connection
43
44     QWidget *window;
45
46     window = new MainWindow;
47
48
49 #ifdef MAEMO
50     // Alarm Dbus
51     CAlarmDBus *alarmDBus = new CAlarmDBus(window);
52     new AlarmDBusAdaptor(alarmDBus);
53     QDBusConnection connection = QDBusConnection::sessionBus();
54
55     if(connection.registerObject("/Fosdem", alarmDBus) == true)
56     {
57         if( connection.registerService("org.fosdem.schedule") == false)
58         {
59                 if(argc>1)
60                 {
61                         QDBusInterface *interface = new QDBusInterface("org.fosdem.schedule",
62                                                                        "/Fosdem",
63                                                                        "org.fosdem.schedule.AlarmInterface",
64                                                                        connection);
65                         interface->call("Alarm",atoi(argv[1]));
66                         return 0;
67                 }
68         }
69     }
70
71     if(argc > 1)
72     {
73         EventDialog dialog(atoi(argv[1]),window);
74         dialog.exec();
75     }
76 #endif
77
78     window->show();
79
80     return a.exec();
81 }
82