+/*
+ * Copyright (C) 2010 Ixonos Plc.
+ *
+ * This file is part of fosdem-schedule.
+ *
+ * fosdem-schedule is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * fosdem-schedule is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * fosdem-schedule. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <mainwindow.h>
-#include <QtGui/QApplication>
+#include <sqlengine.h>
+
+#include "eventdialog.h"
+#include "application.h"
+
#ifdef MAEMO
//#include <alarmdialog.h>
-#include "alarmdbus.h"
-#include "alarmdbusadaptorp.h"
+#include <alarmdbus.h>
+#include <alarmdbusadaptorp.h>
#endif /* MAEMO */
-#include <sqlengine.h>
-
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(maps);
Q_INIT_RESOURCE(db);
- QApplication a(argc, argv);
- QApplication::setWindowIcon(QIcon(":/icons/fosdem.png"));
+ Application a(argc, argv);
+ Application::setWindowIcon(QIcon(":/icons/fosdem.png"));
SqlEngine::initialize(); // creates "SQLITE" DB connection
QWidget *window;
-#ifdef MAEMO
- // if the app is run with two cmd-line arguments
- // an alarm dialog is to be displayed
- // Usage: $ ./fosdem eventId alarmId
- // Example: $ ./fosdem 521 13
-// if(argc==3)
-// window = new AlarmDialog(argc,argv);
-// else if(argc==2) // display Event dialog automatically
-// window = new MainWindow(atoi(argv[1])); // eventId = argv[1]
-// else
- window = new MainWindow;
-#else
+
window = new MainWindow;
-#endif /* MAEMO */
- window->show();
+
#ifdef MAEMO
// Alarm Dbus
CAlarmDBus *alarmDBus = new CAlarmDBus(window);
new AlarmDBusAdaptor(alarmDBus);
- //QDBusConnection connection = QDBusConnection::sessionBus();
QDBusConnection connection = QDBusConnection::sessionBus();
if(connection.registerObject("/Fosdem", alarmDBus) == true)
{
if( connection.registerService("org.fosdem.schedule") == false)
{
- qDebug() << "dbus register service failed";
+ if(argc>1)
+ {
+ QDBusInterface *interface = new QDBusInterface("org.fosdem.schedule",
+ "/Fosdem",
+ "org.fosdem.schedule.AlarmInterface",
+ connection);
+ interface->call("Alarm",atoi(argv[1]));
+ return 0;
+ }
}
}
+
+ if(argc > 1)
+ {
+ EventDialog dialog(atoi(argv[1]),window);
+ dialog.exec();
+ }
#endif
+ window->show();
+
return a.exec();
}