summaryrefslogtreecommitdiffabout
path: root/libkcal/alarm.cpp
Unidiff
Diffstat (limited to 'libkcal/alarm.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/alarm.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 3157214..3c4a81c 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -1,76 +1,78 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#include <kdebug.h> 22#include <kdebug.h>
23#include <klocale.h> 23#include <klocale.h>
24 24
25#include "incidence.h" 25#include "incidence.h"
26#include "todo.h" 26#include "todo.h"
27 27
28#include "alarm.h" 28#include "alarm.h"
29//Added by qt3to4:
30#include <Q3ValueList>
29 31
30using namespace KCal; 32using namespace KCal;
31#include <qwidget.h> 33#include <qwidget.h>
32Alarm::Alarm(Incidence *parent) 34Alarm::Alarm(Incidence *parent)
33 : mParent(parent), 35 : mParent(parent),
34 mType(Audio), 36 mType(Audio),
35 mDescription(""), // to make operator==() not fail 37 mDescription(""), // to make operator==() not fail
36 mFile(""), // to make operator==() not fail 38 mFile(""), // to make operator==() not fail
37 mMailSubject(""), // to make operator==() not fail 39 mMailSubject(""), // to make operator==() not fail
38 mAlarmSnoozeTime(5), 40 mAlarmSnoozeTime(5),
39 mAlarmRepeatCount(0), 41 mAlarmRepeatCount(0),
40 mEndOffset(false), 42 mEndOffset(false),
41 mHasTime(false), 43 mHasTime(false),
42 mAlarmEnabled(false) 44 mAlarmEnabled(false)
43{ 45{
44 46
45} 47}
46 48
47Alarm::~Alarm() 49Alarm::~Alarm()
48{ 50{
49} 51}
50 52
51bool Alarm::operator==( const Alarm& rhs ) const 53bool Alarm::operator==( const Alarm& rhs ) const
52{ 54{
53 55
54 if ( mType != rhs.mType || 56 if ( mType != rhs.mType ||
55 mAlarmSnoozeTime != rhs.mAlarmSnoozeTime || 57 mAlarmSnoozeTime != rhs.mAlarmSnoozeTime ||
56 mAlarmRepeatCount != rhs.mAlarmRepeatCount || 58 mAlarmRepeatCount != rhs.mAlarmRepeatCount ||
57 mAlarmEnabled != rhs.mAlarmEnabled || 59 mAlarmEnabled != rhs.mAlarmEnabled ||
58 mHasTime != rhs.mHasTime) 60 mHasTime != rhs.mHasTime)
59 return false; 61 return false;
60 62
61#if 0 63#if 0
62 if ( mType != rhs.mType ) { 64 if ( mType != rhs.mType ) {
63 65
64 qDebug("aaa1 "); 66 qDebug("aaa1 ");
65 return false; 67 return false;
66 } 68 }
67 69
68 if ( mAlarmSnoozeTime != rhs.mAlarmSnoozeTime ) { 70 if ( mAlarmSnoozeTime != rhs.mAlarmSnoozeTime ) {
69 71
70 qDebug("aaa2 "); 72 qDebug("aaa2 ");
71 return false; 73 return false;
72 } 74 }
73 75
74 76
75 if ( mAlarmRepeatCount != rhs.mAlarmRepeatCount ) { 77 if ( mAlarmRepeatCount != rhs.mAlarmRepeatCount ) {
76 78
@@ -167,134 +169,134 @@ void Alarm::setAudioAlarm(const QString &audioFile)
167void Alarm::setAudioFile(const QString &audioFile) 169void Alarm::setAudioFile(const QString &audioFile)
168{ 170{
169 if (mType == Audio) { 171 if (mType == Audio) {
170 mFile = audioFile; 172 mFile = audioFile;
171 mParent->updated(); 173 mParent->updated();
172 } 174 }
173} 175}
174 176
175QString Alarm::audioFile() const 177QString Alarm::audioFile() const
176{ 178{
177 return (mType == Audio) ? mFile : QString::null; 179 return (mType == Audio) ? mFile : QString::null;
178} 180}
179 181
180void Alarm::setProcedureAlarm(const QString &programFile, const QString &arguments) 182void Alarm::setProcedureAlarm(const QString &programFile, const QString &arguments)
181{ 183{
182 mType = Procedure; 184 mType = Procedure;
183 mFile = programFile; 185 mFile = programFile;
184 mDescription = arguments; 186 mDescription = arguments;
185 mParent->updated(); 187 mParent->updated();
186} 188}
187 189
188void Alarm::setProgramFile(const QString &programFile) 190void Alarm::setProgramFile(const QString &programFile)
189{ 191{
190 if (mType == Procedure) { 192 if (mType == Procedure) {
191 mFile = programFile; 193 mFile = programFile;
192 mParent->updated(); 194 mParent->updated();
193 } 195 }
194} 196}
195 197
196QString Alarm::programFile() const 198QString Alarm::programFile() const
197{ 199{
198 return (mType == Procedure) ? mFile : QString::null; 200 return (mType == Procedure) ? mFile : QString::null;
199} 201}
200 202
201void Alarm::setProgramArguments(const QString &arguments) 203void Alarm::setProgramArguments(const QString &arguments)
202{ 204{
203 if (mType == Procedure) { 205 if (mType == Procedure) {
204 mDescription = arguments; 206 mDescription = arguments;
205 mParent->updated(); 207 mParent->updated();
206 } 208 }
207} 209}
208 210
209QString Alarm::programArguments() const 211QString Alarm::programArguments() const
210{ 212{
211 return (mType == Procedure) ? mDescription : QString::null; 213 return (mType == Procedure) ? mDescription : QString::null;
212} 214}
213 215
214void Alarm::setEmailAlarm(const QString &subject, const QString &text, 216void Alarm::setEmailAlarm(const QString &subject, const QString &text,
215 const QValueList<Person> &addressees, const QStringList &attachments) 217 const Q3ValueList<Person> &addressees, const QStringList &attachments)
216{ 218{
217 mType = Email; 219 mType = Email;
218 mMailSubject = subject; 220 mMailSubject = subject;
219 mDescription = text; 221 mDescription = text;
220 mMailAddresses = addressees; 222 mMailAddresses = addressees;
221 mMailAttachFiles = attachments; 223 mMailAttachFiles = attachments;
222 mParent->updated(); 224 mParent->updated();
223} 225}
224 226
225void Alarm::setMailAddress(const Person &mailAddress) 227void Alarm::setMailAddress(const Person &mailAddress)
226{ 228{
227 if (mType == Email) { 229 if (mType == Email) {
228 mMailAddresses.clear(); 230 mMailAddresses.clear();
229 mMailAddresses += mailAddress; 231 mMailAddresses += mailAddress;
230 mParent->updated(); 232 mParent->updated();
231 } 233 }
232} 234}
233 235
234void Alarm::setMailAddresses(const QValueList<Person> &mailAddresses) 236void Alarm::setMailAddresses(const Q3ValueList<Person> &mailAddresses)
235{ 237{
236 if (mType == Email) { 238 if (mType == Email) {
237 mMailAddresses = mailAddresses; 239 mMailAddresses = mailAddresses;
238 mParent->updated(); 240 mParent->updated();
239 } 241 }
240} 242}
241 243
242void Alarm::addMailAddress(const Person &mailAddress) 244void Alarm::addMailAddress(const Person &mailAddress)
243{ 245{
244 if (mType == Email) { 246 if (mType == Email) {
245 mMailAddresses += mailAddress; 247 mMailAddresses += mailAddress;
246 mParent->updated(); 248 mParent->updated();
247 } 249 }
248} 250}
249 251
250QValueList<Person> Alarm::mailAddresses() const 252Q3ValueList<Person> Alarm::mailAddresses() const
251{ 253{
252 return (mType == Email) ? mMailAddresses : QValueList<Person>(); 254 return (mType == Email) ? mMailAddresses : Q3ValueList<Person>();
253} 255}
254 256
255void Alarm::setMailSubject(const QString &mailAlarmSubject) 257void Alarm::setMailSubject(const QString &mailAlarmSubject)
256{ 258{
257 if (mType == Email) { 259 if (mType == Email) {
258 mMailSubject = mailAlarmSubject; 260 mMailSubject = mailAlarmSubject;
259 mParent->updated(); 261 mParent->updated();
260 } 262 }
261} 263}
262 264
263QString Alarm::mailSubject() const 265QString Alarm::mailSubject() const
264{ 266{
265 return (mType == Email) ? mMailSubject : QString::null; 267 return (mType == Email) ? mMailSubject : QString::null;
266} 268}
267 269
268void Alarm::setMailAttachment(const QString &mailAttachFile) 270void Alarm::setMailAttachment(const QString &mailAttachFile)
269{ 271{
270 if (mType == Email) { 272 if (mType == Email) {
271 mMailAttachFiles.clear(); 273 mMailAttachFiles.clear();
272 mMailAttachFiles += mailAttachFile; 274 mMailAttachFiles += mailAttachFile;
273 mParent->updated(); 275 mParent->updated();
274 } 276 }
275} 277}
276 278
277void Alarm::setMailAttachments(const QStringList &mailAttachFiles) 279void Alarm::setMailAttachments(const QStringList &mailAttachFiles)
278{ 280{
279 if (mType == Email) { 281 if (mType == Email) {
280 mMailAttachFiles = mailAttachFiles; 282 mMailAttachFiles = mailAttachFiles;
281 mParent->updated(); 283 mParent->updated();
282 } 284 }
283} 285}
284 286
285void Alarm::addMailAttachment(const QString &mailAttachFile) 287void Alarm::addMailAttachment(const QString &mailAttachFile)
286{ 288{
287 if (mType == Email) { 289 if (mType == Email) {
288 mMailAttachFiles += mailAttachFile; 290 mMailAttachFiles += mailAttachFile;
289 mParent->updated(); 291 mParent->updated();
290 } 292 }
291} 293}
292 294
293QStringList Alarm::mailAttachments() const 295QStringList Alarm::mailAttachments() const
294{ 296{
295 return (mType == Email) ? mMailAttachFiles : QStringList(); 297 return (mType == Email) ? mMailAttachFiles : QStringList();
296} 298}
297 299
298void Alarm::setMailText(const QString &text) 300void Alarm::setMailText(const QString &text)
299{ 301{
300 if (mType == Email) { 302 if (mType == Email) {