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