summaryrefslogtreecommitdiffabout
path: root/korganizer/koeventviewer.cpp
Unidiff
Diffstat (limited to 'korganizer/koeventviewer.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 02b54da..607e549 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -359,96 +359,100 @@ void KOEventViewer::appendEvent(Event *event, int mode )
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 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 399 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
400 if(wideScreen ){ 400 if(wideScreen ){
401 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 401 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
402 }else{ 402 }else{
403 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 403 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
404 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 404 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
405 } 405 }
406 //addTag("p",s); 406 //addTag("p",s);
407 if ( !(event->alarmEnabled() ) ) {
408 addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>");
409
410 }
407 } 411 }
408 412
409 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 413 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
410 414
411 formatCategories(event); 415 formatCategories(event);
412 416
413 formatAttendees(event); 417 formatAttendees(event);
414 418
415 if ( KOPrefs::instance()->mEVshowCreated ) { 419 if ( KOPrefs::instance()->mEVshowCreated ) {
416 if(wideScreen ){ 420 if(wideScreen ){
417 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 421 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
418 }else{ 422 }else{
419 addTag("p",i18n("<b>Created: ") +" </b>"); 423 addTag("p",i18n("<b>Created: ") +" </b>");
420 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 424 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
421 } 425 }
422 426
423 427
424 } 428 }
425 if ( KOPrefs::instance()->mEVshowChanged ) { 429 if ( KOPrefs::instance()->mEVshowChanged ) {
426 if(wideScreen ){ 430 if(wideScreen ){
427 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 431 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
428 }else{ 432 }else{
429 addTag("p",i18n("<b>Last modified: ") +" </b>"); 433 addTag("p",i18n("<b>Last modified: ") +" </b>");
430 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 434 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
431 } 435 }
432 436
433 } 437 }
434 if ( KOPrefs::instance()->mEVshowDetails ) { 438 if ( KOPrefs::instance()->mEVshowDetails ) {
435 if (!event->description().isEmpty()) { 439 if (!event->description().isEmpty()) {
436 addTag("p",i18n("<b>Details: </b>")); 440 addTag("p",i18n("<b>Details: </b>"));
437 addTag("p",deTag(event->description())); 441 addTag("p",deTag(event->description()));
438 } 442 }
439 } 443 }
440 setText(mText); 444 setText(mText);
441 //QWhatsThis::add(this,mText); 445 //QWhatsThis::add(this,mText);
442 446
443} 447}
444 448
445void KOEventViewer::appendTodo(Todo *event, int mode ) 449void KOEventViewer::appendTodo(Todo *event, int mode )
446{ 450{
447 mMailSubject = ""; 451 mMailSubject = "";
448 mCurrentIncidence = event; 452 mCurrentIncidence = event;
449 topLevelWidget()->setCaption(i18n("Todo Viewer")); 453 topLevelWidget()->setCaption(i18n("Todo Viewer"));
450 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 454 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
451 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 455 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
452 if (mode == 0 ) { 456 if (mode == 0 ) {
453 addTag("h2",deTag(event->summary())); 457 addTag("h2",deTag(event->summary()));
454 formatReadOnly(event); 458 formatReadOnly(event);
@@ -476,96 +480,100 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
476 mText +="<font color=\"#B00000\">"; 480 mText +="<font color=\"#B00000\">";
477 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); 481 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
478 mText += "</font>"; 482 mText += "</font>";
479 } else { 483 } else {
480 mText.append(i18n("<p><i>%1 % completed</i></p>") 484 mText.append(i18n("<p><i>%1 % completed</i></p>")
481 .arg(event->percentComplete())); 485 .arg(event->percentComplete()));
482 } 486 }
483 487
484 if (event->cancelled ()) { 488 if (event->cancelled ()) {
485 mText +="<font color=\"#B00000\">"; 489 mText +="<font color=\"#B00000\">";
486 addTag("i",i18n("This todo has been cancelled!")); 490 addTag("i",i18n("This todo has been cancelled!"));
487 mText.append("<br>"); 491 mText.append("<br>");
488 mText += "</font>"; 492 mText += "</font>";
489 mMailSubject += i18n("(cancelled)"); 493 mMailSubject += i18n("(cancelled)");
490 } 494 }
491 495
492 496
493 497
494 if (event->doesRecur()) { 498 if (event->doesRecur()) {
495 499
496 QString recurText = event->recurrence()->recurrenceText(); 500 QString recurText = event->recurrence()->recurrenceText();
497 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 501 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
498 502
499 } 503 }
500 if (event->hasStartDate()) { 504 if (event->hasStartDate()) {
501 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 505 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
502 } 506 }
503 if (event->hasDueDate()) { 507 if (event->hasDueDate()) {
504 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 508 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
505 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 509 mMailSubject += i18n(" - " )+event->dtDueStr( true );
506 } 510 }
507 if (!event->location().isEmpty()) { 511 if (!event->location().isEmpty()) {
508 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 512 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
509 mMailSubject += i18n(" at ") + event->location(); 513 mMailSubject += i18n(" at ") + event->location();
510 } 514 }
511 mText.append(i18n("<p><b>Priority:</b> %2</p>") 515 mText.append(i18n("<p><b>Priority:</b> %2</p>")
512 .arg(QString::number(event->priority()))); 516 .arg(QString::number(event->priority())));
513 517
514 if (event->isAlarmEnabled()) { 518 if (event->isAlarmEnabled()) {
515 Alarm *alarm =event->alarms().first() ; 519 Alarm *alarm =event->alarms().first() ;
516 QDateTime t = alarm->time(); 520 QDateTime t = alarm->time();
517 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 521 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
518 if ( wideScreen ) { 522 if ( wideScreen ) {
519 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 523 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
520 } else { 524 } else {
521 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 525 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
522 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 526 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
523 } 527 }
528 if ( !(event->alarmEnabled() ) ) {
529 addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>");
530
531 }
524 } 532 }
525 533
526 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 534 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
527 535
528 formatCategories(event); 536 formatCategories(event);
529 537
530 formatAttendees(event); 538 formatAttendees(event);
531 539
532 if ( KOPrefs::instance()->mEVshowCreated ) { 540 if ( KOPrefs::instance()->mEVshowCreated ) {
533 if(wideScreen ){ 541 if(wideScreen ){
534 542
535 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 543 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
536 544
537 } else { 545 } else {
538 addTag("p",i18n("<b>Created: ") +" </b>"); 546 addTag("p",i18n("<b>Created: ") +" </b>");
539 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 547 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
540 } 548 }
541 } 549 }
542 if ( KOPrefs::instance()->mEVshowChanged ) { 550 if ( KOPrefs::instance()->mEVshowChanged ) {
543 if(wideScreen ){ 551 if(wideScreen ){
544 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 552 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
545 553
546 } else { 554 } else {
547 addTag("p",i18n("<b>Last modified: ") +" </b>"); 555 addTag("p",i18n("<b>Last modified: ") +" </b>");
548 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 556 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
549 } 557 }
550 } 558 }
551 if ( event->relatedTo() ) { 559 if ( event->relatedTo() ) {
552 addTag("b",i18n("Parent todo:<br>")); 560 addTag("b",i18n("Parent todo:<br>"));
553 561
554 QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary()); 562 QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary());
555 563
556 mText += t_name; 564 mText += t_name;
557 mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">"; 565 mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">";
558 mText += deTag(event->relatedTo()->summary()); 566 mText += deTag(event->relatedTo()->summary());
559 mText += "</a><br>"; 567 mText += "</a><br>";
560 568
561 // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>"); 569 // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>");
562 } 570 }
563 QPtrList<Incidence> Relations = event->relations(); 571 QPtrList<Incidence> Relations = event->relations();
564 Incidence *to; 572 Incidence *to;
565 if ( Relations.first() ) 573 if ( Relations.first() )
566 addTag("b",i18n("Sub todos:<br>")); 574 addTag("b",i18n("Sub todos:<br>"));
567 for (to=Relations.first();to;to=Relations.next()) { 575 for (to=Relations.first();to;to=Relations.next()) {
568 QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary()); 576 QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary());
569 mText += t_name; 577 mText += t_name;
570 mText += "<a href=\"todo_uid:" + to->uid() + "\">"; 578 mText += "<a href=\"todo_uid:" + to->uid() + "\">";
571 mText += deTag(to->summary()); 579 mText += deTag(to->summary());