summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 5ee433a..7e6fa48 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -281,412 +281,432 @@ void KOAgendaItem::select(bool selected)
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 if ( ! small ) { 424 if ( ! small ) {
425 QFontMetrics fm ( paint->font() ); 425 QFontMetrics fm ( paint->font() );
426 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); 426 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
427 } 427 }
428 428
429 } 429 }
430 pa.end(); 430 pa.end();
431 431
432} 432}
433void KOAgendaItem::resizePixmap( int w , int h ) 433void KOAgendaItem::resizePixmap( int w , int h )
434{ 434{
435 paintPix()->resize( w, h ); 435 paintPix()->resize( w, h );
436 paintPixSel()->resize( w, h ); 436 paintPixSel()->resize( w, h );
437 437
438} 438}
439QPixmap * KOAgendaItem::paintPix() 439QPixmap * KOAgendaItem::paintPix()
440{ 440{
441 static QPixmap* mPaintPix = 0; 441 static QPixmap* mPaintPix = 0;
442 if ( ! mPaintPix ) 442 if ( ! mPaintPix )
443 mPaintPix = new QPixmap(1,1); 443 mPaintPix = new QPixmap(1,1);
444 return mPaintPix ; 444 return mPaintPix ;
445} 445}
446QPixmap * KOAgendaItem::paintPixAllday() 446QPixmap * KOAgendaItem::paintPixAllday()
447{ 447{
448 static QPixmap* mPaintPixA = 0; 448 static QPixmap* mPaintPixA = 0;
449 if ( ! mPaintPixA ) 449 if ( ! mPaintPixA )
450 mPaintPixA = new QPixmap(1,1); 450 mPaintPixA = new QPixmap(1,1);
451 return mPaintPixA ; 451 return mPaintPixA ;
452} 452}
453QPixmap * KOAgendaItem::paintPixSel() 453QPixmap * KOAgendaItem::paintPixSel()
454{ 454{
455 static QPixmap* mPaintPixSel = 0; 455 static QPixmap* mPaintPixSel = 0;
456 if ( ! mPaintPixSel ) 456 if ( ! mPaintPixSel )
457 mPaintPixSel = new QPixmap(1,1); 457 mPaintPixSel = new QPixmap(1,1);
458 return mPaintPixSel ; 458 return mPaintPixSel ;
459} 459}
460void KOAgendaItem::paintEvent ( QPaintEvent *e ) 460void KOAgendaItem::paintEvent ( QPaintEvent *e )
461{ 461{
462 462
463 if ( globalFlagBlockAgendaItemPaint ) 463 if ( globalFlagBlockAgendaItemPaint )
464 return; 464 return;
465 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) 465 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
466 return; 466 return;
467 int yy; 467 int yy;
468 if ( mAllDay ) 468 if ( mAllDay )
469 yy = y(); 469 yy = y();
470 else 470 else
471 yy = mCellYTop * ( height() / cellHeight() ); 471 yy = mCellYTop * ( height() / cellHeight() );
472 int xx = x(); 472 int xx = x();
473
473 if ( xPaintCoord != xx || yPaintCoord != yy || 474 if ( xPaintCoord != xx || yPaintCoord != yy ||
474 wPaintCoord != width() || hPaintCoord != height()) { 475 wPaintCoord != width() || hPaintCoord != height()) {
475 xPaintCoord= xx; 476 xPaintCoord= xx;
476 yPaintCoord = yy; 477 yPaintCoord = yy;
477 wPaintCoord = width(); 478 wPaintCoord = width();
478 hPaintCoord = height(); 479 hPaintCoord = height();
479 globalFlagBlockAgendaItemUpdate = 0; 480 globalFlagBlockAgendaItemUpdate = 0;
480 paintMe( mSelected ); 481 paintMe( mSelected );
481 //qDebug("calling paintMe "); 482 //qDebug("calling paintMe ");
482 globalFlagBlockAgendaItemUpdate = 1; 483 globalFlagBlockAgendaItemUpdate = 1;
483 } 484 }
484 int rx, ry, rw, rh; 485 int rx, ry, rw, rh;
485 rx = e->rect().x(); 486 rx = e->rect().x();
486 ry = e->rect().y(); 487 ry = e->rect().y();
487 rw = e->rect().width(); 488 rw = e->rect().width();
488 rh = e->rect().height(); 489 rh = e->rect().height();
489 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); 490 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
490 491
491 QPixmap* paintFrom ; 492 QPixmap* paintFrom ;
492 if ( mSelected ) { 493 if ( mSelected ) {
493 paintFrom = paintPixSel(); 494 paintFrom = paintPixSel();
494 } else { 495 } else {
495 if ( mAllDay ) 496 if ( mAllDay )
496 paintFrom = paintPixAllday(); 497 paintFrom = paintPixAllday();
497 else 498 else
498 paintFrom = paintPix(); 499 paintFrom = paintPix();
499 } 500 }
500 bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); 501 xx += rx;
502
503 if ( xx < 0 ) {
504 rw = rw + xx;
505 rx -= xx;
506 xx = 0;
507 if ( rw < 0 ) {
508 qDebug("KOAgendaItem::Width1 < 0. Returning ");
509 return;
510 }
511 }
512 if ( paintFrom->width() < xx+rw ) {
513 rw = paintFrom->width() - xx;
514 if ( rw < 0 ) {
515 qDebug("KOAgendaItem::Width2 < 0. Returning ");
516 return;
517 }
518 }
519 //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);
501} 521}
502void KOAgendaItem::computeText() 522void KOAgendaItem::computeText()
503{ 523{
504 524
505 mDisplayedText = mIncidence->summary(); 525 mDisplayedText = mIncidence->summary();
506 if ( (mIncidence->type() == "Todo") ) { 526 if ( (mIncidence->type() == "Todo") ) {
507 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { 527 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
508 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 528 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
509 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 529 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
510 else if ( !(mIncidence->doesFloat())) 530 else if ( !(mIncidence->doesFloat()))
511 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; 531 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
512 } 532 }
513 } else { 533 } else {
514 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) 534 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
515 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; 535 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
516 536
517 if ( mAllDay ) { 537 if ( mAllDay ) {
518 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { 538 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
519 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; 539 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
520 } 540 }
521 } 541 }
522 542
523 } 543 }
524 544
525 if ( !mIncidence->location().isEmpty() ) { 545 if ( !mIncidence->location().isEmpty() ) {
526 if ( mAllDay ) 546 if ( mAllDay )
527 mDisplayedText += " ("; 547 mDisplayedText += " (";
528 else 548 else
529 mDisplayedText += "\n("; 549 mDisplayedText += "\n(";
530 mDisplayedText += mIncidence->location() +")"; 550 mDisplayedText += mIncidence->location() +")";
531 } 551 }
532 552
533 QString tipText = mIncidence->summary(); 553 QString tipText = mIncidence->summary();
534 if ( !mIncidence->doesFloat() ) { 554 if ( !mIncidence->doesFloat() ) {
535 if ( mIncidence->type() == "Event" ) { 555 if ( mIncidence->type() == "Event" ) {
536 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 556 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
537 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 557 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
538 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 558 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
539 } 559 }
540 else { 560 else {
541 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 561 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
542 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 562 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
543 } 563 }
544 } 564 }
545 else if ( mIncidence->type() == "Todo" ) { 565 else if ( mIncidence->type() == "Todo" ) {
546 if (mIncidence->hasStartDate()) 566 if (mIncidence->hasStartDate())
547 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); 567 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
548 if (((Todo*)mIncidence)->hasDueDate()) 568 if (((Todo*)mIncidence)->hasDueDate())
549 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); 569 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
550 } 570 }
551 } else if ( mIncidence->type() == "Todo" ) { 571 } else if ( mIncidence->type() == "Todo" ) {
552 if (mIncidence->hasStartDate()) 572 if (mIncidence->hasStartDate())
553 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); 573 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
554 if (((Todo*)mIncidence)->hasDueDate()) 574 if (((Todo*)mIncidence)->hasDueDate())
555 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); 575 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
556 } 576 }
557 577
558 if (!mIncidence->location().isEmpty()) { 578 if (!mIncidence->location().isEmpty()) {
559 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 579 tipText += "\n"+i18n("Location: ")+mIncidence->location();
560 } 580 }
561 QToolTip::add(this,tipText,toolTipGroup(),""); 581 QToolTip::add(this,tipText,toolTipGroup(),"");
562 582
563} 583}
564void KOAgendaItem::updateItem() 584void KOAgendaItem::updateItem()
565{ 585{
566 computeText(); 586 computeText();
567 587
568 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); 588 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
569 paintMe( mSelected ); 589 paintMe( mSelected );
570 repaint( false); 590 repaint( false);
571} 591}
572 592
573void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) 593void KOAgendaItem::resizeEvent ( QResizeEvent *ev )
574{ 594{
575 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); 595 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1());
576 paintMe( mSelected ); 596 paintMe( mSelected );
577 repaint( false ); 597 repaint( false );
578} 598}
579 599
580/* 600/*
581 Return height of item in units of agenda cells 601 Return height of item in units of agenda cells
582*/ 602*/
583int KOAgendaItem::cellHeight() 603int KOAgendaItem::cellHeight()
584{ 604{
585 int ret = mCellYBottom - mCellYTop + 1; 605 int ret = mCellYBottom - mCellYTop + 1;
586 if ( ret <= 0 ) { 606 if ( ret <= 0 ) {
587 ret = 1; 607 ret = 1;
588 mCellYBottom = 0; 608 mCellYBottom = 0;
589 mCellYTop = 0; 609 mCellYTop = 0;
590 } 610 }
591 return ret; 611 return ret;
592} 612}
593 613
594/* 614/*
595 Return height of item in units of agenda cells 615 Return height of item in units of agenda cells
596*/ 616*/
597int KOAgendaItem::cellWidth() 617int KOAgendaItem::cellWidth()
598{ 618{
599 return mCellXWidth - mCellX + 1; 619 return mCellXWidth - mCellX + 1;
600} 620}
601 621
602void KOAgendaItem::setItemDate(QDate qd) 622void KOAgendaItem::setItemDate(QDate qd)
603{ 623{
604 mDate = qd; 624 mDate = qd;
605} 625}
606 626
607void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) 627void KOAgendaItem::setCellXY(int X, int YTop, int YBottom)
608{ 628{
609 mCellX = X; 629 mCellX = X;
610 mCellYTop = YTop; 630 mCellYTop = YTop;
611 mCellYBottom = YBottom; 631 mCellYBottom = YBottom;
612} 632}
613 633
614void KOAgendaItem::setCellXWidth(int xwidth) 634void KOAgendaItem::setCellXWidth(int xwidth)
615{ 635{
616 mCellXWidth = xwidth; 636 mCellXWidth = xwidth;
617} 637}
618 638
619void KOAgendaItem::setCellX(int XLeft, int XRight) 639void KOAgendaItem::setCellX(int XLeft, int XRight)
620{ 640{
621 mCellX = XLeft; 641 mCellX = XLeft;
622 mCellXWidth = XRight; 642 mCellXWidth = XRight;
623} 643}
624 644
625void KOAgendaItem::setCellY(int YTop, int YBottom) 645void KOAgendaItem::setCellY(int YTop, int YBottom)
626{ 646{
627 mCellYTop = YTop; 647 mCellYTop = YTop;
628 mCellYBottom = YBottom; 648 mCellYBottom = YBottom;
629} 649}
630 650
631void KOAgendaItem::setSubCell(int subCell) 651void KOAgendaItem::setSubCell(int subCell)
632{ 652{
633 mSubCell = subCell; 653 mSubCell = subCell;
634} 654}
635 655
636void KOAgendaItem::setSubCells(int subCells) 656void KOAgendaItem::setSubCells(int subCells)
637{ 657{
638 mSubCells = subCells; 658 mSubCells = subCells;
639} 659}
640 660
641void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, 661void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next,
642 KOAgendaItem *last) 662 KOAgendaItem *last)
643{ 663{
644 mFirstMultiItem = first; 664 mFirstMultiItem = first;
645 mNextMultiItem = next; 665 mNextMultiItem = next;
646 mLastMultiItem = last; 666 mLastMultiItem = last;
647} 667}
648 668
649void KOAgendaItem::startMove() 669void KOAgendaItem::startMove()
650{ 670{
651 mStartCellX = mCellX; 671 mStartCellX = mCellX;
652 mStartCellXWidth = mCellXWidth; 672 mStartCellXWidth = mCellXWidth;
653 mStartCellYTop = mCellYTop; 673 mStartCellYTop = mCellYTop;
654 mStartCellYBottom = mCellYBottom; 674 mStartCellYBottom = mCellYBottom;
655} 675}
656 676
657void KOAgendaItem::resetMove() 677void KOAgendaItem::resetMove()
658{ 678{
659 mCellX = mStartCellX; 679 mCellX = mStartCellX;
660 mCellXWidth = mStartCellXWidth; 680 mCellXWidth = mStartCellXWidth;
661 mCellYTop = mStartCellYTop; 681 mCellYTop = mStartCellYTop;
662 mCellYBottom = mStartCellYBottom; 682 mCellYBottom = mStartCellYBottom;
663} 683}
664 684
665void KOAgendaItem::moveRelative(int dx, int dy) 685void KOAgendaItem::moveRelative(int dx, int dy)
666{ 686{
667 int newX = cellX() + dx; 687 int newX = cellX() + dx;
668 int newXWidth = cellXWidth() + dx; 688 int newXWidth = cellXWidth() + dx;
669 int newYTop = cellYTop() + dy; 689 int newYTop = cellYTop() + dy;
670 int newYBottom = cellYBottom() + dy; 690 int newYBottom = cellYBottom() + dy;
671 setCellXY(newX,newYTop,newYBottom); 691 setCellXY(newX,newYTop,newYBottom);
672 setCellXWidth(newXWidth); 692 setCellXWidth(newXWidth);
673} 693}
674 694
675void KOAgendaItem::expandTop(int dy) 695void KOAgendaItem::expandTop(int dy)
676{ 696{
677 int newYTop = cellYTop() + dy; 697 int newYTop = cellYTop() + dy;
678 int newYBottom = cellYBottom(); 698 int newYBottom = cellYBottom();
679 if (newYTop > newYBottom) newYTop = newYBottom; 699 if (newYTop > newYBottom) newYTop = newYBottom;
680 setCellY(newYTop, newYBottom); 700 setCellY(newYTop, newYBottom);
681} 701}
682 702
683void KOAgendaItem::expandBottom(int dy) 703void KOAgendaItem::expandBottom(int dy)
684{ 704{
685 int newYTop = cellYTop(); 705 int newYTop = cellYTop();
686 int newYBottom = cellYBottom() + dy; 706 int newYBottom = cellYBottom() + dy;
687 if (newYBottom < newYTop) newYBottom = newYTop; 707 if (newYBottom < newYTop) newYBottom = newYTop;
688 setCellY(newYTop, newYBottom); 708 setCellY(newYTop, newYBottom);
689} 709}
690 710
691void KOAgendaItem::expandLeft(int dx) 711void KOAgendaItem::expandLeft(int dx)
692{ 712{