Changeset 6197713


Ignore:
Timestamp:
01/26/10 14:15:13 (12 years ago)
Author:
uzakmat <uzakmat@…>
Branches:
master, qt5
Children:
e4c5a03
Parents:
830f102
Message:

Alarm implementation modified

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/alarm/alarm.cpp

    r830f102 r6197713  
    99{
    1010    cookie_t cookie = 0;
    11     alarm_event_t *event = 0;
    12     alarm_action_t *action = 0;
     11    alarm_event_t *eve = 0;
     12    alarm_action_t *act = 0;
    1313
    1414    /* Create alarm event structure and set application identifier */
    15     event = alarm_event_create();
    16     alarm_event_set_alarm_appid(event, APPID);
    17     alarm_event_set_message(event, QString::number(aEventId).toLocal8Bit().data()); // for Deleting purposes
     15    eve = alarm_event_create();
     16    alarm_event_set_alarm_appid(eve, APPID);
     17
     18    /* for Deleting purposes */
     19    alarm_event_set_message(eve, QString::number(aEventId).toLocal8Bit().data());
    1820
    1921    /* Use absolute time triggering */
    20     event->alarm_time = aDateTime.toTime_t();
     22    eve->alarm_time = time(0) + 5; //aDateTime.toTime_t();
     23
     24    QString command = QDir::currentPath() + "/" + *qApp->argv() +
     25      QString(" %1").arg(QString::number(aEventId));
    2126
    2227    /* Add exec command action */
    23     action = alarm_event_add_actions(event, 1);
    24     QString command = QDir::currentPath() + "/" + *qApp->argv() + QString(" %1").arg(QString::number(aEventId));
    25     alarm_action_set_exec_command(action, command.toLocal8Bit().data());
    26     action->flags |= ALARM_ACTION_TYPE_EXEC;
    27     action->flags |= ALARM_ACTION_WHEN_TRIGGERED;
    28     action->flags |= ALARM_ACTION_EXEC_ADD_COOKIE; // adds assigned cookie at the end of command string
     28    act = alarm_event_add_actions(eve, 1);
     29    alarm_action_set_label(act, "FOSDEM'10");
     30    //    alarm_event_set_icon(eve, "fosdem");
     31    //    alarm_event_set_title(eve, "FOSDEM'10");
     32    act->flags |= ALARM_ACTION_TYPE_EXEC;
     33    act->flags |= ALARM_ACTION_WHEN_RESPONDED;
     34    // adds assigned cookie at the end of command string
     35    //    act->flags |= ALARM_ACTION_EXEC_ADD_COOKIE;
     36    alarm_action_set_exec_command(act, command.toLocal8Bit().data());
     37
     38    /* Add stop button action */
     39    act = alarm_event_add_actions(eve, 1);
     40    alarm_action_set_label(act, "Stop");
     41    act->flags |= ALARM_ACTION_WHEN_RESPONDED;
     42    act->flags |= ALARM_ACTION_TYPE_NOP;
     43 
     44    /* Add snooze button action */
     45    act = alarm_event_add_actions(eve, 1);
     46    alarm_action_set_label(act, "Snooze");
     47    act->flags |= ALARM_ACTION_WHEN_RESPONDED;
     48    act->flags |= ALARM_ACTION_TYPE_SNOOZE;
    2949
    3050    /* Send the alarm to alarmd */
    31     cookie = alarmd_event_add(event);
    32     if(cookie==0) // adding alarm failed
     51    cookie = alarmd_event_add(eve);
     52
     53    // adding alarm failed
     54    if (cookie == 0)
    3355        emit(addAlarmFailed(aEventId));
    3456    else
     
    3658
    3759    /* Free all dynamic memory associated with the alarm event */
    38     alarm_event_delete(event);
     60    alarm_event_delete(eve);
    3961
    4062    return cookie;
Note: See TracChangeset for help on using the changeset viewer.