summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp20
1 files changed, 19 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
@@ -271,379 +271,397 @@ void KOEventViewer::addTag(const QString & tag,const QString & text)
271 QString tmp; 271 QString tmp;
272 for(int i=0;i<=number;i++) { 272 for(int i=0;i<=number;i++) {
273 pos=tmpText.find("\n"); 273 pos=tmpText.find("\n");
274 tmp=tmpText.left(pos); 274 tmp=tmpText.left(pos);
275 tmpText=tmpText.right(tmpText.length()-pos-1); 275 tmpText=tmpText.right(tmpText.length()-pos-1);
276 tmpStr+=tmp+"<br>"; 276 tmpStr+=tmp+"<br>";
277 } 277 }
278 } 278 }
279 else tmpStr += tmpText; 279 else tmpStr += tmpText;
280 tmpStr+="</" + tag + ">"; 280 tmpStr+="</" + tag + ">";
281 mText.append(tmpStr); 281 mText.append(tmpStr);
282 } 282 }
283 else 283 else
284 { 284 {
285 str += text + "</" + tag + ">"; 285 str += text + "</" + tag + ">";
286 mText.append(str); 286 mText.append(str);
287 } 287 }
288} 288}
289 289
290void KOEventViewer::setColorMode( int m ) 290void KOEventViewer::setColorMode( int m )
291{ 291{
292 mColorMode = m; 292 mColorMode = m;
293} 293}
294void KOEventViewer::appendEvent(Event *event, int mode ) 294void KOEventViewer::appendEvent(Event *event, int mode )
295{ 295{
296 mMailSubject = ""; 296 mMailSubject = "";
297 mCurrentIncidence = event; 297 mCurrentIncidence = event;
298 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 298 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
299 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 299 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
300 topLevelWidget()->setCaption(i18n("Event Viewer")); 300 topLevelWidget()->setCaption(i18n("Event Viewer"));
301 if ( mode == 0 ) { 301 if ( mode == 0 ) {
302 addTag("h2",deTag(event->summary())); 302 addTag("h2",deTag(event->summary()));
303 formatReadOnly(event); 303 formatReadOnly(event);
304 } 304 }
305 else { 305 else {
306 if ( mColorMode == 1 ) { 306 if ( mColorMode == 1 ) {
307 mText +="<font color=\"#00A000\">"; 307 mText +="<font color=\"#00A000\">";
308 } 308 }
309 if ( mColorMode == 2 ) { 309 if ( mColorMode == 2 ) {
310 mText +="<font color=\"#C00000\">"; 310 mText +="<font color=\"#C00000\">";
311 } 311 }
312 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 312 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
313 if ( mode == 1 ) { 313 if ( mode == 1 ) {
314 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 314 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
315 } else { 315 } else {
316 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 316 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
317 } 317 }
318 formatReadOnly(event); 318 formatReadOnly(event);
319 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 319 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
320 if ( mColorMode ) 320 if ( mColorMode )
321 mText += "</font>"; 321 mText += "</font>";
322 } 322 }
323 mMailSubject += i18n( "Meeting " )+ event->summary(); 323 mMailSubject += i18n( "Meeting " )+ event->summary();
324 if (event->cancelled ()) { 324 if (event->cancelled ()) {
325 mText +="<font color=\"#B00000\">"; 325 mText +="<font color=\"#B00000\">";
326 addTag("i",i18n("This event has been cancelled!")); 326 addTag("i",i18n("This event has been cancelled!"));
327 mText.append("<br>"); 327 mText.append("<br>");
328 mText += "</font>"; 328 mText += "</font>";
329 mMailSubject += i18n("(cancelled)"); 329 mMailSubject += i18n("(cancelled)");
330 } 330 }
331 331
332 if (event->doesFloat()) { 332 if (event->doesFloat()) {
333 if (event->isMultiDay()) { 333 if (event->isMultiDay()) {
334 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 334 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
335 .arg(event->dtStartDateStr(shortDate)) 335 .arg(event->dtStartDateStr(shortDate))
336 .arg(event->dtEndDateStr(shortDate))); 336 .arg(event->dtEndDateStr(shortDate)));
337 mText.append(i18n("<p><b>Duration:</b> %1 days</p>") 337 mText.append(i18n("<p><b>Duration:</b> %1 days</p>")
338 .arg(event->dtStart().daysTo(event->dtEnd())+1)); 338 .arg(event->dtStart().daysTo(event->dtEnd())+1));
339 } else { 339 } else {
340 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 340 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
341 } 341 }
342 } else { 342 } else {
343 if (event->isMultiDay()) { 343 if (event->isMultiDay()) {
344 mText.append(i18n("<p><b>From:</b> %1</p> ") 344 mText.append(i18n("<p><b>From:</b> %1</p> ")
345 .arg(event->dtStartStr( shortDate))); 345 .arg(event->dtStartStr( shortDate)));
346 mText.append(i18n("<p><b>To:</b> %1</p>") 346 mText.append(i18n("<p><b>To:</b> %1</p>")
347 .arg(event->dtEndStr(shortDate))); 347 .arg(event->dtEndStr(shortDate)));
348 } else { 348 } else {
349 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 349 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
350 .arg(event->dtStartTimeStr()) 350 .arg(event->dtStartTimeStr())
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
447} 457}
448 458
449void KOEventViewer::appendTodo(Todo *event, int mode ) 459void KOEventViewer::appendTodo(Todo *event, int mode )
450{ 460{
451 mMailSubject = ""; 461 mMailSubject = "";
452 mCurrentIncidence = event; 462 mCurrentIncidence = event;
453 topLevelWidget()->setCaption(i18n("Todo Viewer")); 463 topLevelWidget()->setCaption(i18n("Todo Viewer"));
454 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 464 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
455 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 465 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
456 if (mode == 0 ) { 466 if (mode == 0 ) {
457 addTag("h2",deTag(event->summary())); 467 addTag("h2",deTag(event->summary()));
458 formatReadOnly(event); 468 formatReadOnly(event);
459 } 469 }
460 else { 470 else {
461 if ( mColorMode == 1 ) { 471 if ( mColorMode == 1 ) {
462 mText +="<font color=\"#00A000\">"; 472 mText +="<font color=\"#00A000\">";
463 } 473 }
464 if ( mColorMode == 2 ) { 474 if ( mColorMode == 2 ) {
465 mText +="<font color=\"#B00000\">"; 475 mText +="<font color=\"#B00000\">";
466 } 476 }
467 if ( mode == 1 ) { 477 if ( mode == 1 ) {
468 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 478 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
469 } else { 479 } else {
470 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 480 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
471 } 481 }
472 formatReadOnly(event); 482 formatReadOnly(event);
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>");
570 } 588 }
571 QPtrList<Incidence> Relations = event->relations(); 589 QPtrList<Incidence> Relations = event->relations();
572 Incidence *to; 590 Incidence *to;
573 if ( Relations.first() ) 591 if ( Relations.first() )
574 addTag("b",i18n("Sub todos:<br>")); 592 addTag("b",i18n("Sub todos:<br>"));
575 for (to=Relations.first();to;to=Relations.next()) { 593 for (to=Relations.first();to;to=Relations.next()) {
576 QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary()); 594 QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary());
577 mText += t_name; 595 mText += t_name;
578 mText += "<a href=\"todo_uid:" + to->uid() + "\">"; 596 mText += "<a href=\"todo_uid:" + to->uid() + "\">";
579 mText += deTag(to->summary()); 597 mText += deTag(to->summary());
580 mText += "</a><br>"; 598 mText += "</a><br>";
581 599
582 } 600 }
583 601
584 if ( KOPrefs::instance()->mEVshowDetails ) { 602 if ( KOPrefs::instance()->mEVshowDetails ) {
585 if (!event->description().isEmpty()) { 603 if (!event->description().isEmpty()) {
586 addTag("p",i18n("<b>Details: </b>")); 604 addTag("p",i18n("<b>Details: </b>"));
587 addTag("p",deTag(event->description())); 605 addTag("p",deTag(event->description()));
588 } 606 }
589 } 607 }
590 setText(mText); 608 setText(mText);
591} 609}
592 610
593void KOEventViewer::formatCategories(Incidence *event) 611void KOEventViewer::formatCategories(Incidence *event)
594{ 612{
595 if (!event->categoriesStr().isEmpty()) { 613 if (!event->categoriesStr().isEmpty()) {
596 if (event->categories().count() == 1) { 614 if (event->categories().count() == 1) {
597 addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); 615 addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace());
598 } else { 616 } else {
599 addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; 617 addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ;
600 } 618 }
601 } 619 }
602} 620}
603void KOEventViewer::formatAttendees(Incidence *event) 621void KOEventViewer::formatAttendees(Incidence *event)
604{ 622{
605 QPtrList<Attendee> attendees = event->attendees(); 623 QPtrList<Attendee> attendees = event->attendees();
606 if (attendees.count()) { 624 if (attendees.count()) {
607 625
608 626
609 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 627 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
610 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 628 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
611 addTag("h3",i18n("Organizer")); 629 addTag("h3",i18n("Organizer"));
612 mText.append("<ul><li>"); 630 mText.append("<ul><li>");
613#ifndef KORG_NOKABC 631#ifndef KORG_NOKABC
614 632
615#ifdef DESKTOP_VERSION 633#ifdef DESKTOP_VERSION
616 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 634 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
617 KABC::Addressee::List addressList; 635 KABC::Addressee::List addressList;
618 addressList = add_book->findByEmail(event->organizer()); 636 addressList = add_book->findByEmail(event->organizer());
619 KABC::Addressee o = addressList.first(); 637 KABC::Addressee o = addressList.first();
620 if (!o.isEmpty() && addressList.size()<2) { 638 if (!o.isEmpty() && addressList.size()<2) {
621 mText += "<a href=\"uid:" + o.uid() + "\">"; 639 mText += "<a href=\"uid:" + o.uid() + "\">";
622 mText += o.formattedName(); 640 mText += o.formattedName();
623 mText += "</a>\n"; 641 mText += "</a>\n";
624 } else { 642 } else {
625 mText.append(event->organizer()); 643 mText.append(event->organizer());
626 } 644 }
627#else //DESKTOP_VERSION 645#else //DESKTOP_VERSION
628 mText += "<a href=\"uid:organizer\">"; 646 mText += "<a href=\"uid:organizer\">";
629 mText += event->organizer(); 647 mText += event->organizer();
630 mText += "</a>\n"; 648 mText += "</a>\n";
631#endif //DESKTOP_VERSION 649#endif //DESKTOP_VERSION
632 650
633 651
634#else 652#else
635 mText.append(event->organizer()); 653 mText.append(event->organizer());
636#endif 654#endif
637 655
638 if (iconPath) { 656 if (iconPath) {
639 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 657 mText += " <a href=\"mailto:" + event->organizer() + "\">";
640 mText += "<IMG src=\"" + iconPath + "\">"; 658 mText += "<IMG src=\"" + iconPath + "\">";
641 mText += "</a>\n"; 659 mText += "</a>\n";
642 } 660 }
643 mText.append("</li></ul>"); 661 mText.append("</li></ul>");
644 662
645 addTag("h3",i18n("Attendees")); 663 addTag("h3",i18n("Attendees"));
646 Attendee *a; 664 Attendee *a;
647 mText.append("<ul>"); 665 mText.append("<ul>");
648 int a_count = 0; 666 int a_count = 0;
649 int a_count_nr = 0; 667 int a_count_nr = 0;