summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaitem.cpp
Unidiff
Diffstat (limited to 'korganizer/koagendaitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 9fe1be4..abb29f7 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -251,386 +251,382 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
251 if (mIncidence->isReadOnly()) { 251 if (mIncidence->isReadOnly()) {
252 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 252 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
253 if ( horLayout ) 253 if ( horLayout )
254 ++xOff; 254 ++xOff;
255 else 255 else
256 ++yOff; 256 ++yOff;
257 } 257 }
258 258
259 if (mIncidence->attendeeCount()>0) { 259 if (mIncidence->attendeeCount()>0) {
260 260
261 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 261 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
262 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 262 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
263 if ( horLayout ) 263 if ( horLayout )
264 ++xOff; 264 ++xOff;
265 else 265 else
266 ++yOff; 266 ++yOff;
267 } else { 267 } else {
268 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 268 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
269 if (me!=0) { 269 if (me!=0) {
270 270
271 271
272 } else { 272 } else {
273 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 273 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
274 if ( horLayout ) 274 if ( horLayout )
275 ++xOff; 275 ++xOff;
276 else 276 else
277 ++yOff; 277 ++yOff;
278 278
279 } 279 }
280 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 280 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
281 if ( horLayout ) 281 if ( horLayout )
282 ++xOff; 282 ++xOff;
283 else 283 else
284 ++yOff; 284 ++yOff;
285 285
286 } 286 }
287 287
288 } 288 }
289 return ( yOff || xOff ); 289 return ( yOff || xOff );
290} 290}
291 291
292 292
293void KOAgendaItem::select(bool selected) 293void KOAgendaItem::select(bool selected)
294{ 294{
295 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); 295 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
296 if (mSelected == selected) return; 296 if (mSelected == selected) return;
297 mSelected = selected; 297 mSelected = selected;
298 if ( ! isVisible() ) 298 if ( ! isVisible() )
299 return; 299 return;
300 if ( firstMultiItem() ) 300 if ( firstMultiItem() )
301 firstMultiItem()->select( selected ); 301 firstMultiItem()->select( selected );
302 if ( !firstMultiItem() && nextMultiItem() ) { 302 if ( !firstMultiItem() && nextMultiItem() ) {
303 KOAgendaItem * placeItem = nextMultiItem(); 303 KOAgendaItem * placeItem = nextMultiItem();
304 while ( placeItem ) { 304 while ( placeItem ) {
305 placeItem->select( selected ); 305 placeItem->select( selected );
306 placeItem = placeItem->nextMultiItem(); 306 placeItem = placeItem->nextMultiItem();
307 } 307 }
308 } 308 }
309 globalFlagBlockAgendaItemUpdate = 0; 309 globalFlagBlockAgendaItemUpdate = 0;
310 paintMe( selected ); 310 paintMe( selected );
311 globalFlagBlockAgendaItemUpdate = 1; 311 globalFlagBlockAgendaItemUpdate = 1;
312 repaint( false ); 312 repaint( false );
313} 313}
314 314
315 315
316/* 316/*
317 The eventFilter has to filter the mouse events of the agenda item childs. The 317 The eventFilter has to filter the mouse events of the agenda item childs. The
318 events are fed into the event handling method of KOAgendaItem. This allows the 318 events are fed into the event handling method of KOAgendaItem. This allows the
319 KOAgenda to handle the KOAgendaItems by using an eventFilter. 319 KOAgenda to handle the KOAgendaItems by using an eventFilter.
320*/ 320*/
321bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) 321bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e )
322{ 322{
323 if (e->type() == QEvent::MouseButtonPress || 323 if (e->type() == QEvent::MouseButtonPress ||
324 e->type() == QEvent::MouseButtonDblClick || 324 e->type() == QEvent::MouseButtonDblClick ||
325 e->type() == QEvent::MouseButtonRelease || 325 e->type() == QEvent::MouseButtonRelease ||
326 e->type() == QEvent::MouseMove) { 326 e->type() == QEvent::MouseMove) {
327 QMouseEvent *me = (QMouseEvent *)e; 327 QMouseEvent *me = (QMouseEvent *)e;
328 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> 328 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)->
329 mapToGlobal(me->pos())); 329 mapToGlobal(me->pos()));
330 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); 330 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state());
331 return event(&returnEvent); 331 return event(&returnEvent);
332 } else { 332 } else {
333 return false; 333 return false;
334 } 334 }
335} 335}
336void KOAgendaItem::repaintMe( ) 336void KOAgendaItem::repaintMe( )
337{ 337{
338 paintMe ( mSelected ); 338 paintMe ( mSelected );
339} 339}
340void KOAgendaItem::paintMe( bool selected, QPainter* paint ) 340void KOAgendaItem::paintMe( bool selected, QPainter* paint )
341{ 341{
342 if ( globalFlagBlockAgendaItemUpdate && ! selected) 342 if ( globalFlagBlockAgendaItemUpdate && ! selected)
343 return; 343 return;
344 QPainter pa; 344 QPainter pa;
345 345
346 if ( mSelected ) { 346 if ( mSelected ) {
347 pa.begin( paintPixSel() ); 347 pa.begin( this );
348 } else { 348 } else {
349 if ( mAllDay ) 349 if ( mAllDay )
350 pa.begin( paintPixAllday() ); 350 pa.begin( paintPixAllday() );
351 else 351 else
352 pa.begin( paintPix() ); 352 pa.begin( paintPix() );
353 } 353 }
354 int x, yy, w, h; 354 int x, yy, w, h;
355 float nfh = 7.0; 355 float nfh = 7.0;
356 x = pos().x(); w = width(); h = height (); 356 x = pos().x(); w = width(); h = height ();
357 if ( mAllDay ) 357 if ( mAllDay )
358 yy = y(); 358 yy = y();
359 else 359 else
360 yy = mCellYTop * ( height() / cellHeight() ); 360 yy = mCellYTop * ( height() / cellHeight() );
361 if ( mSelected ) {
362 pa.translate( -x, -yy );
363 }
361 xPaintCoord= x; 364 xPaintCoord= x;
362 yPaintCoord = yy; 365 yPaintCoord = yy;
363 wPaintCoord = width(); 366 wPaintCoord = width();
364 hPaintCoord = height(); 367 hPaintCoord = height();
365 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); 368 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height());
366 if ( paint == 0 ) 369 if ( paint == 0 )
367 paint = &pa; 370 paint = &pa;
368 bool horLayout = ( w < h ); 371 bool horLayout = ( w < h );
369 int maxhei = mFontPixelSize+4; 372 int maxhei = mFontPixelSize+4;
370 if ( horLayout ) 373 if ( horLayout )
371 maxhei += AGENDA_ICON_SIZE -4; 374 maxhei += AGENDA_ICON_SIZE -4;
372 bool small = ( h < maxhei ); 375 bool small = ( h < maxhei );
373 if ( ! small ) 376 if ( ! small )
374 paint->setFont(KOPrefs::instance()->mAgendaViewFont); 377 paint->setFont(KOPrefs::instance()->mAgendaViewFont);
375 else { 378 else {
376 QFont f = KOPrefs::instance()->mAgendaViewFont; 379 QFont f = KOPrefs::instance()->mAgendaViewFont;
377 f.setBold( false ); 380 f.setBold( false );
378 int fh = f.pointSize(); 381 int fh = f.pointSize();
379 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; 382 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh;
380 if ( nfh < 6 ) 383 if ( nfh < 6 )
381 nfh = 6; 384 nfh = 6;
382 f.setPointSize( nfh ); 385 f.setPointSize( nfh );
383 paint->setFont(f); 386 paint->setFont(f);
384 } 387 }
385 paint->fillRect ( x, yy, w, h, mBackgroundColor ); 388 paint->fillRect ( x, yy, w, h, mBackgroundColor );
386 static const QPixmap completedPxmp = SmallIcon("greenhook16"); 389 static const QPixmap completedPxmp = SmallIcon("greenhook16");
387 static const QPixmap overduePxmp = SmallIcon("redcross16"); 390 static const QPixmap overduePxmp = SmallIcon("redcross16");
388 if ( mIncidence->typeID() == todoID ) { 391 if ( mIncidence->typeID() == todoID ) {
389 Todo* tempTodo = static_cast<Todo*>(mIncidence); 392 Todo* tempTodo = static_cast<Todo*>(mIncidence);
390 int xx = pos().x()+(width()-completedPxmp.width()-3 ); 393 int xx = pos().x()+(width()-completedPxmp.width()-3 );
391 int yyy = yy+3; 394 int yyy = yy+3;
392 if ( tempTodo->isCompleted() ) 395 if ( tempTodo->isCompleted() )
393 paint->drawPixmap ( xx, yyy, completedPxmp ); 396 paint->drawPixmap ( xx, yyy, completedPxmp );
394 else { 397 else {
395 paint->drawPixmap ( xx, yyy, overduePxmp ); 398 paint->drawPixmap ( xx, yyy, overduePxmp );
396 399
397 } 400 }
398 } 401 }
399 bool addIcon = false; 402 bool addIcon = false;
400 if ( ! small || w > 3 * h || h > 3* w ) 403 if ( ! small || w > 3 * h || h > 3* w )
401 addIcon = updateIcons( paint, horLayout ); 404 addIcon = updateIcons( paint, horLayout );
402 405
403 //qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); 406 //qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
404 qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0); 407 qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0);
405 //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); 408 //qDebug("draw rect %d %d %d %d ",x, yy, w, h );
406 if ( ! small ) { 409 if ( ! small ) {
407 x += 3; yy += 3;w -= 6; h-= 5; 410 x += 3; yy += 3;w -= 6; h-= 5;
408 } else { 411 } else {
409 x += 2; yy += 1;w -= 4; h-= 4; 412 x += 2; yy += 1;w -= 4; h-= 4;
410 if ( nfh < 6.01 ) { 413 if ( nfh < 6.01 ) {
411 yy -= 2; 414 yy -= 2;
412 h += 4; 415 h += 4;
413 } 416 }
414 else 417 else
415 if ( nfh < h -2 ) 418 if ( nfh < h -2 )
416 ++yy; 419 ++yy;
417 } 420 }
418 int align; 421 int align;
419#ifndef DESKTOP_VERSION 422#ifndef DESKTOP_VERSION
420 align = ( AlignLeft|WordBreak|AlignTop); 423 align = ( AlignLeft|WordBreak|AlignTop);
421#else 424#else
422 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 425 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
423#endif 426#endif
424 if ( addIcon ) { 427 if ( addIcon ) {
425 if ( ! horLayout ) { 428 if ( ! horLayout ) {
426 x += AGENDA_ICON_SIZE+3; 429 x += AGENDA_ICON_SIZE+3;
427 w -= (AGENDA_ICON_SIZE+3); 430 w -= (AGENDA_ICON_SIZE+3);
428 } 431 }
429 else { 432 else {
430 yy+= AGENDA_ICON_SIZE+2; 433 yy+= AGENDA_ICON_SIZE+2;
431 h -=(AGENDA_ICON_SIZE+3); 434 h -=(AGENDA_ICON_SIZE+3);
432 } 435 }
433 } 436 }
434 if ( mWhiteText ) 437 if ( mWhiteText )
435 paint->setPen ( white); 438 paint->setPen ( white);
436 if ( x < 0 ) { 439 if ( x < 0 ) {
437 w = w+x-3; 440 w = w+x-3;
438 x = 3; 441 x = 3;
439 if ( !horLayout && addIcon ) 442 if ( !horLayout && addIcon )
440 x += AGENDA_ICON_SIZE+3; 443 x += AGENDA_ICON_SIZE+3;
441 if ( w > parentWidget()->width() ){ 444 if ( w > parentWidget()->width() ){
442 w = parentWidget()->width() - 6; 445 w = parentWidget()->width() - 6;
443#ifndef DESKTOP_VERSION 446#ifndef DESKTOP_VERSION
444 align = ( AlignHCenter|WordBreak|AlignTop); 447 align = ( AlignHCenter|WordBreak|AlignTop);
445#else 448#else
446 align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); 449 align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop);
447#endif 450#endif
448 451
449 } 452 }
450 } 453 }
451 QRect dr; 454 QRect dr;
452 if ( w + x > parentWidget()->width() ) 455 if ( w + x > parentWidget()->width() )
453 w = parentWidget()->width()-x; 456 w = parentWidget()->width()-x;
454 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); 457 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
455 //qDebug("%d %d %d %d ", x, yy, w, h ); 458 //qDebug("%d %d %d %d ", x, yy, w, h );
456 if ( mIncidence->cancelled() ){ 459 if ( mIncidence->cancelled() ){
457 460
458 461
459 small = ( height() < 20 ); 462 small = ( height() < 20 );
460 463
461 if ( ! small ) { 464 if ( ! small ) {
462 QFontMetrics fm ( paint->font() ); 465 QFontMetrics fm ( paint->font() );
463 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); 466 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
464 } 467 }
465 468
466 } 469 }
467 pa.end(); 470 pa.end();
468 471
469} 472}
470void KOAgendaItem::resizePixmap( int w , int h ) 473void KOAgendaItem::resizePixmap( int w , int h )
471{ 474{
472 paintPix()->resize( w, h ); 475 paintPix()->resize( w, h );
473 paintPixSel()->resize( w, h );
474 476
475} 477}
476QPixmap * KOAgendaItem::paintPix() 478QPixmap * KOAgendaItem::paintPix()
477{ 479{
478 static QPixmap* mPaintPix = 0; 480 static QPixmap* mPaintPix = 0;
479 if ( ! mPaintPix ) { 481 if ( ! mPaintPix ) {
480 int w = QApplication::desktop()->width(); 482 int w = QApplication::desktop()->width();
481 int h = QApplication::desktop()->height(); 483 int h = QApplication::desktop()->height();
482 mPaintPix = new QPixmap(w,h); 484 mPaintPix = new QPixmap(w,h);
483 } 485 }
484 return mPaintPix ; 486 return mPaintPix ;
485} 487}
486QPixmap * KOAgendaItem::paintPixAllday() 488QPixmap * KOAgendaItem::paintPixAllday()
487{ 489{
488 static QPixmap* mPaintPixA = 0; 490 static QPixmap* mPaintPixA = 0;
489 if ( ! mPaintPixA ) { 491 if ( ! mPaintPixA ) {
490 int w = QApplication::desktop()->width(); 492 int w = QApplication::desktop()->width();
491 int h = QApplication::desktop()->height()/3; 493 int h = QApplication::desktop()->height()/3;
492 mPaintPixA = new QPixmap(w,h); 494 mPaintPixA = new QPixmap(w,h);
493 } 495 }
494 return mPaintPixA ; 496 return mPaintPixA ;
495} 497}
496QPixmap * KOAgendaItem::paintPixSel() 498
497{
498 static QPixmap* mPaintPixSel = 0;
499 if ( ! mPaintPixSel ) {
500 int w = QApplication::desktop()->width();
501 int h = QApplication::desktop()->height();
502 mPaintPixSel = new QPixmap(w,h);
503 }
504 return mPaintPixSel ;
505}
506void KOAgendaItem::paintEvent ( QPaintEvent *e ) 499void KOAgendaItem::paintEvent ( QPaintEvent *e )
507{ 500{
508 501
509 if ( globalFlagBlockAgendaItemPaint ) 502 if ( globalFlagBlockAgendaItemPaint )
510 return; 503 return;
511 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) 504 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
512 return; 505 return;
513 int yy; 506 int yy;
514 if ( mAllDay ) 507 if ( mAllDay )
515 yy = y(); 508 yy = y();
516 else 509 else
517 yy = mCellYTop * ( height() / cellHeight() ); 510 yy = mCellYTop * ( height() / cellHeight() );
518 int xx = x(); 511 int xx = x();
519 512
520 if ( xPaintCoord != xx || yPaintCoord != yy || 513 if ( xPaintCoord != xx || yPaintCoord != yy ||
521 wPaintCoord != width() || hPaintCoord != height()) { 514 wPaintCoord != width() || hPaintCoord != height()) {
522 xPaintCoord= xx; 515 xPaintCoord= xx;
523 yPaintCoord = yy; 516 yPaintCoord = yy;
524 wPaintCoord = width(); 517 wPaintCoord = width();
525 hPaintCoord = height(); 518 hPaintCoord = height();
526 globalFlagBlockAgendaItemUpdate = 0; 519 globalFlagBlockAgendaItemUpdate = 0;
527 paintMe( mSelected ); 520 paintMe( mSelected );
528 //qDebug("calling paintMe "); 521 //qDebug("calling paintMe ");
529 globalFlagBlockAgendaItemUpdate = 1; 522 globalFlagBlockAgendaItemUpdate = 1;
523 if ( mSelected )
524 return;
530 } 525 }
531 int rx, ry, rw, rh; 526 int rx, ry, rw, rh;
532 rx = e->rect().x(); 527 rx = e->rect().x();
533 ry = e->rect().y(); 528 ry = e->rect().y();
534 rw = e->rect().width(); 529 rw = e->rect().width();
535 rh = e->rect().height(); 530 rh = e->rect().height();
536 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); 531 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
537 532
538 QPixmap* paintFrom ; 533 QPixmap* paintFrom ;
539 if ( mSelected ) { 534 if ( mSelected ) {
540 paintFrom = paintPixSel(); 535 paintMe( mSelected );
536 return;
541 } else { 537 } else {
542 if ( mAllDay ) 538 if ( mAllDay )
543 paintFrom = paintPixAllday(); 539 paintFrom = paintPixAllday();
544 else 540 else
545 paintFrom = paintPix(); 541 paintFrom = paintPix();
546 } 542 }
547 xx += rx; 543 xx += rx;
548 544
549 if ( xx < 0 ) { 545 if ( xx < 0 ) {
550 rw = rw + xx; 546 rw = rw + xx;
551 rx -= xx; 547 rx -= xx;
552 xx = 0; 548 xx = 0;
553 if ( rw <= 1 ) { 549 if ( rw <= 1 ) {
554 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); 550 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1());
555 return; 551 return;
556 } 552 }
557 } 553 }
558 if ( paintFrom->width() < xx+rw ) { 554 if ( paintFrom->width() < xx+rw ) {
559 rw = paintFrom->width() - xx; 555 rw = paintFrom->width() - xx;
560 if ( rw <= 1 ) { 556 if ( rw <= 1 ) {
561 //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); 557 //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() );
562 return; 558 return;
563 } 559 }
564 } 560 }
565 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); 561 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh);
566 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); 562 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP);
567} 563}
568void KOAgendaItem::computeText() 564void KOAgendaItem::computeText()
569{ 565{
570 mDisplayedText = mIncidence->summary(); 566 mDisplayedText = mIncidence->summary();
571 if ( (mIncidence->typeID() == todoID ) ) { 567 if ( (mIncidence->typeID() == todoID ) ) {
572 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { 568 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
573 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 569 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
574 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 570 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
575 else if ( !(mIncidence->doesFloat())) 571 else if ( !(mIncidence->doesFloat()))
576 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; 572 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
577 } 573 }
578 } else { 574 } else {
579 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) 575 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
580 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; 576 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
581 577
582 if ( mAllDay ) { 578 if ( mAllDay ) {
583 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { 579 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
584 if ( mIncidence->doesRecur() ) { 580 if ( mIncidence->doesRecur() ) {
585 mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; 581 mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")";
586 } else { 582 } else {
587 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; 583 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
588 } 584 }
589 } 585 }
590 } 586 }
591 } 587 }
592 588
593 if ( !mIncidence->location().isEmpty() ) { 589 if ( !mIncidence->location().isEmpty() ) {
594 if ( mAllDay ) 590 if ( mAllDay )
595 mDisplayedText += " ("; 591 mDisplayedText += " (";
596 else 592 else
597 mDisplayedText += "\n("; 593 mDisplayedText += "\n(";
598 mDisplayedText += mIncidence->location() +")"; 594 mDisplayedText += mIncidence->location() +")";
599 } 595 }
600#ifdef DESKTOP_VERSION 596#ifdef DESKTOP_VERSION
601 QString tipText = mIncidence->summary(); 597 QString tipText = mIncidence->summary();
602 if ( !mIncidence->doesFloat() ) { 598 if ( !mIncidence->doesFloat() ) {
603 if ( mIncidence->typeID() == eventID ) { 599 if ( mIncidence->typeID() == eventID ) {
604 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 600 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
605 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 601 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
606 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 602 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
607 } 603 }
608 else { 604 else {
609 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 605 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
610 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 606 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
611 } 607 }
612 } 608 }
613 else if ( mIncidence->typeID() == todoID ) { 609 else if ( mIncidence->typeID() == todoID ) {
614 if (mIncidence->hasStartDate()) 610 if (mIncidence->hasStartDate())
615 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); 611 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
616 if (((Todo*)mIncidence)->hasDueDate()) 612 if (((Todo*)mIncidence)->hasDueDate())
617 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); 613 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
618 } 614 }
619 } else if ( mIncidence->typeID() == todoID ) { 615 } else if ( mIncidence->typeID() == todoID ) {
620 if (mIncidence->hasStartDate()) 616 if (mIncidence->hasStartDate())
621 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); 617 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
622 if (((Todo*)mIncidence)->hasDueDate()) 618 if (((Todo*)mIncidence)->hasDueDate())
623 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); 619 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
624 } 620 }
625 621
626 if (!mIncidence->location().isEmpty()) { 622 if (!mIncidence->location().isEmpty()) {
627 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 623 tipText += "\n"+i18n("Location: ")+mIncidence->location();
628 } 624 }
629 QToolTip::add(this,tipText,toolTipGroup(),""); 625 QToolTip::add(this,tipText,toolTipGroup(),"");
630#endif 626#endif
631} 627}
632void KOAgendaItem::updateItem() 628void KOAgendaItem::updateItem()
633{ 629{
634 computeText(); 630 computeText();
635 631
636 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); 632 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());