summaryrefslogtreecommitdiffabout
path: root/libkcal/alarm.h
Unidiff
Diffstat (limited to 'libkcal/alarm.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/alarm.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/libkcal/alarm.h b/libkcal/alarm.h
index ac6ea0d..b24f0f7 100644
--- a/libkcal/alarm.h
+++ b/libkcal/alarm.h
@@ -1,246 +1,246 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#ifndef KCAL_ALARM_H 21#ifndef KCAL_ALARM_H
22#define KCAL_ALARM_H 22#define KCAL_ALARM_H
23 23
24#include <qstring.h> 24#include <qstring.h>
25#include <qvaluelist.h> 25#include <q3valuelist.h>
26 26
27#include "customproperties.h" 27#include "customproperties.h"
28#include "duration.h" 28#include "duration.h"
29#include "person.h" 29#include "person.h"
30 30
31namespace KCal { 31namespace KCal {
32 32
33class Incidence; 33class Incidence;
34 34
35/** 35/**
36 This class represents an alarm notification. 36 This class represents an alarm notification.
37*/ 37*/
38class Alarm : public CustomProperties 38class Alarm : public CustomProperties
39{ 39{
40 public: 40 public:
41 enum Type { Invalid, Display, Procedure, Email, Audio }; 41 enum Type { Invalid, Display, Procedure, Email, Audio };
42 typedef QValueList<Alarm *> List; 42 typedef Q3ValueList<Alarm *> List;
43 43
44 /** Construct a new alarm with variables initialized to "sane" values. */ 44 /** Construct a new alarm with variables initialized to "sane" values. */
45 explicit Alarm(Incidence *parent); 45 explicit Alarm(Incidence *parent);
46 /** Destruct Alarm object. */ 46 /** Destruct Alarm object. */
47 ~Alarm(); 47 ~Alarm();
48 48
49 /** Compare this alarm with another one. */ 49 /** Compare this alarm with another one. */
50 bool operator==(const Alarm &) const; 50 bool operator==(const Alarm &) const;
51 bool operator!=(const Alarm &a) const { return !operator==(a); } 51 bool operator!=(const Alarm &a) const { return !operator==(a); }
52 52
53 /** Set the type of the alarm. 53 /** Set the type of the alarm.
54 If the specified type is different from the current type of the alarm, 54 If the specified type is different from the current type of the alarm,
55 the alarm's type-specific properties are initialised to null. 55 the alarm's type-specific properties are initialised to null.
56 @param type type of alarm. 56 @param type type of alarm.
57 */ 57 */
58 void setType(Type type); 58 void setType(Type type);
59 /** Return the type of the alarm */ 59 /** Return the type of the alarm */
60 Type type() const; 60 Type type() const;
61 int offset(); 61 int offset();
62 QString offsetText(); 62 QString offsetText();
63 /** Set the alarm to be a display alarm. 63 /** Set the alarm to be a display alarm.
64 @param text text to display when the alarm is triggered. 64 @param text text to display when the alarm is triggered.
65 */ 65 */
66 void setDisplayAlarm(const QString &text); 66 void setDisplayAlarm(const QString &text);
67 /** Set the text to be displayed when the alarm is triggered. 67 /** Set the text to be displayed when the alarm is triggered.
68 Ignored if the alarm is not a display alarm. 68 Ignored if the alarm is not a display alarm.
69 */ 69 */
70 void setText(const QString &text); 70 void setText(const QString &text);
71 /** Return the text string that displays when the alarm is triggered. */ 71 /** Return the text string that displays when the alarm is triggered. */
72 QString text() const; 72 QString text() const;
73 73
74 /** Set the alarm to be an audio alarm. 74 /** Set the alarm to be an audio alarm.
75 @param audioFile optional file to play when the alarm is triggered. 75 @param audioFile optional file to play when the alarm is triggered.
76 */ 76 */
77 void setAudioAlarm(const QString &audioFile = QString::null); 77 void setAudioAlarm(const QString &audioFile = QString::null);
78 /** Set the file to play when the audio alarm is triggered. 78 /** Set the file to play when the audio alarm is triggered.
79 Ignored if the alarm is not an audio alarm. 79 Ignored if the alarm is not an audio alarm.
80 */ 80 */
81 void setAudioFile(const QString &audioFile); 81 void setAudioFile(const QString &audioFile);
82 /** Return the name of the audio file for the alarm. 82 /** Return the name of the audio file for the alarm.
83 @return The audio file for the alarm, or QString::null if not an audio alarm. 83 @return The audio file for the alarm, or QString::null if not an audio alarm.
84 */ 84 */
85 QString audioFile() const; 85 QString audioFile() const;
86 86
87 /** Set the alarm to be a procedure alarm. 87 /** Set the alarm to be a procedure alarm.
88 @param programFile program to execute when the alarm is triggered. 88 @param programFile program to execute when the alarm is triggered.
89 @param arguments arguments to supply to programFile. 89 @param arguments arguments to supply to programFile.
90 */ 90 */
91 void setProcedureAlarm(const QString &programFile, const QString &arguments = QString::null); 91 void setProcedureAlarm(const QString &programFile, const QString &arguments = QString::null);
92 /** Set the program file to execute when the alarm is triggered. 92 /** Set the program file to execute when the alarm is triggered.
93 Ignored if the alarm is not a procedure alarm. 93 Ignored if the alarm is not a procedure alarm.
94 */ 94 */
95 void setProgramFile(const QString &programFile); 95 void setProgramFile(const QString &programFile);
96 /** Return the name of the program file to execute when the alarm is triggered. 96 /** Return the name of the program file to execute when the alarm is triggered.
97 @return the program file name, or QString::null if not a procedure alarm. 97 @return the program file name, or QString::null if not a procedure alarm.
98 */ 98 */
99 QString programFile() const; 99 QString programFile() const;
100 /** Set the arguments to the program to execute when the alarm is triggered. 100 /** Set the arguments to the program to execute when the alarm is triggered.
101 Ignored if the alarm is not a procedure alarm. 101 Ignored if the alarm is not a procedure alarm.
102 */ 102 */
103 void setProgramArguments(const QString &arguments); 103 void setProgramArguments(const QString &arguments);
104 /** Return the arguments to the program to run when the alarm is triggered. 104 /** Return the arguments to the program to run when the alarm is triggered.
105 @return the program arguments, or QString::null if not a procedure alarm. 105 @return the program arguments, or QString::null if not a procedure alarm.
106 */ 106 */
107 QString programArguments() const; 107 QString programArguments() const;
108 108
109 /** Set the alarm to be an email alarm. 109 /** Set the alarm to be an email alarm.
110 @param subject subject line of email. 110 @param subject subject line of email.
111 @param text body of email. 111 @param text body of email.
112 @param addressees email addresses of recipient(s). 112 @param addressees email addresses of recipient(s).
113 @param attachments optional names of files to attach to the email. 113 @param attachments optional names of files to attach to the email.
114 */ 114 */
115 void setEmailAlarm(const QString &subject, const QString &text, const QValueList<Person> &addressees, 115 void setEmailAlarm(const QString &subject, const QString &text, const Q3ValueList<Person> &addressees,
116 const QStringList &attachments = QStringList()); 116 const QStringList &attachments = QStringList());
117 117
118 /** Send mail to this address when the alarm is triggered. 118 /** Send mail to this address when the alarm is triggered.
119 Ignored if the alarm is not an email alarm. 119 Ignored if the alarm is not an email alarm.
120 */ 120 */
121 void setMailAddress(const Person &mailAlarmAddress); 121 void setMailAddress(const Person &mailAlarmAddress);
122 /** Send mail to these addresses when the alarm is triggered. 122 /** Send mail to these addresses when the alarm is triggered.
123 Ignored if the alarm is not an email alarm. 123 Ignored if the alarm is not an email alarm.
124 */ 124 */
125 void setMailAddresses(const QValueList<Person> &mailAlarmAddresses); 125 void setMailAddresses(const Q3ValueList<Person> &mailAlarmAddresses);
126 /** Add this address to the list of addresses to send mail to when the alarm is triggered. 126 /** Add this address to the list of addresses to send mail to when the alarm is triggered.
127 Ignored if the alarm is not an email alarm. 127 Ignored if the alarm is not an email alarm.
128 */ 128 */
129 void addMailAddress(const Person &mailAlarmAddress); 129 void addMailAddress(const Person &mailAlarmAddress);
130 /** return the addresses to send mail to when an alarm goes off */ 130 /** return the addresses to send mail to when an alarm goes off */
131 QValueList<Person> mailAddresses() const; 131 Q3ValueList<Person> mailAddresses() const;
132 132
133 /** Set the subject line of the mail. 133 /** Set the subject line of the mail.
134 Ignored if the alarm is not an email alarm. 134 Ignored if the alarm is not an email alarm.
135 */ 135 */
136 void setMailSubject(const QString &mailAlarmSubject); 136 void setMailSubject(const QString &mailAlarmSubject);
137 /** return the subject line of the mail */ 137 /** return the subject line of the mail */
138 QString mailSubject() const; 138 QString mailSubject() const;
139 139
140 /** Attach this filename to the email. 140 /** Attach this filename to the email.
141 Ignored if the alarm is not an email alarm. 141 Ignored if the alarm is not an email alarm.
142 */ 142 */
143 void setMailAttachment(const QString &mailAttachFile); 143 void setMailAttachment(const QString &mailAttachFile);
144 /** Attach these filenames to the email. 144 /** Attach these filenames to the email.
145 Ignored if the alarm is not an email alarm. 145 Ignored if the alarm is not an email alarm.
146 */ 146 */
147 void setMailAttachments(const QStringList &mailAttachFiles); 147 void setMailAttachments(const QStringList &mailAttachFiles);
148 /** Add this filename to the list of files to attach to the email. 148 /** Add this filename to the list of files to attach to the email.
149 Ignored if the alarm is not an email alarm. 149 Ignored if the alarm is not an email alarm.
150 */ 150 */
151 void addMailAttachment(const QString &mailAttachFile); 151 void addMailAttachment(const QString &mailAttachFile);
152 /** return the filenames to attach to the email */ 152 /** return the filenames to attach to the email */
153 QStringList mailAttachments() const; 153 QStringList mailAttachments() const;
154 154
155 /** Set the email body text. 155 /** Set the email body text.
156 Ignored if the alarm is not an email alarm. 156 Ignored if the alarm is not an email alarm.
157 */ 157 */
158 void setMailText(const QString &text); 158 void setMailText(const QString &text);
159 /** Return the email body text. 159 /** Return the email body text.
160 @return the body text, or QString::null if not an email alarm. 160 @return the body text, or QString::null if not an email alarm.
161 */ 161 */
162 QString mailText() const; 162 QString mailText() const;
163 163
164 /** set the time to trigger an alarm */ 164 /** set the time to trigger an alarm */
165 void setTime(const QDateTime &alarmTime); 165 void setTime(const QDateTime &alarmTime);
166 /** return the date/time when an alarm goes off */ 166 /** return the date/time when an alarm goes off */
167 QDateTime time() const; 167 QDateTime time() const;
168 /** Return true, if the alarm has an explicit date/time. */ 168 /** Return true, if the alarm has an explicit date/time. */
169 bool hasTime() const; 169 bool hasTime() const;
170 170
171 /** Set offset of alarm in time relative to the start of the event. */ 171 /** Set offset of alarm in time relative to the start of the event. */
172 void setStartOffset(const Duration &); 172 void setStartOffset(const Duration &);
173 /** Return offset of alarm in time relative to the start of the event. 173 /** Return offset of alarm in time relative to the start of the event.
174 * If the alarm's time is not defined in terms of an offset relative 174 * If the alarm's time is not defined in terms of an offset relative
175 * to the start of the event, returns zero. 175 * to the start of the event, returns zero.
176 */ 176 */
177 Duration startOffset() const; 177 Duration startOffset() const;
178 /** Return whether the alarm is defined in terms of an offset relative 178 /** Return whether the alarm is defined in terms of an offset relative
179 * to the start of the event. 179 * to the start of the event.
180 */ 180 */
181 bool hasStartOffset() const; 181 bool hasStartOffset() const;
182 182
183 /** Set offset of alarm in time relative to the end of the event. */ 183 /** Set offset of alarm in time relative to the end of the event. */
184 void setEndOffset(const Duration &); 184 void setEndOffset(const Duration &);
185 /** Return offset of alarm in time relative to the end of the event. 185 /** Return offset of alarm in time relative to the end of the event.
186 * If the alarm's time is not defined in terms of an offset relative 186 * If the alarm's time is not defined in terms of an offset relative
187 * to the end of the event, returns zero. 187 * to the end of the event, returns zero.
188 */ 188 */
189 Duration endOffset() const; 189 Duration endOffset() const;
190 /** Return whether the alarm is defined in terms of an offset relative 190 /** Return whether the alarm is defined in terms of an offset relative
191 * to the end of the event. 191 * to the end of the event.
192 */ 192 */
193 bool hasEndOffset() const; 193 bool hasEndOffset() const;
194 194
195 /** Set the interval between snoozes for the alarm. 195 /** Set the interval between snoozes for the alarm.
196 @param snoozeTime the time in minutes between snoozes. 196 @param snoozeTime the time in minutes between snoozes.
197 */ 197 */
198 void setSnoozeTime(int alarmSnoozeTime); 198 void setSnoozeTime(int alarmSnoozeTime);
199 /** Get how long the alarm snooze interval is. 199 /** Get how long the alarm snooze interval is.
200 @return the number of minutes between snoozes. 200 @return the number of minutes between snoozes.
201 */ 201 */
202 int snoozeTime() const; 202 int snoozeTime() const;
203 203
204 /** set how many times an alarm is to repeat itself (w/snoozes) */ 204 /** set how many times an alarm is to repeat itself (w/snoozes) */
205 void setRepeatCount(int alarmRepeatCount); 205 void setRepeatCount(int alarmRepeatCount);
206 /** get how many times an alarm repeats */ 206 /** get how many times an alarm repeats */
207 int repeatCount() const; 207 int repeatCount() const;
208 208
209 /** toggles the value of alarm to be either on or off. 209 /** toggles the value of alarm to be either on or off.
210 set's the alarm time to be x minutes before dtStart time. */ 210 set's the alarm time to be x minutes before dtStart time. */
211 void toggleAlarm(); 211 void toggleAlarm();
212 212
213 /** set the alarm enabled status */ 213 /** set the alarm enabled status */
214 void setEnabled(bool enable); 214 void setEnabled(bool enable);
215 /** get the alarm enabled status */ 215 /** get the alarm enabled status */
216 bool enabled() const; 216 bool enabled() const;
217 217
218 /** Set the alarm's parent incidence */ 218 /** Set the alarm's parent incidence */
219 void setParent( Incidence * ); 219 void setParent( Incidence * );
220 /** get the alarm's parent incidence */ 220 /** get the alarm's parent incidence */
221 Incidence *parent() const { return mParent; } 221 Incidence *parent() const { return mParent; }
222 222
223 private: 223 private:
224 Incidence *mParent; // the incidence which this alarm belongs to 224 Incidence *mParent; // the incidence which this alarm belongs to
225 Type mType; // type of alarm 225 Type mType; // type of alarm
226 QString mDescription; // text to display/email body/procedure arguments 226 QString mDescription; // text to display/email body/procedure arguments
227 QString mFile; // procedure program to run/optional audio file to play 227 QString mFile; // procedure program to run/optional audio file to play
228 QStringList mMailAttachFiles; // filenames to attach to email 228 QStringList mMailAttachFiles; // filenames to attach to email
229 QValueList<Person> mMailAddresses; // who to mail for reminder 229 Q3ValueList<Person> mMailAddresses; // who to mail for reminder
230 QString mMailSubject; // subject of email 230 QString mMailSubject; // subject of email
231 231
232 int mAlarmSnoozeTime; // number of minutes after alarm to 232 int mAlarmSnoozeTime; // number of minutes after alarm to
233 // snooze before ringing again 233 // snooze before ringing again
234 int mAlarmRepeatCount; // number of times for alarm to repeat 234 int mAlarmRepeatCount; // number of times for alarm to repeat
235 // after the initial time 235 // after the initial time
236 236
237 QDateTime mAlarmTime; // time at which to trigger the alarm 237 QDateTime mAlarmTime; // time at which to trigger the alarm
238 Duration mOffset; // time relative to incidence DTSTART to trigger the alarm 238 Duration mOffset; // time relative to incidence DTSTART to trigger the alarm
239 bool mEndOffset; // if true, mOffset relates to DTEND, not DTSTART 239 bool mEndOffset; // if true, mOffset relates to DTEND, not DTSTART
240 bool mHasTime; // use mAlarmTime, not mOffset 240 bool mHasTime; // use mAlarmTime, not mOffset
241 bool mAlarmEnabled; 241 bool mAlarmEnabled;
242}; 242};
243 243
244} 244}
245 245
246#endif 246#endif