summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-15 16:20:26 (UTC)
committer zautrix <zautrix>2005-06-15 16:20:26 (UTC)
commitcba0ac17d3d505805be6aa4b4fea6f63473a1e00 (patch) (unidiff)
treeb7eceb0b3181cbb2c14b753692f135bc0cd5dd0e
parent2a788f41ebeb7d8edab7010fb1a00799cb9e036d (diff)
downloadkdepimpi-cba0ac17d3d505805be6aa4b4fea6f63473a1e00.zip
kdepimpi-cba0ac17d3d505805be6aa4b4fea6f63473a1e00.tar.gz
kdepimpi-cba0ac17d3d505805be6aa4b4fea6f63473a1e00.tar.bz2
fixi
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp9
-rw-r--r--korganizer/komonthview.cpp4
-rw-r--r--libkcal/kincidenceformatter.cpp9
3 files changed, 12 insertions, 10 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index c8c2f28..6315827 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -261,62 +261,64 @@ void KOEventViewer::addTag(const QString & tag,const QString & text)
261 else tmpStr += tmpText; 261 else tmpStr += tmpText;
262 tmpStr+="</" + tag + ">"; 262 tmpStr+="</" + tag + ">";
263 mText.append(tmpStr); 263 mText.append(tmpStr);
264 } 264 }
265 else 265 else
266 { 266 {
267 str += text + "</" + tag + ">"; 267 str += text + "</" + tag + ">";
268 mText.append(str); 268 mText.append(str);
269 } 269 }
270} 270}
271 271
272void KOEventViewer::setColorMode( int m ) 272void KOEventViewer::setColorMode( int m )
273{ 273{
274 mColorMode = m; 274 mColorMode = m;
275} 275}
276void KOEventViewer::appendEvent(Event *event, int mode ) 276void KOEventViewer::appendEvent(Event *event, int mode )
277{ 277{
278 mMailSubject = ""; 278 mMailSubject = "";
279 mCurrentIncidence = event; 279 mCurrentIncidence = event;
280 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 280 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
281 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 281 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
282 topLevelWidget()->setCaption(i18n("Event Viewer")); 282 topLevelWidget()->setCaption(i18n("Event Viewer"));
283 if ( mode == 0 ) { 283 if ( mode == 0 ) {
284 addTag("h2",deTag(event->summary())); 284 addTag("h2",deTag(event->summary()));
285 formatReadOnly(event);
285 } 286 }
286 else { 287 else {
287 if ( mColorMode == 1 ) { 288 if ( mColorMode == 1 ) {
288 mText +="<font color=\"#00A000\">"; 289 mText +="<font color=\"#00A000\">";
289 } 290 }
290 if ( mColorMode == 2 ) { 291 if ( mColorMode == 2 ) {
291 mText +="<font color=\"#C00000\">"; 292 mText +="<font color=\"#C00000\">";
292 } 293 }
293 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 294 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
294 if ( mode == 1 ) { 295 if ( mode == 1 ) {
295 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 296 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
296 } else { 297 } else {
297 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 298 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
298 } 299 }
300 formatReadOnly(event);
299 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 301 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
300 if ( mColorMode ) 302 if ( mColorMode )
301 mText += "</font>"; 303 mText += "</font>";
302 } 304 }
303 mMailSubject += i18n( "Meeting " )+ event->summary(); 305 mMailSubject += i18n( "Meeting " )+ event->summary();
304 if (event->cancelled ()) { 306 if (event->cancelled ()) {
305 mText +="<font color=\"#B00000\">"; 307 mText +="<font color=\"#B00000\">";
306 addTag("i",i18n("This event has been cancelled!")); 308 addTag("i",i18n("This event has been cancelled!"));
307 mText.append("<br>"); 309 mText.append("<br>");
308 mText += "</font>"; 310 mText += "</font>";
309 mMailSubject += i18n("(cancelled)"); 311 mMailSubject += i18n("(cancelled)");
310 } 312 }
311 313
312 if (event->doesFloat()) { 314 if (event->doesFloat()) {
313 if (event->isMultiDay()) { 315 if (event->isMultiDay()) {
314 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 316 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
315 .arg(event->dtStartDateStr(shortDate)) 317 .arg(event->dtStartDateStr(shortDate))
316 .arg(event->dtEndDateStr(shortDate))); 318 .arg(event->dtEndDateStr(shortDate)));
317 } else { 319 } else {
318 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 320 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
319 } 321 }
320 } else { 322 } else {
321 if (event->isMultiDay()) { 323 if (event->isMultiDay()) {
322 mText.append(i18n("<p><b>From:</b> %1</p> ") 324 mText.append(i18n("<p><b>From:</b> %1</p> ")
@@ -367,102 +369,104 @@ void KOEventViewer::appendEvent(Event *event, int mode )
367 } 369 }
368 } else { 370 } else {
369 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 371 mMailSubject += i18n(" - " )+event->dtStartStr( true );
370 372
371 } 373 }
372 374
373 375
374 if (event->isAlarmEnabled()) { 376 if (event->isAlarmEnabled()) {
375 Alarm *alarm =event->alarms().first() ; 377 Alarm *alarm =event->alarms().first() ;
376 QDateTime t = alarm->time(); 378 QDateTime t = alarm->time();
377 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 379 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
378 if(wideScreen ){ 380 if(wideScreen ){
379 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 381 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
380 }else{ 382 }else{
381 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 383 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
382 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 384 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
383 } 385 }
384 //addTag("p",s); 386 //addTag("p",s);
385 } 387 }
386 388
387 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 389 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
388 390
389 formatCategories(event); 391 formatCategories(event);
390 392
391 formatReadOnly(event);
392 formatAttendees(event); 393 formatAttendees(event);
393 394
394 if ( KOPrefs::instance()->mEVshowCreated ) { 395 if ( KOPrefs::instance()->mEVshowCreated ) {
395 if(wideScreen ){ 396 if(wideScreen ){
396 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 397 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
397 }else{ 398 }else{
398 addTag("p",i18n("<b>Created: ") +" </b>"); 399 addTag("p",i18n("<b>Created: ") +" </b>");
399 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 400 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
400 } 401 }
401 402
402 403
403 } 404 }
404 if ( KOPrefs::instance()->mEVshowChanged ) { 405 if ( KOPrefs::instance()->mEVshowChanged ) {
405 if(wideScreen ){ 406 if(wideScreen ){
406 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 407 addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
407 }else{ 408 }else{
408 addTag("p",i18n("<b>Last modified: ") +" </b>"); 409 addTag("p",i18n("<b>Last modified: ") +" </b>");
409 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 410 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
410 } 411 }
411 412
412 } 413 }
413 if ( KOPrefs::instance()->mEVshowDetails ) { 414 if ( KOPrefs::instance()->mEVshowDetails ) {
414 if (!event->description().isEmpty()) { 415 if (!event->description().isEmpty()) {
415 addTag("p",i18n("<b>Details: </b>")); 416 addTag("p",i18n("<b>Details: </b>"));
416 addTag("p",deTag(event->description())); 417 addTag("p",deTag(event->description()));
417 } 418 }
418 } 419 }
419 setText(mText); 420 setText(mText);
420 //QWhatsThis::add(this,mText); 421 //QWhatsThis::add(this,mText);
421 422
422} 423}
423 424
424void KOEventViewer::appendTodo(Todo *event, int mode ) 425void KOEventViewer::appendTodo(Todo *event, int mode )
425{ 426{
426 mMailSubject = ""; 427 mMailSubject = "";
427 mCurrentIncidence = event; 428 mCurrentIncidence = event;
428 topLevelWidget()->setCaption(i18n("Todo Viewer")); 429 topLevelWidget()->setCaption(i18n("Todo Viewer"));
429 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 430 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
430 bool wideScreen = ( QApplication::desktop()->width() >= 640 ); 431 bool wideScreen = ( QApplication::desktop()->width() >= 640 );
431 if (mode == 0 ) 432 if (mode == 0 ) {
432 addTag("h2",deTag(event->summary())); 433 addTag("h2",deTag(event->summary()));
434 formatReadOnly(event);
435 }
433 else { 436 else {
434 if ( mColorMode == 1 ) { 437 if ( mColorMode == 1 ) {
435 mText +="<font color=\"#00A000\">"; 438 mText +="<font color=\"#00A000\">";
436 } 439 }
437 if ( mColorMode == 2 ) { 440 if ( mColorMode == 2 ) {
438 mText +="<font color=\"#B00000\">"; 441 mText +="<font color=\"#B00000\">";
439 } 442 }
440 if ( mode == 1 ) { 443 if ( mode == 1 ) {
441 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 444 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
442 } else { 445 } else {
443 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 446 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
444 } 447 }
448 formatReadOnly(event);
445 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 449 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
446 if ( mColorMode ) 450 if ( mColorMode )
447 mText += "</font>"; 451 mText += "</font>";
448 } 452 }
449 mMailSubject += i18n( "Todo " )+ event->summary(); 453 mMailSubject += i18n( "Todo " )+ event->summary();
450 454
451 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 455 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
452 mText +="<font color=\"#B00000\">"; 456 mText +="<font color=\"#B00000\">";
453 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); 457 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
454 mText += "</font>"; 458 mText += "</font>";
455 } else { 459 } else {
456 mText.append(i18n("<p><i>%1 % completed</i></p>") 460 mText.append(i18n("<p><i>%1 % completed</i></p>")
457 .arg(event->percentComplete())); 461 .arg(event->percentComplete()));
458 } 462 }
459 463
460 if (event->cancelled ()) { 464 if (event->cancelled ()) {
461 mText +="<font color=\"#B00000\">"; 465 mText +="<font color=\"#B00000\">";
462 addTag("i",i18n("This todo has been cancelled!")); 466 addTag("i",i18n("This todo has been cancelled!"));
463 mText.append("<br>"); 467 mText.append("<br>");
464 mText += "</font>"; 468 mText += "</font>";
465 mMailSubject += i18n("(cancelled)"); 469 mMailSubject += i18n("(cancelled)");
466 } 470 }
467 471
468 472
@@ -482,49 +486,48 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
482 } 486 }
483 if (!event->location().isEmpty()) { 487 if (!event->location().isEmpty()) {
484 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 488 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
485 mMailSubject += i18n(" at ") + event->location(); 489 mMailSubject += i18n(" at ") + event->location();
486 } 490 }
487 mText.append(i18n("<p><b>Priority:</b> %2</p>") 491 mText.append(i18n("<p><b>Priority:</b> %2</p>")
488 .arg(QString::number(event->priority()))); 492 .arg(QString::number(event->priority())));
489 493
490 if (event->isAlarmEnabled()) { 494 if (event->isAlarmEnabled()) {
491 Alarm *alarm =event->alarms().first() ; 495 Alarm *alarm =event->alarms().first() ;
492 QDateTime t = alarm->time(); 496 QDateTime t = alarm->time();
493 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 497 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
494 if ( wideScreen ) { 498 if ( wideScreen ) {
495 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); 499 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
496 } else { 500 } else {
497 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 501 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
498 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 502 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
499 } 503 }
500 } 504 }
501 505
502 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); 506 addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
503 507
504 formatCategories(event); 508 formatCategories(event);
505 509
506 formatReadOnly(event);
507 formatAttendees(event); 510 formatAttendees(event);
508 511
509 if ( KOPrefs::instance()->mEVshowCreated ) { 512 if ( KOPrefs::instance()->mEVshowCreated ) {
510 if(wideScreen ){ 513 if(wideScreen ){
511 514
512 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 515 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
513 516
514 } else { 517 } else {
515 addTag("p",i18n("<b>Created: ") +" </b>"); 518 addTag("p",i18n("<b>Created: ") +" </b>");
516 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 519 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
517 } 520 }
518 } 521 }
519 if ( KOPrefs::instance()->mEVshowChanged ) { 522 if ( KOPrefs::instance()->mEVshowChanged ) {
520 if(wideScreen ){ 523 if(wideScreen ){
521 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); 524 addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
522 525
523 } else { 526 } else {
524 addTag("p",i18n("<b>Last modified: ") +" </b>"); 527 addTag("p",i18n("<b>Last modified: ") +" </b>");
525 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 528 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
526 } 529 }
527 } 530 }
528 if ( event->relatedTo() ) { 531 if ( event->relatedTo() ) {
529 addTag("b",i18n("Parent todo:<br>")); 532 addTag("b",i18n("Parent todo:<br>"));
530 mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); 533 mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 475bb4a..cba85fa 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -294,111 +294,107 @@ MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
294} 294}
295void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) 295void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s)
296{ 296{
297 setText( s ); 297 setText( s );
298 mMultiday = 0; 298 mMultiday = 0;
299 mIncidence = incidence; 299 mIncidence = incidence;
300 mDate = qd; 300 mDate = qd;
301 mRecur = false; 301 mRecur = false;
302 mAlarm = false; 302 mAlarm = false;
303 mReply = false; 303 mReply = false;
304 mInfo = false; 304 mInfo = false;
305 mdayPos = 0; 305 mdayPos = 0;
306} 306}
307 307
308void MonthViewItem::paint(QPainter *p) 308void MonthViewItem::paint(QPainter *p)
309{ 309{
310 if ( mblockRepaint ) { 310 if ( mblockRepaint ) {
311 return; 311 return;
312 } 312 }
313#if QT_VERSION >= 0x030000 313#if QT_VERSION >= 0x030000
314 bool sel = isSelected(); 314 bool sel = isSelected();
315#else 315#else
316 bool sel = selected(); 316 bool sel = selected();
317#endif 317#endif
318
319
320 int heihei = height( listBox () ); 318 int heihei = height( listBox () );
321 int x = 1; 319 int x = 1;
322 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 320 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
323 { 321 {
324 p->setBackgroundColor( palette().color( QPalette::Normal, \ 322 p->setBackgroundColor( palette().color( QPalette::Normal, \
325 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 323 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
326 p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); 324 p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei );
327 } 325 }
328 326
329 //int y = 3;//(height() - mRecurPixmap.height()) /2; 327 //int y = 3;//(height() - mRecurPixmap.height()) /2;
330 int size = PIXMAP_SIZE; 328 int size = PIXMAP_SIZE;
331 if ( QApplication::desktop()->width() < 300 ) 329 if ( QApplication::desktop()->width() < 300 )
332 size = 3; 330 size = 3;
333 int y = (heihei - size -1 ) /2; 331 int y = (heihei - size -1 ) /2;
334 332
335 if ( mIncidence->calID() > 1 ) { 333 if ( mIncidence->calID() > 1 ) {
336 p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); 334 p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) );
337 p->drawRect ( x, y-2,size,size+4); 335 p->drawRect ( x, y-2,size,size+4);
338 x += size + 1; 336 x += size + 1;
339 } 337 }
340
341 if ( KOPrefs::instance()->mMonthShowIcons ) { 338 if ( KOPrefs::instance()->mMonthShowIcons ) {
342 if ( mInfo ) { 339 if ( mInfo ) {
343 p->fillRect ( x, y,size,size, Qt::darkGreen ); 340 p->fillRect ( x, y,size,size, Qt::darkGreen );
344 x += size + 1; 341 x += size + 1;
345 } 342 }
346 if ( mRecur ) { 343 if ( mRecur ) {
347 p->fillRect ( x, y,size,size, Qt::blue ); 344 p->fillRect ( x, y,size,size, Qt::blue );
348 x += size + 1; 345 x += size + 1;
349 } 346 }
350 if ( mAlarm ) { 347 if ( mAlarm ) {
351 p->fillRect ( x, y,size,size, Qt::red ); 348 p->fillRect ( x, y,size,size, Qt::red );
352 x += size + 1; 349 x += size + 1;
353 } 350 }
354 if ( mReply ) { 351 if ( mReply ) {
355 p->fillRect ( x, y,size,size, Qt::yellow ); 352 p->fillRect ( x, y,size,size, Qt::yellow );
356 x += size + 1; 353 x += size + 1;
357 } 354 }
358 } 355 }
359 if ( mMultiday ) { 356 if ( mMultiday ) {
360 int yyy = y+(size/2); 357 int yyy = y+(size/2);
361 int sizeM = size+2; 358 int sizeM = size+2;
362 p->setBrush( QBrush::SolidPattern ); 359 p->setBrush( QBrush::SolidPattern );
363 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 360 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
364 if ( mMultiday == 2 || mMultiday == 3 ) { 361 if ( mMultiday == 2 || mMultiday == 3 ) {
365 QPointArray pa ( 3 ); 362 QPointArray pa ( 3 );
366 pa.setPoint (0, x, yyy ); 363 pa.setPoint (0, x, yyy );
367 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 364 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
368 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 365 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
369 p->drawPolygon( pa ); 366 p->drawPolygon( pa );
370 } 367 }
371 if ( mMultiday == 2 || mMultiday == 1 ) { 368 if ( mMultiday == 2 || mMultiday == 1 ) {
372 QPointArray pa ( 3 ); 369 QPointArray pa ( 3 );
373 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 370 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
374 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 371 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
375 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 372 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
376 p->drawPolygon( pa ); 373 p->drawPolygon( pa );
377 } 374 }
378 if ( mMultiday == 1 ) { 375 if ( mMultiday == 1 ) {
379 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 376 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
380
381 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 377 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
382 } 378 }
383 if ( mMultiday == 3 ) { 379 if ( mMultiday == 3 ) {
384 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 380 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
385 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 381 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
386 382
387 } 383 }
388 x += sizeM/2 + 1; 384 x += sizeM/2 + 1;
389 x += sizeM + 1; 385 x += sizeM + 1;
390 } 386 }
391 387
392 if ( mIncidence->typeID() == todoID ){ 388 if ( mIncidence->typeID() == todoID ){
393 Todo* td = ( Todo* ) mIncidence; 389 Todo* td = ( Todo* ) mIncidence;
394 if ( td->isCompleted() ) { 390 if ( td->isCompleted() ) {
395 int half = size/2; 391 int half = size/2;
396 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; 392 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
397 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; 393 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
398 x += half+half + 4; 394 x += half+half + 4;
399 395
400 } else { 396 } else {
401 int val = td->percentComplete()/20; 397 int val = td->percentComplete()/20;
402 p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); 398 p->fillRect ( x+1, y-2, val ,size+4,Qt::black );
403 p->drawRect ( x, y-2,7,size+4); 399 p->drawRect ( x, y-2,7,size+4);
404 x += size + 3; 400 x += size + 3;
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index d1ace4f..9359fad 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -31,62 +31,64 @@ QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bo
31KIncidenceFormatter* KIncidenceFormatter::instance() 31KIncidenceFormatter* KIncidenceFormatter::instance()
32{ 32{
33 if (!mInstance) { 33 if (!mInstance) {
34 mInstance = insd.setObject(new KIncidenceFormatter()); 34 mInstance = insd.setObject(new KIncidenceFormatter());
35 } 35 }
36 return mInstance; 36 return mInstance;
37} 37}
38KIncidenceFormatter::~KIncidenceFormatter() 38KIncidenceFormatter::~KIncidenceFormatter()
39{ 39{
40 if (mInstance == this) 40 if (mInstance == this)
41 mInstance = insd.setObject(0); 41 mInstance = insd.setObject(0);
42 //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); 42 //qDebug("KIncidenceFormatter::~KIncidenceFormatter ");
43} 43}
44KIncidenceFormatter::KIncidenceFormatter() 44KIncidenceFormatter::KIncidenceFormatter()
45{ 45{
46 mColorMode = 0; 46 mColorMode = 0;
47} 47}
48void KIncidenceFormatter::setEvent(Event *event) 48void KIncidenceFormatter::setEvent(Event *event)
49{ 49{
50 int mode = 0; 50 int mode = 0;
51 mCurrentIncidence = event; 51 mCurrentIncidence = event;
52 bool shortDate = true; 52 bool shortDate = true;
53 if ( mode == 0 ) { 53 if ( mode == 0 ) {
54 addTag("h3",deTag(event->summary())); 54 addTag("h3",deTag(event->summary()));
55 formatReadOnly(event);
55 } 56 }
56 else { 57 else {
57 if ( mColorMode == 1 ) { 58 if ( mColorMode == 1 ) {
58 mText +="<font color=\"#00A000\">"; 59 mText +="<font color=\"#00A000\">";
59 } 60 }
60 if ( mColorMode == 2 ) { 61 if ( mColorMode == 2 ) {
61 mText +="<font color=\"#C00000\">"; 62 mText +="<font color=\"#C00000\">";
62 } 63 }
63 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 64 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
64 if ( mode == 1 ) { 65 if ( mode == 1 ) {
65 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 66 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
66 } else { 67 } else {
67 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 68 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
68 } 69 }
70 formatReadOnly(event);
69 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 71 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
70 if ( mColorMode ) 72 if ( mColorMode )
71 mText += "</font>"; 73 mText += "</font>";
72 } 74 }
73 if (event->cancelled ()) { 75 if (event->cancelled ()) {
74 mText +="<font color=\"#B00000\">"; 76 mText +="<font color=\"#B00000\">";
75 addTag("i",i18n("This event has been cancelled!")); 77 addTag("i",i18n("This event has been cancelled!"));
76 mText.append("<br>"); 78 mText.append("<br>");
77 mText += "</font>"; 79 mText += "</font>";
78 } 80 }
79 if (event->doesFloat()) { 81 if (event->doesFloat()) {
80 if (event->isMultiDay()) { 82 if (event->isMultiDay()) {
81 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 83 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
82 .arg(event->dtStartDateStr(shortDate)) 84 .arg(event->dtStartDateStr(shortDate))
83 .arg(event->dtEndDateStr(shortDate))); 85 .arg(event->dtEndDateStr(shortDate)));
84 } else { 86 } else {
85 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 87 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
86 } 88 }
87 } else { 89 } else {
88 if (event->isMultiDay()) { 90 if (event->isMultiDay()) {
89 mText.append(i18n("<p><b>From:</b> %1</p> ") 91 mText.append(i18n("<p><b>From:</b> %1</p> ")
90 .arg(event->dtStartStr( shortDate))); 92 .arg(event->dtStartStr( shortDate)));
91 mText.append(i18n("<p><b>To:</b> %1</p>") 93 mText.append(i18n("<p><b>To:</b> %1</p>")
92 .arg(event->dtEndStr(shortDate))); 94 .arg(event->dtEndStr(shortDate)));
@@ -122,97 +124,99 @@ void KIncidenceFormatter::setEvent(Event *event)
122 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 124 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
123 if ( last ) { 125 if ( last ) {
124 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 126 addTag("p",i18n("<b>Last recurrence was on:</b>") );
125 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 127 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
126 } 128 }
127 } 129 }
128 } 130 }
129 131
130 132
131 if (event->isAlarmEnabled()) { 133 if (event->isAlarmEnabled()) {
132 Alarm *alarm =event->alarms().first() ; 134 Alarm *alarm =event->alarms().first() ;
133 QDateTime t = alarm->time(); 135 QDateTime t = alarm->time();
134 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 136 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
135 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); 137 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
136 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 138 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
137 //addTag("p",s); 139 //addTag("p",s);
138 } 140 }
139 141
140 142
141 143
142 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 144 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
143 // mText.append(event->secrecyStr()+"<br>"); 145 // mText.append(event->secrecyStr()+"<br>");
144 formatCategories(event); 146 formatCategories(event);
145 147
146 formatReadOnly(event);
147 formatAttendees(event); 148 formatAttendees(event);
148 149
149 if ( mCreated ) { 150 if ( mCreated ) {
150#ifdef DESKTOP_VERSION 151#ifdef DESKTOP_VERSION
151 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 152 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
152#else 153#else
153 addTag("p",i18n("<b>Created: ") +" </b>"); 154 addTag("p",i18n("<b>Created: ") +" </b>");
154 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 155 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
155#endif 156#endif
156 157
157 } 158 }
158 if ( mModified ) { 159 if ( mModified ) {
159#ifdef DESKTOP_VERSION 160#ifdef DESKTOP_VERSION
160 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 161 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
161#else 162#else
162 addTag("p",i18n("<b>Last modified: ") +" </b>"); 163 addTag("p",i18n("<b>Last modified: ") +" </b>");
163 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 164 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
164#endif 165#endif
165 166
166 } 167 }
167 if ( mDetails ) { 168 if ( mDetails ) {
168 if (!event->description().isEmpty()) { 169 if (!event->description().isEmpty()) {
169 addTag("p",i18n("<b>Details: </b>")); 170 addTag("p",i18n("<b>Details: </b>"));
170 addTag("p",deTag(event->description())); 171 addTag("p",deTag(event->description()));
171 } 172 }
172 } 173 }
173 174
174} 175}
175 176
176void KIncidenceFormatter::setTodo(Todo *event ) 177void KIncidenceFormatter::setTodo(Todo *event )
177{ 178{
178 int mode = 0; 179 int mode = 0;
179 mCurrentIncidence = event; 180 mCurrentIncidence = event;
180 bool shortDate = true; 181 bool shortDate = true;
181 if (mode == 0 ) 182 if (mode == 0 ) {
182 addTag("h3",deTag(event->summary())); 183 addTag("h3",deTag(event->summary()));
184 formatReadOnly(event);
185 }
183 else { 186 else {
184 if ( mColorMode == 1 ) { 187 if ( mColorMode == 1 ) {
185 mText +="<font color=\"#00A000\">"; 188 mText +="<font color=\"#00A000\">";
186 } 189 }
187 if ( mColorMode == 2 ) { 190 if ( mColorMode == 2 ) {
188 mText +="<font color=\"#B00000\">"; 191 mText +="<font color=\"#B00000\">";
189 } 192 }
190 if ( mode == 1 ) { 193 if ( mode == 1 ) {
191 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 194 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
192 } else { 195 } else {
193 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 196 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
194 } 197 }
198 formatReadOnly(event);
195 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 199 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
196 if ( mColorMode ) 200 if ( mColorMode )
197 mText += "</font>"; 201 mText += "</font>";
198 } 202 }
199 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 203 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
200 mText +="<font color=\"#B00000\">"; 204 mText +="<font color=\"#B00000\">";
201 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); 205 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) );
202 mText += "</font>"; 206 mText += "</font>";
203 } else { 207 } else {
204 mText.append(i18n("<p><i>%1 % completed</i></p>") 208 mText.append(i18n("<p><i>%1 % completed</i></p>")
205 .arg(event->percentComplete())); 209 .arg(event->percentComplete()));
206 } 210 }
207 if (event->cancelled ()) { 211 if (event->cancelled ()) {
208 mText +="<font color=\"#B00000\">"; 212 mText +="<font color=\"#B00000\">";
209 addTag("i",i18n("This todo has been cancelled!")); 213 addTag("i",i18n("This todo has been cancelled!"));
210 mText.append("<br>"); 214 mText.append("<br>");
211 mText += "</font>"; 215 mText += "</font>";
212 } 216 }
213 217
214 218
215 if (event->recurrence()->doesRecur()) { 219 if (event->recurrence()->doesRecur()) {
216 220
217 QString recurText = event->recurrence()->recurrenceText(); 221 QString recurText = event->recurrence()->recurrenceText();
218 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 222 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
@@ -226,49 +230,48 @@ void KIncidenceFormatter::setTodo(Todo *event )
226 if (event->hasDueDate()) { 230 if (event->hasDueDate()) {
227 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); 231 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
228 } 232 }
229 233
230 if (!event->location().isEmpty()) { 234 if (!event->location().isEmpty()) {
231 addTag("b",i18n("Location: ")); 235 addTag("b",i18n("Location: "));
232 mText.append(deTag(event->location())+"<br>"); 236 mText.append(deTag(event->location())+"<br>");
233 } 237 }
234 238
235 mText.append(i18n("<p><b>Priority:</b> %2</p>") 239 mText.append(i18n("<p><b>Priority:</b> %2</p>")
236 .arg(QString::number(event->priority()))); 240 .arg(QString::number(event->priority())));
237 241
238 if (event->isAlarmEnabled()) { 242 if (event->isAlarmEnabled()) {
239 Alarm *alarm =event->alarms().first() ; 243 Alarm *alarm =event->alarms().first() ;
240 QDateTime t = alarm->time(); 244 QDateTime t = alarm->time();
241 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 245 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
242 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 246 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
243 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 247 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
244 //addTag("p",s); 248 //addTag("p",s);
245 } 249 }
246 250
247 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 251 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
248 formatCategories(event); 252 formatCategories(event);
249 253
250 formatReadOnly(event);
251 formatAttendees(event); 254 formatAttendees(event);
252 if ( mCreated ) { 255 if ( mCreated ) {
253#ifdef DESKTOP_VERSION 256#ifdef DESKTOP_VERSION
254 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 257 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
255#else 258#else
256 addTag("p",i18n("<b>Created: ") +" </b>"); 259 addTag("p",i18n("<b>Created: ") +" </b>");
257 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 260 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
258#endif 261#endif
259 262
260 } 263 }
261 if ( mModified ) { 264 if ( mModified ) {
262#ifdef DESKTOP_VERSION 265#ifdef DESKTOP_VERSION
263 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 266 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
264#else 267#else
265 addTag("p",i18n("<b>Last modified: ") +" </b>"); 268 addTag("p",i18n("<b>Last modified: ") +" </b>");
266 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 269 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
267#endif 270#endif
268 271
269 } 272 }
270 if ( mDetails ) { 273 if ( mDetails ) {
271 if (!event->description().isEmpty()) { 274 if (!event->description().isEmpty()) {
272 addTag("p",i18n("<b>Details: </b>")); 275 addTag("p",i18n("<b>Details: </b>"));
273 addTag("p",deTag(event->description())); 276 addTag("p",deTag(event->description()));
274 } 277 }