fixed: broken compilation for linux caused by previous commit
[toast/confclerk.git] / src / gui / alarmdialog.cpp
1 #include "alarmdialog.h"
2
3 #include <QApplication>
4 #include <alarm.h>
5
6 const int SNOOZE_TIME = 5; // in minutes
7
8 AlarmDialog::AlarmDialog(int argc, char *argv[], QWidget *aParent)
9     : QDialog(aParent)
10     , mEventId(0)
11     , mAlarmId(0)
12 {
13     setupUi(this);
14
15     if(argc<3)
16     {
17         // not enough arguments passed to the dialog
18         // Usage: $ ./dialog eventId alarmId
19         // Example: $ ./dialog 521 13
20         //
21         // TODO: handle this case
22     }
23     else
24     {
25         mEventId = QString(argv[1]).toInt();
26         mAlarmId = QString(argv[2]).toInt();
27     }
28
29     connect(stopPB, SIGNAL(clicked()), qApp, SLOT(quit()));
30     connect(appPB, SIGNAL(clicked()), SLOT(runApp()));
31     connect(snoozePB, SIGNAL(clicked()), SLOT(snooze()));
32
33     message->setText(QString(argv[1]).append("-").append(QString(argv[2])));
34 }
35
36 void AlarmDialog::runApp()
37 {
38 }
39
40 void AlarmDialog::snooze()
41 {
42     if(mEventId==0) // not valid event ID
43         return;
44
45     Alarm alarm;
46     alarm.addAlarm(mEventId,QDateTime::currentDateTime().addSecs(60*SNOOZE_TIME));
47     qApp->quit();
48 }
49