summaryrefslogtreecommitdiffabout
path: root/korganizer/koeventviewer.cpp
authorzautrix <zautrix>2005-02-13 19:07:45 (UTC)
committer zautrix <zautrix>2005-02-13 19:07:45 (UTC)
commit7bd83e913399b8be68a7d37e8f02118ec9eab90e (patch) (unidiff)
tree284d1592687ea4d3e0c220fafd289a702718dee4 /korganizer/koeventviewer.cpp
parent293271fe9e6a9061da329183f8f488d79580f7da (diff)
downloadkdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.zip
kdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.tar.gz
kdepimpi-7bd83e913399b8be68a7d37e8f02118ec9eab90e.tar.bz2
todo fixi
Diffstat (limited to 'korganizer/koeventviewer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 39921a0..f6c9624 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -341,128 +341,135 @@ void KOEventViewer::appendEvent(Event *event, int mode )
341 mText.append(event->secrecyStr()+"<br>"); 341 mText.append(event->secrecyStr()+"<br>");
342 if (!event->description().isEmpty()) { 342 if (!event->description().isEmpty()) {
343 addTag("p",i18n("<b>Details: </b>")); 343 addTag("p",i18n("<b>Details: </b>"));
344 addTag("p",event->description()); 344 addTag("p",event->description());
345 } 345 }
346 346
347 formatCategories(event); 347 formatCategories(event);
348 348
349 formatReadOnly(event); 349 formatReadOnly(event);
350 formatAttendees(event); 350 formatAttendees(event);
351 351
352 setText(mText); 352 setText(mText);
353 //QWhatsThis::add(this,mText); 353 //QWhatsThis::add(this,mText);
354 354
355} 355}
356 356
357void KOEventViewer::appendTodo(Todo *event, int mode ) 357void KOEventViewer::appendTodo(Todo *event, int mode )
358{ 358{
359 mMailSubject = ""; 359 mMailSubject = "";
360 mCurrentIncidence = event; 360 mCurrentIncidence = event;
361 topLevelWidget()->setCaption(i18n("Todo Viewer")); 361 topLevelWidget()->setCaption(i18n("Todo Viewer"));
362 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 362 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
363 if (mode == 0 ) 363 if (mode == 0 )
364 addTag("h2",event->summary()); 364 addTag("h2",event->summary());
365 else { 365 else {
366 if ( mColorMode == 1 ) { 366 if ( mColorMode == 1 ) {
367 mText +="<font color=\"#00A000\">"; 367 mText +="<font color=\"#00A000\">";
368 } 368 }
369 if ( mColorMode == 2 ) { 369 if ( mColorMode == 2 ) {
370 mText +="<font color=\"#B00000\">"; 370 mText +="<font color=\"#B00000\">";
371 } 371 }
372 if ( mode == 1 ) { 372 if ( mode == 1 ) {
373 addTag("h2",i18n( "Local: " ) +event->summary()); 373 addTag("h2",i18n( "Local: " ) +event->summary());
374 } else { 374 } else {
375 addTag("h2",i18n( "Remote: " ) +event->summary()); 375 addTag("h2",i18n( "Remote: " ) +event->summary());
376 } 376 }
377 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 377 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
378 if ( mColorMode ) 378 if ( mColorMode )
379 mText += "</font>"; 379 mText += "</font>";
380 } 380 }
381 mMailSubject += i18n( "Todo " )+ event->summary(); 381 mMailSubject += i18n( "Todo " )+ event->summary();
382 382
383 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 383 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
384 mText +="<font color=\"#B00000\">"; 384 mText +="<font color=\"#B00000\">";
385 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); 385 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
386 mText += "</font>"; 386 mText += "</font>";
387 } else { 387 } else {
388 mText.append(i18n("<p><i>%1 % completed</i></p>") 388 mText.append(i18n("<p><i>%1 % completed</i></p>")
389 .arg(event->percentComplete())); 389 .arg(event->percentComplete()));
390 } 390 }
391 391
392 if (event->cancelled ()) { 392 if (event->cancelled ()) {
393 mText +="<font color=\"#B00000\">"; 393 mText +="<font color=\"#B00000\">";
394 addTag("i",i18n("This todo has been cancelled!")); 394 addTag("i",i18n("This todo has been cancelled!"));
395 mText.append("<br>"); 395 mText.append("<br>");
396 mText += "</font>"; 396 mText += "</font>";
397 mMailSubject += i18n("(cancelled)"); 397 mMailSubject += i18n("(cancelled)");
398 } 398 }
399 399
400 if (!event->location().isEmpty()) { 400 if (!event->location().isEmpty()) {
401 addTag("b",i18n("Location: ")); 401 addTag("b",i18n("Location: "));
402 mText.append(event->location()+"<br>"); 402 mText.append(event->location()+"<br>");
403 mMailSubject += i18n(" at ") + event->location(); 403 mMailSubject += i18n(" at ") + event->location();
404 } 404 }
405
406 if (event->recurrence()->doesRecur()) {
407
408 QString recurText = event->recurrence()->recurrenceText();
409 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
410
411 }
405 if (event->hasStartDate()) { 412 if (event->hasStartDate()) {
406 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 413 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
407 } 414 }
408 if (event->hasDueDate()) { 415 if (event->hasDueDate()) {
409 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 416 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
410 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 417 mMailSubject += i18n(" - " )+event->dtDueStr( true );
411 } 418 }
412 addTag("b",i18n("Access: ")); 419 addTag("b",i18n("Access: "));
413 mText.append(event->secrecyStr()+"<br>"); 420 mText.append(event->secrecyStr()+"<br>");
414 if (!event->description().isEmpty()) { 421 if (!event->description().isEmpty()) {
415 addTag("p",i18n("<b>Details: </b>")); 422 addTag("p",i18n("<b>Details: </b>"));
416 addTag("p",event->description()); 423 addTag("p",event->description());
417 } 424 }
418 425
419 formatCategories(event); 426 formatCategories(event);
420 427
421 mText.append(i18n("<p><b>Priority:</b> %2</p>") 428 mText.append(i18n("<p><b>Priority:</b> %2</p>")
422 .arg(QString::number(event->priority()))); 429 .arg(QString::number(event->priority())));
423 430
424 formatReadOnly(event); 431 formatReadOnly(event);
425 formatAttendees(event); 432 formatAttendees(event);
426 if ( event->relatedTo() ) { 433 if ( event->relatedTo() ) {
427 addTag("b",i18n("Parent todo:<br>")); 434 addTag("b",i18n("Parent todo:<br>"));
428 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); 435 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
429 } 436 }
430 QPtrList<Incidence> Relations = event->relations(); 437 QPtrList<Incidence> Relations = event->relations();
431 Incidence *to; 438 Incidence *to;
432 if ( Relations.first() ) 439 if ( Relations.first() )
433 addTag("b",i18n("Sub todos:<br>")); 440 addTag("b",i18n("Sub todos:<br>"));
434 for (to=Relations.first();to;to=Relations.next()) { 441 for (to=Relations.first();to;to=Relations.next()) {
435 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); 442 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>");
436 443
437 } 444 }
438 setText(mText); 445 setText(mText);
439} 446}
440 447
441void KOEventViewer::formatCategories(Incidence *event) 448void KOEventViewer::formatCategories(Incidence *event)
442{ 449{
443 if (!event->categoriesStr().isEmpty()) { 450 if (!event->categoriesStr().isEmpty()) {
444 if (event->categories().count() == 1) { 451 if (event->categories().count() == 1) {
445 addTag("h3",i18n("Category")); 452 addTag("h3",i18n("Category"));
446 } else { 453 } else {
447 addTag("h3",i18n("Categories")); 454 addTag("h3",i18n("Categories"));
448 } 455 }
449 addTag("p",event->categoriesStr()); 456 addTag("p",event->categoriesStr());
450 } 457 }
451} 458}
452void KOEventViewer::formatAttendees(Incidence *event) 459void KOEventViewer::formatAttendees(Incidence *event)
453{ 460{
454 QPtrList<Attendee> attendees = event->attendees(); 461 QPtrList<Attendee> attendees = event->attendees();
455 if (attendees.count()) { 462 if (attendees.count()) {
456 463
457 464
458 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 465 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
459 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 466 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
460 addTag("h3",i18n("Organizer")); 467 addTag("h3",i18n("Organizer"));
461 mText.append("<ul><li>"); 468 mText.append("<ul><li>");
462#ifndef KORG_NOKABC 469#ifndef KORG_NOKABC
463 470
464#ifdef DESKTOP_VERSION 471#ifdef DESKTOP_VERSION
465 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 472 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
466 KABC::Addressee::List addressList; 473 KABC::Addressee::List addressList;
467 addressList = add_book->findByEmail(event->organizer()); 474 addressList = add_book->findByEmail(event->organizer());
468 KABC::Addressee o = addressList.first(); 475 KABC::Addressee o = addressList.first();