summaryrefslogtreecommitdiffabout
path: root/libkcal/alarm.cpp
Unidiff
Diffstat (limited to 'libkcal/alarm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/alarm.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 07812c2..29e6205 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -255,96 +255,112 @@ void Alarm::addMailAttachment(const QString &mailAttachFile)
255 } 255 }
256} 256}
257 257
258QStringList Alarm::mailAttachments() const 258QStringList Alarm::mailAttachments() const
259{ 259{
260 return (mType == Email) ? mMailAttachFiles : QStringList(); 260 return (mType == Email) ? mMailAttachFiles : QStringList();
261} 261}
262 262
263void Alarm::setMailText(const QString &text) 263void Alarm::setMailText(const QString &text)
264{ 264{
265 if (mType == Email) { 265 if (mType == Email) {
266 mDescription = text; 266 mDescription = text;
267 mParent->updated(); 267 mParent->updated();
268 } 268 }
269} 269}
270 270
271QString Alarm::mailText() const 271QString Alarm::mailText() const
272{ 272{
273 return (mType == Email) ? mDescription : QString::null; 273 return (mType == Email) ? mDescription : QString::null;
274} 274}
275 275
276void Alarm::setDisplayAlarm(const QString &text) 276void Alarm::setDisplayAlarm(const QString &text)
277{ 277{
278 mType = Display; 278 mType = Display;
279 mDescription = text; 279 mDescription = text;
280 mParent->updated(); 280 mParent->updated();
281} 281}
282 282
283void Alarm::setText(const QString &text) 283void Alarm::setText(const QString &text)
284{ 284{
285 if (mType == Display) { 285 if (mType == Display) {
286 mDescription = text; 286 mDescription = text;
287 mParent->updated(); 287 mParent->updated();
288 } 288 }
289} 289}
290 290
291QString Alarm::text() const 291QString Alarm::text() const
292{ 292{
293 return (mType == Display) ? mDescription : QString::null; 293 return (mType == Display) ? mDescription : QString::null;
294} 294}
295 295
296void Alarm::setTime(const QDateTime &alarmTime) 296void Alarm::setTime(const QDateTime &alarmTime)
297{ 297{
298 mAlarmTime = alarmTime; 298 mAlarmTime = alarmTime;
299 mHasTime = true; 299 mHasTime = true;
300 300
301 mParent->updated(); 301 mParent->updated();
302} 302}
303int Alarm::offset()
304{
305 if ( hasTime() ) {
306 if (mParent->type()=="Todo") {
307 Todo *t = static_cast<Todo*>(mParent);
308 return t->dtDue().secsTo( mAlarmTime ) ;
309 } else
310 return mParent->dtStart().secsTo( mAlarmTime ) ;
311 }
312 else
313 {
314 return mOffset.asSeconds();
315 }
316
317}
318
303 319
304QDateTime Alarm::time() const 320QDateTime Alarm::time() const
305{ 321{
306 if ( hasTime() ) 322 if ( hasTime() )
307 return mAlarmTime; 323 return mAlarmTime;
308 else 324 else
309 { 325 {
310 if (mParent->type()=="Todo") { 326 if (mParent->type()=="Todo") {
311 Todo *t = static_cast<Todo*>(mParent); 327 Todo *t = static_cast<Todo*>(mParent);
312 return mOffset.end( t->dtDue() ); 328 return mOffset.end( t->dtDue() );
313 } else if (mEndOffset) { 329 } else if (mEndOffset) {
314 return mOffset.end( mParent->dtEnd() ); 330 return mOffset.end( mParent->dtEnd() );
315 } else { 331 } else {
316 return mOffset.end( mParent->dtStart() ); 332 return mOffset.end( mParent->dtStart() );
317 } 333 }
318 } 334 }
319} 335}
320 336
321bool Alarm::hasTime() const 337bool Alarm::hasTime() const
322{ 338{
323 return mHasTime; 339 return mHasTime;
324} 340}
325 341
326void Alarm::setSnoozeTime(int alarmSnoozeTime) 342void Alarm::setSnoozeTime(int alarmSnoozeTime)
327{ 343{
328 mAlarmSnoozeTime = alarmSnoozeTime; 344 mAlarmSnoozeTime = alarmSnoozeTime;
329 mParent->updated(); 345 mParent->updated();
330} 346}
331 347
332int Alarm::snoozeTime() const 348int Alarm::snoozeTime() const
333{ 349{
334 return mAlarmSnoozeTime; 350 return mAlarmSnoozeTime;
335} 351}
336 352
337void Alarm::setRepeatCount(int alarmRepeatCount) 353void Alarm::setRepeatCount(int alarmRepeatCount)
338{ 354{
339 kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl; 355 kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl;
340 356
341 mAlarmRepeatCount = alarmRepeatCount; 357 mAlarmRepeatCount = alarmRepeatCount;
342 mParent->updated(); 358 mParent->updated();
343} 359}
344 360
345int Alarm::repeatCount() const 361int Alarm::repeatCount() const
346{ 362{
347 kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl; 363 kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl;
348 return mAlarmRepeatCount; 364 return mAlarmRepeatCount;
349} 365}
350 366