summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp20
-rw-r--r--libkcal/kincidenceformatter.cpp16
2 files changed, 35 insertions, 1 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 607e549..92d2a80 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -351,96 +351,106 @@ void KOEventViewer::appendEvent(Event *event, int mode )
351 .arg(event->dtEndTimeStr())); 351 .arg(event->dtEndTimeStr()));
352 mText.append(i18n("<p><b>On:</b> %1</p> ") 352 mText.append(i18n("<p><b>On:</b> %1</p> ")
353 .arg(event->dtStartDateStr( shortDate ))); 353 .arg(event->dtStartDateStr( shortDate )));
354 } 354 }
355 } 355 }
356 if (!event->location().isEmpty()) { 356 if (!event->location().isEmpty()) {
357 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 357 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
358 mMailSubject += i18n(" at ") + event->location(); 358 mMailSubject += i18n(" at ") + event->location();
359 } 359 }
360 if (event->doesRecur()) { 360 if (event->doesRecur()) {
361 361
362 QString recurText = event->recurrenceText(); 362 QString recurText = event->recurrenceText();
363 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 363 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
364 bool ok; 364 bool ok;
365 QDate start = QDate::currentDate(); 365 QDate start = QDate::currentDate();
366 QDateTime next; 366 QDateTime next;
367 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 367 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
368 if ( ok ) { 368 if ( ok ) {
369 if ( wideScreen ){ 369 if ( wideScreen ){
370 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); 370 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) );
371 } else { 371 } else {
372 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 372 addTag("p",i18n("<b>Next recurrence is on:</b>") );
373 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 373 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
374 } 374 }
375 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); 375 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
376 376
377 } else { 377 } else {
378 bool last; 378 bool last;
379 QDate nextd; 379 QDate nextd;
380 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 380 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
381 if ( last ) { 381 if ( last ) {
382 if ( wideScreen ){ 382 if ( wideScreen ){
383 addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); 383 addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate ));
384 } else{ 384 } else{
385 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 385 addTag("p",i18n("<b>Last recurrence was on:</b>") );
386 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 386 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
387 } 387 }
388 } 388 }
389 } 389 }
390 } else { 390 } else {
391 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 391 mMailSubject += i18n(" - " )+event->dtStartStr( true );
392 392
393 } 393 }
394 394
395 395
396 if (event->isAlarmEnabled()) { 396 if (event->isAlarmEnabled()) {
397 Alarm *alarm =event->alarms().first() ; 397 Alarm *alarm =event->alarms().first() ;
398 QDateTime t = alarm->time(); 398 QDateTime t = alarm->time();
399
400 if (event->doesRecur()) {
401 bool ok = false;
402 int offset = 0;
403 QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
404 if ( ok ) {
405 t = next;
406 }
407 }
408
399 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 409 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
400 if(wideScreen ){ 410 if(wideScreen ){
401 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 411 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
402 }else{ 412 }else{
403 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 413 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
404 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 414 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
405 } 415 }
406 //addTag("p",s); 416 //addTag("p",s);
407 if ( !(event->alarmEnabled() ) ) { 417 if ( !(event->alarmEnabled() ) ) {
408 addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>"); 418 addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>");
409 419
410 } 420 }
411 } 421 }
412 422
413 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 423 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
414 424
415 formatCategories(event); 425 formatCategories(event);
416 426
417 formatAttendees(event); 427 formatAttendees(event);
418 428
419 if ( KOPrefs::instance()->mEVshowCreated ) { 429 if ( KOPrefs::instance()->mEVshowCreated ) {
420 if(wideScreen ){ 430 if(wideScreen ){
421 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 431 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
422 }else{ 432 }else{
423 addTag("p",i18n("<b>Created: ") +" </b>"); 433 addTag("p",i18n("<b>Created: ") +" </b>");
424 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 434 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
425 } 435 }
426 436
427 437
428 } 438 }
429 if ( KOPrefs::instance()->mEVshowChanged ) { 439 if ( KOPrefs::instance()->mEVshowChanged ) {
430 if(wideScreen ){ 440 if(wideScreen ){
431 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 441 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
432 }else{ 442 }else{
433 addTag("p",i18n("<b>Last modified: ") +" </b>"); 443 addTag("p",i18n("<b>Last modified: ") +" </b>");
434 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 444 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
435 } 445 }
436 446
437 } 447 }
438 if ( KOPrefs::instance()->mEVshowDetails ) { 448 if ( KOPrefs::instance()->mEVshowDetails ) {
439 if (!event->description().isEmpty()) { 449 if (!event->description().isEmpty()) {
440 addTag("p",i18n("<b>Details: </b>")); 450 addTag("p",i18n("<b>Details: </b>"));
441 addTag("p",deTag(event->description())); 451 addTag("p",deTag(event->description()));
442 } 452 }
443 } 453 }
444 setText(mText); 454 setText(mText);
445 //QWhatsThis::add(this,mText); 455 //QWhatsThis::add(this,mText);
446 456
@@ -473,97 +483,105 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
473 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 483 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
474 if ( mColorMode ) 484 if ( mColorMode )
475 mText += "</font>"; 485 mText += "</font>";
476 } 486 }
477 mMailSubject += i18n( "Todo " )+ event->summary(); 487 mMailSubject += i18n( "Todo " )+ event->summary();
478 488
479 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 489 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
480 mText +="<font color=\"#B00000\">"; 490 mText +="<font color=\"#B00000\">";
481 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); 491 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
482 mText += "</font>"; 492 mText += "</font>";
483 } else { 493 } else {
484 mText.append(i18n("<p><i>%1 % completed</i></p>") 494 mText.append(i18n("<p><i>%1 % completed</i></p>")
485 .arg(event->percentComplete())); 495 .arg(event->percentComplete()));
486 } 496 }
487 497
488 if (event->cancelled ()) { 498 if (event->cancelled ()) {
489 mText +="<font color=\"#B00000\">"; 499 mText +="<font color=\"#B00000\">";
490 addTag("i",i18n("This todo has been cancelled!")); 500 addTag("i",i18n("This todo has been cancelled!"));
491 mText.append("<br>"); 501 mText.append("<br>");
492 mText += "</font>"; 502 mText += "</font>";
493 mMailSubject += i18n("(cancelled)"); 503 mMailSubject += i18n("(cancelled)");
494 } 504 }
495 505
496 506
497 507
498 if (event->doesRecur()) { 508 if (event->doesRecur()) {
499 509
500 QString recurText = event->recurrence()->recurrenceText(); 510 QString recurText = event->recurrence()->recurrenceText();
501 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 511 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
502 512
503 } 513 }
504 if (event->hasStartDate()) { 514 if (event->hasStartDate()) {
505 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 515 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
506 } 516 }
507 if (event->hasDueDate()) { 517 if (event->hasDueDate()) {
508 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 518 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
509 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 519 mMailSubject += i18n(" - " )+event->dtDueStr( true );
510 } 520 }
511 if (!event->location().isEmpty()) { 521 if (!event->location().isEmpty()) {
512 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 522 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
513 mMailSubject += i18n(" at ") + event->location(); 523 mMailSubject += i18n(" at ") + event->location();
514 } 524 }
515 mText.append(i18n("<p><b>Priority:</b> %2</p>") 525 mText.append(i18n("<p><b>Priority:</b> %2</p>")
516 .arg(QString::number(event->priority()))); 526 .arg(QString::number(event->priority())));
517 527
518 if (event->isAlarmEnabled()) { 528 if (event->isAlarmEnabled()) {
519 Alarm *alarm =event->alarms().first() ; 529 Alarm *alarm =event->alarms().first() ;
520 QDateTime t = alarm->time(); 530 QDateTime t = alarm->time();
521 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 531 if (event->doesRecur()) {
532 bool ok = false;
533 int offset = 0;
534 QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
535 if ( ok ) {
536 t = next;
537 }
538 }
539 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
522 if ( wideScreen ) { 540 if ( wideScreen ) {
523 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 541 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
524 } else { 542 } else {
525 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 543 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
526 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 544 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
527 } 545 }
528 if ( !(event->alarmEnabled() ) ) { 546 if ( !(event->alarmEnabled() ) ) {
529 addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>"); 547 addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>");
530 548
531 } 549 }
532 } 550 }
533 551
534 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 552 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
535 553
536 formatCategories(event); 554 formatCategories(event);
537 555
538 formatAttendees(event); 556 formatAttendees(event);
539 557
540 if ( KOPrefs::instance()->mEVshowCreated ) { 558 if ( KOPrefs::instance()->mEVshowCreated ) {
541 if(wideScreen ){ 559 if(wideScreen ){
542 560
543 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 561 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
544 562
545 } else { 563 } else {
546 addTag("p",i18n("<b>Created: ") +" </b>"); 564 addTag("p",i18n("<b>Created: ") +" </b>");
547 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 565 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
548 } 566 }
549 } 567 }
550 if ( KOPrefs::instance()->mEVshowChanged ) { 568 if ( KOPrefs::instance()->mEVshowChanged ) {
551 if(wideScreen ){ 569 if(wideScreen ){
552 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 570 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
553 571
554 } else { 572 } else {
555 addTag("p",i18n("<b>Last modified: ") +" </b>"); 573 addTag("p",i18n("<b>Last modified: ") +" </b>");
556 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 574 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
557 } 575 }
558 } 576 }
559 if ( event->relatedTo() ) { 577 if ( event->relatedTo() ) {
560 addTag("b",i18n("Parent todo:<br>")); 578 addTag("b",i18n("Parent todo:<br>"));
561 579
562 QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary()); 580 QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary());
563 581
564 mText += t_name; 582 mText += t_name;
565 mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">"; 583 mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">";
566 mText += deTag(event->relatedTo()->summary()); 584 mText += deTag(event->relatedTo()->summary());
567 mText += "</a><br>"; 585 mText += "</a><br>";
568 586
569 // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>"); 587 // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>");
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 4dfe16a..733b897 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -90,96 +90,104 @@ void KIncidenceFormatter::setEvent(Event *event)
90 } 90 }
91 } else { 91 } else {
92 if (event->isMultiDay()) { 92 if (event->isMultiDay()) {
93 mText.append(i18n("<p><b>From:</b> %1</p> ") 93 mText.append(i18n("<p><b>From:</b> %1</p> ")
94 .arg(event->dtStartStr( shortDate))); 94 .arg(event->dtStartStr( shortDate)));
95 mText.append(i18n("<p><b>To:</b> %1</p>") 95 mText.append(i18n("<p><b>To:</b> %1</p>")
96 .arg(event->dtEndStr(shortDate))); 96 .arg(event->dtEndStr(shortDate)));
97 } else { 97 } else {
98 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 98 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
99 .arg(event->dtStartTimeStr()) 99 .arg(event->dtStartTimeStr())
100 .arg(event->dtEndTimeStr())); 100 .arg(event->dtEndTimeStr()));
101 mText.append(i18n("<p><b>On:</b> %1</p> ") 101 mText.append(i18n("<p><b>On:</b> %1</p> ")
102 .arg(event->dtStartDateStr( shortDate ))); 102 .arg(event->dtStartDateStr( shortDate )));
103 } 103 }
104 } 104 }
105 if (!event->location().isEmpty()) { 105 if (!event->location().isEmpty()) {
106 addTag("b",i18n("Location: ")); 106 addTag("b",i18n("Location: "));
107 mText.append(deTag(event->location())+"<br>"); 107 mText.append(deTag(event->location())+"<br>");
108 } 108 }
109 109
110 if (event->doesRecur()) { 110 if (event->doesRecur()) {
111 111
112 QString recurText = event->recurrence()->recurrenceText(); 112 QString recurText = event->recurrence()->recurrenceText();
113 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 113 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
114 114
115 bool ok; 115 bool ok;
116 QDate start = QDate::currentDate(); 116 QDate start = QDate::currentDate();
117 QDateTime next; 117 QDateTime next;
118 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 118 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
119 if ( ok ) { 119 if ( ok ) {
120 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 120 addTag("p",i18n("<b>Next recurrence is on:</b>") );
121 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 121 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
122 122
123 } else { 123 } else {
124 bool last; 124 bool last;
125 QDate nextd; 125 QDate nextd;
126 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 126 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
127 if ( last ) { 127 if ( last ) {
128 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 128 addTag("p",i18n("<b>Last recurrence was on:</b>") );
129 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 129 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
130 } 130 }
131 } 131 }
132 } 132 }
133 133
134 134
135 if (event->isAlarmEnabled()) { 135 if (event->isAlarmEnabled()) {
136 Alarm *alarm =event->alarms().first() ; 136 Alarm *alarm =event->alarms().first() ;
137 QDateTime t = alarm->time(); 137 QDateTime t = alarm->time();
138 if (event->doesRecur()) {
139 bool ok = false;
140 int offset = 0;
141 QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
142 if ( ok ) {
143 t = next;
144 }
145 }
138 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 146 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
139 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); 147 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
140 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 148 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
141 //addTag("p",s); 149 //addTag("p",s);
142 } 150 }
143 151
144 152
145 153
146 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 154 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
147 // mText.append(event->secrecyStr()+"<br>"); 155 // mText.append(event->secrecyStr()+"<br>");
148 formatCategories(event); 156 formatCategories(event);
149 157
150 formatAttendees(event); 158 formatAttendees(event);
151 159
152 if ( mCreated ) { 160 if ( mCreated ) {
153#ifdef DESKTOP_VERSION 161#ifdef DESKTOP_VERSION
154 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 162 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
155#else 163#else
156 addTag("p",i18n("<b>Created: ") +" </b>"); 164 addTag("p",i18n("<b>Created: ") +" </b>");
157 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 165 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
158#endif 166#endif
159 167
160 } 168 }
161 if ( mModified ) { 169 if ( mModified ) {
162#ifdef DESKTOP_VERSION 170#ifdef DESKTOP_VERSION
163 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 171 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
164#else 172#else
165 addTag("p",i18n("<b>Last modified: ") +" </b>"); 173 addTag("p",i18n("<b>Last modified: ") +" </b>");
166 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 174 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
167#endif 175#endif
168 176
169 } 177 }
170 if ( mDetails ) { 178 if ( mDetails ) {
171 if (!event->description().isEmpty()) { 179 if (!event->description().isEmpty()) {
172 addTag("p",i18n("<b>Details: </b>")); 180 addTag("p",i18n("<b>Details: </b>"));
173 addTag("p",deTag(event->description())); 181 addTag("p",deTag(event->description()));
174 } 182 }
175 } 183 }
176 184
177} 185}
178 186
179void KIncidenceFormatter::setTodo(Todo *event ) 187void KIncidenceFormatter::setTodo(Todo *event )
180{ 188{
181 int mode = 0; 189 int mode = 0;
182 mCurrentIncidence = event; 190 mCurrentIncidence = event;
183 bool shortDate = true; 191 bool shortDate = true;
184 if (mode == 0 ) { 192 if (mode == 0 ) {
185 addTag("h3",deTag(event->summary())); 193 addTag("h3",deTag(event->summary()));
@@ -199,96 +207,104 @@ void KIncidenceFormatter::setTodo(Todo *event )
199 } 207 }
200 formatReadOnly(event); 208 formatReadOnly(event);
201 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 209 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
202 if ( mColorMode ) 210 if ( mColorMode )
203 mText += "</font>"; 211 mText += "</font>";
204 } 212 }
205 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 213 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
206 mText +="<font color=\"#B00000\">"; 214 mText +="<font color=\"#B00000\">";
207 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); 215 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) );
208 mText += "</font>"; 216 mText += "</font>";
209 } else { 217 } else {
210 mText.append(i18n("<p><i>%1 % completed</i></p>") 218 mText.append(i18n("<p><i>%1 % completed</i></p>")
211 .arg(event->percentComplete())); 219 .arg(event->percentComplete()));
212 } 220 }
213 if (event->cancelled ()) { 221 if (event->cancelled ()) {
214 mText +="<font color=\"#B00000\">"; 222 mText +="<font color=\"#B00000\">";
215 addTag("i",i18n("This todo has been cancelled!")); 223 addTag("i",i18n("This todo has been cancelled!"));
216 mText.append("<br>"); 224 mText.append("<br>");
217 mText += "</font>"; 225 mText += "</font>";
218 } 226 }
219 227
220 228
221 if (event->doesRecur()) { 229 if (event->doesRecur()) {
222 230
223 QString recurText = event->recurrence()->recurrenceText(); 231 QString recurText = event->recurrence()->recurrenceText();
224 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 232 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
225 } 233 }
226 234
227 if (event->hasStartDate()) { 235 if (event->hasStartDate()) {
228 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); 236 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate)));
229 } 237 }
230 238
231 239
232 if (event->hasDueDate()) { 240 if (event->hasDueDate()) {
233 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); 241 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
234 } 242 }
235 243
236 if (!event->location().isEmpty()) { 244 if (!event->location().isEmpty()) {
237 addTag("b",i18n("Location: ")); 245 addTag("b",i18n("Location: "));
238 mText.append(deTag(event->location())+"<br>"); 246 mText.append(deTag(event->location())+"<br>");
239 } 247 }
240 248
241 mText.append(i18n("<p><b>Priority:</b> %2</p>") 249 mText.append(i18n("<p><b>Priority:</b> %2</p>")
242 .arg(QString::number(event->priority()))); 250 .arg(QString::number(event->priority())));
243 251
244 if (event->isAlarmEnabled()) { 252 if (event->isAlarmEnabled()) {
245 Alarm *alarm =event->alarms().first() ; 253 Alarm *alarm =event->alarms().first() ;
246 QDateTime t = alarm->time(); 254 QDateTime t = alarm->time();
255 if (event->doesRecur()) {
256 bool ok = false;
257 int offset = 0;
258 QDateTime next = event->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
259 if ( ok ) {
260 t = next;
261 }
262 }
247 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 263 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
248 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 264 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
249 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 265 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
250 //addTag("p",s); 266 //addTag("p",s);
251 } 267 }
252 268
253 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 269 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
254 formatCategories(event); 270 formatCategories(event);
255 271
256 formatAttendees(event); 272 formatAttendees(event);
257 if ( mCreated ) { 273 if ( mCreated ) {
258#ifdef DESKTOP_VERSION 274#ifdef DESKTOP_VERSION
259 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 275 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
260#else 276#else
261 addTag("p",i18n("<b>Created: ") +" </b>"); 277 addTag("p",i18n("<b>Created: ") +" </b>");
262 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 278 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
263#endif 279#endif
264 280
265 } 281 }
266 if ( mModified ) { 282 if ( mModified ) {
267#ifdef DESKTOP_VERSION 283#ifdef DESKTOP_VERSION
268 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 284 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
269#else 285#else
270 addTag("p",i18n("<b>Last modified: ") +" </b>"); 286 addTag("p",i18n("<b>Last modified: ") +" </b>");
271 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 287 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
272#endif 288#endif
273 289
274 } 290 }
275 if ( mDetails ) { 291 if ( mDetails ) {
276 if (!event->description().isEmpty()) { 292 if (!event->description().isEmpty()) {
277 addTag("p",i18n("<b>Details: </b>")); 293 addTag("p",i18n("<b>Details: </b>"));
278 addTag("p",deTag(event->description())); 294 addTag("p",deTag(event->description()));
279 } 295 }
280 } 296 }
281} 297}
282 298
283void KIncidenceFormatter::setJournal(Journal* ) 299void KIncidenceFormatter::setJournal(Journal* )
284{ 300{
285 301
286} 302}
287 303
288void KIncidenceFormatter::formatCategories(Incidence *event) 304void KIncidenceFormatter::formatCategories(Incidence *event)
289{ 305{
290 if (!event->categoriesStr().isEmpty()) { 306 if (!event->categoriesStr().isEmpty()) {
291 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() ); 307 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() );
292 //mText.append(event->categoriesStr()); 308 //mText.append(event->categoriesStr());
293 } 309 }
294} 310}