-rw-r--r-- | korganizer/koagenda.cpp | 2 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index eb3791e..7e0b216 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1603,65 +1603,65 @@ void KOAgenda::computeSizes() | |||
1603 | item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); | 1603 | item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); |
1604 | moveChild(item,KOGlobals::self()->reverseLayout() ? | 1604 | moveChild(item,KOGlobals::self()->reverseLayout() ? |
1605 | (mColumns - 1 - item->cellX()) * mGridSpacingX : | 1605 | (mColumns - 1 - item->cellX()) * mGridSpacingX : |
1606 | item->cellX() * mGridSpacingX, | 1606 | item->cellX() * mGridSpacingX, |
1607 | item->subCell() * subCellWidth); | 1607 | item->subCell() * subCellWidth); |
1608 | } | 1608 | } |
1609 | KOPrefs::instance()->mAllDaySize = mGridSpacingY; | 1609 | KOPrefs::instance()->mAllDaySize = mGridSpacingY; |
1610 | } else { | 1610 | } else { |
1611 | mGridSpacingX = (width() - verticalScrollBar()->width()-3)/mColumns; | 1611 | mGridSpacingX = (width() - verticalScrollBar()->width()-3)/mColumns; |
1612 | if (height() > mGridSpacingY * mRows + 1 ) { | 1612 | if (height() > mGridSpacingY * mRows + 1 ) { |
1613 | KOPrefs::instance()->mHourSize = ((height())/mRows)+1; | 1613 | KOPrefs::instance()->mHourSize = ((height())/mRows)+1; |
1614 | mGridSpacingY = KOPrefs::instance()->mHourSize ; | 1614 | mGridSpacingY = KOPrefs::instance()->mHourSize ; |
1615 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1615 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1616 | emit resizedSignal(); | 1616 | emit resizedSignal(); |
1617 | } else | 1617 | } else |
1618 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1618 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1619 | KOAgendaItem *item; | 1619 | KOAgendaItem *item; |
1620 | int subCellWidth; | 1620 | int subCellWidth; |
1621 | 1621 | ||
1622 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1622 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1623 | subCellWidth = mGridSpacingX / item->subCells(); | 1623 | subCellWidth = mGridSpacingX / item->subCells(); |
1624 | item->resize(subCellWidth,item->height()); | 1624 | item->resize(subCellWidth,item->height()); |
1625 | moveChild(item,(KOGlobals::self()->reverseLayout() ? | 1625 | moveChild(item,(KOGlobals::self()->reverseLayout() ? |
1626 | (mColumns - 1 - item->cellX()) * mGridSpacingX : | 1626 | (mColumns - 1 - item->cellX()) * mGridSpacingX : |
1627 | item->cellX() * mGridSpacingX) + | 1627 | item->cellX() * mGridSpacingX) + |
1628 | item->subCell() * subCellWidth,childY(item)); | 1628 | item->subCell() * subCellWidth,childY(item)); |
1629 | } | 1629 | } |
1630 | } | 1630 | } |
1631 | int cw = contentsWidth(); | 1631 | int cw = contentsWidth(); |
1632 | int ch = contentsHeight(); | 1632 | int ch = contentsHeight(); |
1633 | if ( mAllDayMode ) { | 1633 | if ( mAllDayMode ) { |
1634 | QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); | 1634 | QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); |
1635 | if ( paintPixAll->width() < cw || paintPixAll->height() < ch ) | 1635 | if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) |
1636 | paintPixAll->resize( cw, ch ); | 1636 | paintPixAll->resize( cw, ch ); |
1637 | } else { | 1637 | } else { |
1638 | QPixmap* paintPix = KOAgendaItem::paintPix(); | 1638 | QPixmap* paintPix = KOAgendaItem::paintPix(); |
1639 | if ( paintPix->width() < cw || paintPix->height() < ch ) | 1639 | if ( paintPix->width() < cw || paintPix->height() < ch ) |
1640 | KOAgendaItem::resizePixmap( cw , ch ); | 1640 | KOAgendaItem::resizePixmap( cw , ch ); |
1641 | } | 1641 | } |
1642 | 1642 | ||
1643 | checkScrollBoundaries(); | 1643 | checkScrollBoundaries(); |
1644 | marcus_bains(); | 1644 | marcus_bains(); |
1645 | drawContentsToPainter(); | 1645 | drawContentsToPainter(); |
1646 | viewport()->repaint(false); | 1646 | viewport()->repaint(false); |
1647 | } | 1647 | } |
1648 | 1648 | ||
1649 | void KOAgenda::scrollUp() | 1649 | void KOAgenda::scrollUp() |
1650 | { | 1650 | { |
1651 | scrollBy(0,-mScrollOffset); | 1651 | scrollBy(0,-mScrollOffset); |
1652 | } | 1652 | } |
1653 | 1653 | ||
1654 | 1654 | ||
1655 | void KOAgenda::scrollDown() | 1655 | void KOAgenda::scrollDown() |
1656 | { | 1656 | { |
1657 | scrollBy(0,mScrollOffset); | 1657 | scrollBy(0,mScrollOffset); |
1658 | } | 1658 | } |
1659 | 1659 | ||
1660 | void KOAgenda::popupAlarm() | 1660 | void KOAgenda::popupAlarm() |
1661 | { | 1661 | { |
1662 | if (!mClickedItem) { | 1662 | if (!mClickedItem) { |
1663 | kdDebug() << "KOAgenda::popupAlarm() called without having a clicked item" << endl; | 1663 | kdDebug() << "KOAgenda::popupAlarm() called without having a clicked item" << endl; |
1664 | return; | 1664 | return; |
1665 | } | 1665 | } |
1666 | // TODO: deal correctly with multiple alarms | 1666 | // TODO: deal correctly with multiple alarms |
1667 | Alarm* alarm; | 1667 | Alarm* alarm; |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 6965ba7..62281d4 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -398,79 +398,79 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | |||
398 | if ( w > parentWidget()->width() ){ | 398 | if ( w > parentWidget()->width() ){ |
399 | w = parentWidget()->width() - 6; | 399 | w = parentWidget()->width() - 6; |
400 | #ifndef DESKTOP_VERSION | 400 | #ifndef DESKTOP_VERSION |
401 | align = ( AlignCenter|WordBreak); | 401 | align = ( AlignCenter|WordBreak); |
402 | #else | 402 | #else |
403 | align = ( AlignCenter|BreakAnywhere|WordBreak); | 403 | align = ( AlignCenter|BreakAnywhere|WordBreak); |
404 | #endif | 404 | #endif |
405 | 405 | ||
406 | } | 406 | } |
407 | } | 407 | } |
408 | QRect dr; | 408 | QRect dr; |
409 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); | 409 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); |
410 | if ( mIncidence->cancelled() ){ | 410 | if ( mIncidence->cancelled() ){ |
411 | if ( ! small ) { | 411 | if ( ! small ) { |
412 | QFontMetrics fm ( paint->font() ); | 412 | QFontMetrics fm ( paint->font() ); |
413 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); | 413 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); |
414 | } | 414 | } |
415 | 415 | ||
416 | } | 416 | } |
417 | pa.end(); | 417 | pa.end(); |
418 | 418 | ||
419 | } | 419 | } |
420 | void KOAgendaItem::resizePixmap( int w , int h ) | 420 | void KOAgendaItem::resizePixmap( int w , int h ) |
421 | { | 421 | { |
422 | paintPix()->resize( w, h ); | 422 | paintPix()->resize( w, h ); |
423 | paintPixSel()->resize( w, h ); | 423 | paintPixSel()->resize( w, h ); |
424 | 424 | ||
425 | } | 425 | } |
426 | QPixmap * KOAgendaItem::paintPix() | 426 | QPixmap * KOAgendaItem::paintPix() |
427 | { | 427 | { |
428 | static QPixmap* mPaintPix = 0; | 428 | static QPixmap* mPaintPix = 0; |
429 | if ( ! mPaintPix ) | 429 | if ( ! mPaintPix ) |
430 | mPaintPix = new QPixmap(); | 430 | mPaintPix = new QPixmap(1,1); |
431 | return mPaintPix ; | 431 | return mPaintPix ; |
432 | } | 432 | } |
433 | QPixmap * KOAgendaItem::paintPixAllday() | 433 | QPixmap * KOAgendaItem::paintPixAllday() |
434 | { | 434 | { |
435 | static QPixmap* mPaintPixA = 0; | 435 | static QPixmap* mPaintPixA = 0; |
436 | if ( ! mPaintPixA ) | 436 | if ( ! mPaintPixA ) |
437 | mPaintPixA = new QPixmap(); | 437 | mPaintPixA = new QPixmap(1,1); |
438 | return mPaintPixA ; | 438 | return mPaintPixA ; |
439 | } | 439 | } |
440 | QPixmap * KOAgendaItem::paintPixSel() | 440 | QPixmap * KOAgendaItem::paintPixSel() |
441 | { | 441 | { |
442 | static QPixmap* mPaintPixSel = 0; | 442 | static QPixmap* mPaintPixSel = 0; |
443 | if ( ! mPaintPixSel ) | 443 | if ( ! mPaintPixSel ) |
444 | mPaintPixSel = new QPixmap(); | 444 | mPaintPixSel = new QPixmap(1,1); |
445 | return mPaintPixSel ; | 445 | return mPaintPixSel ; |
446 | } | 446 | } |
447 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) | 447 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) |
448 | { | 448 | { |
449 | 449 | ||
450 | if ( globalFlagBlockAgendaItemPaint ) | 450 | if ( globalFlagBlockAgendaItemPaint ) |
451 | return; | 451 | return; |
452 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) | 452 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) |
453 | return; | 453 | return; |
454 | int yy; | 454 | int yy; |
455 | if ( mAllDay ) | 455 | if ( mAllDay ) |
456 | yy = y(); | 456 | yy = y(); |
457 | else | 457 | else |
458 | yy = mCellYTop * ( height() / cellHeight() ); | 458 | yy = mCellYTop * ( height() / cellHeight() ); |
459 | int xx = x(); | 459 | int xx = x(); |
460 | if ( xPaintCoord != xx || yPaintCoord != yy || | 460 | if ( xPaintCoord != xx || yPaintCoord != yy || |
461 | wPaintCoord != width() || hPaintCoord != height()) { | 461 | wPaintCoord != width() || hPaintCoord != height()) { |
462 | xPaintCoord= xx; | 462 | xPaintCoord= xx; |
463 | yPaintCoord = yy; | 463 | yPaintCoord = yy; |
464 | wPaintCoord = width(); | 464 | wPaintCoord = width(); |
465 | hPaintCoord = height(); | 465 | hPaintCoord = height(); |
466 | globalFlagBlockAgendaItemUpdate = 0; | 466 | globalFlagBlockAgendaItemUpdate = 0; |
467 | paintMe( mSelected ); | 467 | paintMe( mSelected ); |
468 | //qDebug("calling paintMe "); | 468 | //qDebug("calling paintMe "); |
469 | globalFlagBlockAgendaItemUpdate = 1; | 469 | globalFlagBlockAgendaItemUpdate = 1; |
470 | } | 470 | } |
471 | int rx, ry, rw, rh; | 471 | int rx, ry, rw, rh; |
472 | rx = e->rect().x(); | 472 | rx = e->rect().x(); |
473 | ry = e->rect().y(); | 473 | ry = e->rect().y(); |
474 | rw = e->rect().width(); | 474 | rw = e->rect().width(); |
475 | rh = e->rect().height(); | 475 | rh = e->rect().height(); |
476 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); | 476 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); |