summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-06-08 10:56:24 (UTC)
committer zautrix <zautrix>2005-06-08 10:56:24 (UTC)
commit2448916479b456ca7c880427a80e8e32e95b2fba (patch) (unidiff)
tree83be907f0eccb43ffc44a7f1bc07995c32760cb5 /libkcal
parent793d117812b4da36c9c11d90cccba347cbc6e208 (diff)
downloadkdepimpi-2448916479b456ca7c880427a80e8e32e95b2fba.zip
kdepimpi-2448916479b456ca7c880427a80e8e32e95b2fba.tar.gz
kdepimpi-2448916479b456ca7c880427a80e8e32e95b2fba.tar.bz2
more type API changes
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/alarm.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 6de1566..0afa0a7 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -293,140 +293,140 @@ void Alarm::addMailAttachment(const QString &mailAttachFile)
293QStringList Alarm::mailAttachments() const 293QStringList Alarm::mailAttachments() const
294{ 294{
295 return (mType == Email) ? mMailAttachFiles : QStringList(); 295 return (mType == Email) ? mMailAttachFiles : QStringList();
296} 296}
297 297
298void Alarm::setMailText(const QString &text) 298void Alarm::setMailText(const QString &text)
299{ 299{
300 if (mType == Email) { 300 if (mType == Email) {
301 mDescription = text; 301 mDescription = text;
302 mParent->updated(); 302 mParent->updated();
303 } 303 }
304} 304}
305 305
306QString Alarm::mailText() const 306QString Alarm::mailText() const
307{ 307{
308 return (mType == Email) ? mDescription : QString::null; 308 return (mType == Email) ? mDescription : QString::null;
309} 309}
310 310
311void Alarm::setDisplayAlarm(const QString &text) 311void Alarm::setDisplayAlarm(const QString &text)
312{ 312{
313 mType = Display; 313 mType = Display;
314 mDescription = text; 314 mDescription = text;
315 mParent->updated(); 315 mParent->updated();
316} 316}
317 317
318void Alarm::setText(const QString &text) 318void Alarm::setText(const QString &text)
319{ 319{
320 if (mType == Display) { 320 if (mType == Display) {
321 mDescription = text; 321 mDescription = text;
322 mParent->updated(); 322 mParent->updated();
323 } 323 }
324} 324}
325 325
326QString Alarm::text() const 326QString Alarm::text() const
327{ 327{
328 return (mType == Display) ? mDescription : QString::null; 328 return (mType == Display) ? mDescription : QString::null;
329} 329}
330 330
331void Alarm::setTime(const QDateTime &alarmTime) 331void Alarm::setTime(const QDateTime &alarmTime)
332{ 332{
333 mAlarmTime = alarmTime; 333 mAlarmTime = alarmTime;
334 mHasTime = true; 334 mHasTime = true;
335 335
336 mParent->updated(); 336 mParent->updated();
337} 337}
338int Alarm::offset() 338int Alarm::offset()
339{ 339{
340 if ( hasTime() ) { 340 if ( hasTime() ) {
341 if (mParent->type()=="Todo") { 341 if (mParent->typeID() == todoID ) {
342 Todo *t = static_cast<Todo*>(mParent); 342 Todo *t = static_cast<Todo*>(mParent);
343 return t->dtDue().secsTo( mAlarmTime ) ; 343 return t->dtDue().secsTo( mAlarmTime ) ;
344 } else 344 } else
345 return mParent->dtStart().secsTo( mAlarmTime ) ; 345 return mParent->dtStart().secsTo( mAlarmTime ) ;
346 } 346 }
347 else 347 else
348 { 348 {
349 return mOffset.asSeconds(); 349 return mOffset.asSeconds();
350 } 350 }
351 351
352} 352}
353QString Alarm::offsetText() 353QString Alarm::offsetText()
354{ 354{
355 int min = -offset()/60; 355 int min = -offset()/60;
356 int hours = min /60; 356 int hours = min /60;
357 min = min % 60; 357 min = min % 60;
358 int days = hours /24; 358 int days = hours /24;
359 hours = hours % 24; 359 hours = hours % 24;
360 QString message; 360 QString message;
361 //qDebug("%d %d %d ", days, hours, min ); 361 //qDebug("%d %d %d ", days, hours, min );
362 if ( days > 0 ) 362 if ( days > 0 )
363 message += i18n("%1d").arg( days ); 363 message += i18n("%1d").arg( days );
364 if ( hours > 0 ) { 364 if ( hours > 0 ) {
365 if ( !message.isEmpty() ) message += "/"; 365 if ( !message.isEmpty() ) message += "/";
366 message += i18n("%1h").arg( hours ); 366 message += i18n("%1h").arg( hours );
367 } 367 }
368 if ( min > 0 ) { 368 if ( min > 0 ) {
369 if ( !message.isEmpty() ) message += "/"; 369 if ( !message.isEmpty() ) message += "/";
370 message += i18n("%1min").arg( min ); 370 message += i18n("%1min").arg( min );
371 } 371 }
372 if ( message.isEmpty() ) 372 if ( message.isEmpty() )
373 message = i18n("%1min").arg( 0 ); 373 message = i18n("%1min").arg( 0 );
374 return message; 374 return message;
375} 375}
376 376
377 377
378QDateTime Alarm::time() const 378QDateTime Alarm::time() const
379{ 379{
380 if ( hasTime() ) 380 if ( hasTime() )
381 return mAlarmTime; 381 return mAlarmTime;
382 else 382 else
383 { 383 {
384 if (mParent->type()=="Todo") { 384 if (mParent->typeID() == todoID ) {
385 Todo *t = static_cast<Todo*>(mParent); 385 Todo *t = static_cast<Todo*>(mParent);
386 return mOffset.end( t->dtDue() ); 386 return mOffset.end( t->dtDue() );
387 } else if (mEndOffset) { 387 } else if (mEndOffset) {
388 return mOffset.end( mParent->dtEnd() ); 388 return mOffset.end( mParent->dtEnd() );
389 } else { 389 } else {
390 return mOffset.end( mParent->dtStart() ); 390 return mOffset.end( mParent->dtStart() );
391 } 391 }
392 } 392 }
393} 393}
394 394
395bool Alarm::hasTime() const 395bool Alarm::hasTime() const
396{ 396{
397 return mHasTime; 397 return mHasTime;
398} 398}
399 399
400void Alarm::setSnoozeTime(int alarmSnoozeTime) 400void Alarm::setSnoozeTime(int alarmSnoozeTime)
401{ 401{
402 mAlarmSnoozeTime = alarmSnoozeTime; 402 mAlarmSnoozeTime = alarmSnoozeTime;
403 mParent->updated(); 403 mParent->updated();
404} 404}
405 405
406int Alarm::snoozeTime() const 406int Alarm::snoozeTime() const
407{ 407{
408 return mAlarmSnoozeTime; 408 return mAlarmSnoozeTime;
409} 409}
410 410
411void Alarm::setRepeatCount(int alarmRepeatCount) 411void Alarm::setRepeatCount(int alarmRepeatCount)
412{ 412{
413 kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl; 413 kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl;
414 414
415 mAlarmRepeatCount = alarmRepeatCount; 415 mAlarmRepeatCount = alarmRepeatCount;
416 mParent->updated(); 416 mParent->updated();
417} 417}
418 418
419int Alarm::repeatCount() const 419int Alarm::repeatCount() const
420{ 420{
421 kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl; 421 kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl;
422 return mAlarmRepeatCount; 422 return mAlarmRepeatCount;
423} 423}
424 424
425void Alarm::toggleAlarm() 425void Alarm::toggleAlarm()
426{ 426{
427 mAlarmEnabled = !mAlarmEnabled; 427 mAlarmEnabled = !mAlarmEnabled;
428 mParent->updated(); 428 mParent->updated();
429} 429}
430 430
431void Alarm::setEnabled(bool enable) 431void Alarm::setEnabled(bool enable)
432{ 432{