Changeset a7d8638


Ignore:
Timestamp:
02/01/10 16:43:00 (12 years ago)
Author:
hanzes <hanzes@…>
Branches:
master, qt5
Children:
ba48d2f
Parents:
d7986a6
Message:

Alarm dbus connection added

Location:
src
Files:
7 edited
4 moved

Legend:

Unmodified
Added
Removed
  • src/alarm/alarm.cpp

    rd7986a6 ra7d8638  
    55#include <QApplication>
    66#include <QDir>
    7 #include <QDebug>
     7#include <QFileInfo>
    88
    99#include <dbus-1.0/dbus/dbus-protocol.h>
     
    3030    alarm_action_set_label(act, "FOSDEM'10");
    3131
    32     // setup this action to be a "DBus command"
     32    QFileInfo fi(*qApp->argv());
     33    QString name(fi.fileName());
     34
     35    QString command = QDir::currentPath() + "/" + name + QString(" %1").arg(QString::number(aEventId));
     36    //QString command =  *qApp->argv() + QString(" %1").arg(QString::number(aEventId));
     37    alarm_action_set_exec_command(act, command.toLocal8Bit().data());
     38    act->flags |= ALARM_ACTION_TYPE_EXEC;
    3339    act->flags |= ALARM_ACTION_WHEN_RESPONDED;
    34     act->flags |= ALARM_ACTION_TYPE_DBUS;
     40    act->flags |= ALARM_ACTION_EXEC_ADD_COOKIE; // adds assigned cookie at the end of command string
    3541
    36     // DBus params for this action
    37     alarm_action_set_dbus_interface(act, "org.fosdem.schedule.AlarmInterface");
    38     alarm_action_set_dbus_service(act, "org.fosdem.schedule");
    39     alarm_action_set_dbus_path(act, "/Fosdem");
    40     alarm_action_set_dbus_name(act, "Alarm");
    41 
    42     // DBus arguments for the action
    43     alarm_action_set_dbus_args(act,  DBUS_TYPE_INT32, &aEventId, DBUS_TYPE_INVALID);
     42//    // setup this action to be a "DBus command"
     43//    act->flags |= ALARM_ACTION_WHEN_RESPONDED;
     44//    act->flags |= ALARM_ACTION_TYPE_DBUS;
     45//
     46//    // DBus params for this action
     47//    alarm_action_set_dbus_interface(act, "org.fosdem.schedule.AlarmInterface");
     48//    alarm_action_set_dbus_service(act, "org.fosdem.schedule");
     49//    alarm_action_set_dbus_path(act, "/Fosdem");
     50//    alarm_action_set_dbus_name(act, "Alarm");
     51//
     52//    // DBus arguments for the action
     53//    alarm_action_set_dbus_args(act,  DBUS_TYPE_INT32, &aEventId, DBUS_TYPE_INVALID);
    4454
    4555    //    act->flags |= ALARM_ACTION_TYPE_EXEC;
  • src/alarm/alarm.pro

    rd7986a6 ra7d8638  
    1010
    1111HEADERS += alarm.h \
    12                    alarmdbus.h \
    13                    alarmdbusadaptorp.h
    1412
    1513SOURCES += alarm.cpp \
    16                    alarmdbus.cpp \
    17                    alarmdbusadaptor.cpp
    1814
    1915INCLUDEPATH += ../gui \
  • src/app/app.pro

    rd7986a6 ra7d8638  
    33TARGET = fosdem-schedule
    44DESTDIR = ../bin
    5 QT += sql xml network dbus
     5QT += sql xml network dbus 
    66
    77# module dependencies
     
    1717}
    1818
    19 HEADERS += appsettings.h
     19HEADERS += appsettings.h \
     20    alarmdbus.h \
     21        alarmdbusadaptorp.h
    2022
    2123SOURCES += main.cpp \
    22            appsettings.cpp
     24           appsettings.cpp \
     25    alarmdbus.cpp \
     26        alarmdbusadaptor.cpp
    2327
    2428RESOURCES += ../icons.qrc \
  • src/app/main.cpp

    rd7986a6 ra7d8638  
    22
    33#include <QtGui/QApplication>
     4#include <sqlengine.h>
     5
     6#include "eventdialog.h"
     7
    48#ifdef MAEMO
    59//#include <alarmdialog.h>
     
    711#include <alarmdbusadaptorp.h>
    812#endif /* MAEMO */
    9 
    10 #include <sqlengine.h>
    1113
    1214
     
    2325
    2426    QWidget *window;
    25 #ifdef MAEMO
    26     // if the app is run with two cmd-line arguments
    27     // an alarm dialog is to be displayed
    28     // Usage: $ ./fosdem eventId alarmId
    29     // Example: $ ./fosdem 521 13
    30 //    if(argc==3)
    31 //        window = new AlarmDialog(argc,argv);
    32 //    else if(argc==2) // display Event dialog automatically
    33 //        window = new MainWindow(atoi(argv[1])); // eventId = argv[1]
    34 //    else
    35         window = new MainWindow;
    36 #else
     27
    3728    window = new MainWindow;
    38 #endif /* MAEMO */
    39     window->show();
     29
    4030
    4131#ifdef MAEMO
     
    4333    CAlarmDBus *alarmDBus = new CAlarmDBus(window);
    4434    new AlarmDBusAdaptor(alarmDBus);
    45     //QDBusConnection connection = QDBusConnection::sessionBus();
    4635    QDBusConnection connection = QDBusConnection::sessionBus();
    4736
     
    5039        if( connection.registerService("org.fosdem.schedule") == false)
    5140        {
    52                 qDebug() << "dbus register service failed";
     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                }
    5350        }
    5451    }
     52
     53    if(argc > 1)
     54    {
     55        EventDialog dialog(atoi(argv[1]),window);
     56        dialog.exec();
     57    }
    5558#endif
     59
     60    window->show();
    5661
    5762    return a.exec();
  • src/mvc/mvc.pro

    rd7986a6 ra7d8638  
    44DESTDIR = ../bin
    55CONFIG += static
    6 QT += sql
     6QT += sql 
    77
    88# module dependencies
     
    2727    eventmodel.h \
    2828    treeview.h \
    29     room.h
     29    room.h 
    3030SOURCES += event.cpp \
    3131    conference.cpp \
     
    3434    eventmodel.cpp \
    3535    treeview.cpp \
    36     room.cpp
     36    room.cpp 
  • src/mvc/treeview.cpp

    rd7986a6 ra7d8638  
    9898                    // add alarm to the 'alarmd'
    9999                    Alarm alarm;
    100                     //int cookie = alarm.addAlarm(event.id(),QDateTime::currentDateTime().addSecs(10)); // testing
    101                     int cookie = alarm.addAlarm(event.id(),event.start().addSecs(-15*60)); // 15 minutes before real start
     100                    int cookie = alarm.addAlarm(event.id(),QDateTime::currentDateTime().addSecs(10)); // testing
     101                    //int cookie = alarm.addAlarm(event.id(),event.start().addSecs(-15*60)); // 15 minutes before real start
    102102                    qDebug() << "cookie: " << cookie;
    103103#endif /* MAEMO */
  • src/src.pro

    rd7986a6 ra7d8638  
    11include(global.pri)
    22TEMPLATE = subdirs
    3 SUBDIRS  += orm mvc sql gui
    43maemo : SUBDIRS += alarm
    5 SUBDIRS += app
     4SUBDIRS  += orm sql mvc gui app
    65#SUBDIRS += test
    76CONFIG += ordered
Note: See TracChangeset for help on using the changeset viewer.