author | zautrix <zautrix> | 2005-08-22 16:28:08 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-22 16:28:08 (UTC) |
commit | 18780cc2342097b343ee2fa50c649f425ddaed34 (patch) (unidiff) | |
tree | 6ea015c45835e96451cede982ac79a518141dd29 | |
parent | 4a5e2a487ee162c1e3d5ea0d1c8d4bd14a65efb9 (diff) | |
download | kdepimpi-18780cc2342097b343ee2fa50c649f425ddaed34.zip kdepimpi-18780cc2342097b343ee2fa50c649f425ddaed34.tar.gz kdepimpi-18780cc2342097b343ee2fa50c649f425ddaed34.tar.bz2 |
fix for the lonng agenda float fix
-rw-r--r-- | korganizer/koagenda.cpp | 4 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 8 | ||||
-rw-r--r-- | korganizer/koagendaitem.h | 2 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 1 |
4 files changed, 8 insertions, 7 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 796d633..d9d1283 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1831,22 +1831,22 @@ KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int | |||
1831 | /* | 1831 | /* |
1832 | Insert all-day KOAgendaItem into agenda. | 1832 | Insert all-day KOAgendaItem into agenda. |
1833 | */ | 1833 | */ |
1834 | KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) | 1834 | KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) |
1835 | { | 1835 | { |
1836 | if (!mAllDayMode) { | 1836 | if (!mAllDayMode) { |
1837 | return 0; | 1837 | return 0; |
1838 | } | 1838 | } |
1839 | 1839 | //qDebug("insertallday %s -- %d - %d ",qd.toString().latin1(), XBegin, XEnd ); | |
1840 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); | 1840 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); |
1841 | 1841 | ||
1842 | agendaItem->setCellXY(XBegin,0,0); | 1842 | agendaItem->setCellXY(XBegin,0,0); |
1843 | agendaItem->setCellXWidth(XEnd); | 1843 | agendaItem->setCellXWidth(XEnd); |
1844 | agendaItem->resizeMe(mGridSpacingX, mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); | 1844 | agendaItem->resizeMe(mGridSpacingX, mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY, true ); |
1845 | 1845 | ||
1846 | //addChild(agendaItem,XBegin*mGridSpacingX,0); | 1846 | //addChild(agendaItem,XBegin*mGridSpacingX,0); |
1847 | mItems.append(agendaItem); | 1847 | mItems.append(agendaItem); |
1848 | 1848 | ||
1849 | placeSubCells(agendaItem); | 1849 | placeSubCells(agendaItem); |
1850 | 1850 | ||
1851 | //agendaItem->show(); | 1851 | //agendaItem->show(); |
1852 | 1852 | ||
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 7a685d8..81681df 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -577,17 +577,18 @@ void KOAgendaItem::computeText() | |||
577 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) | 577 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) |
578 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; | 578 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; |
579 | 579 | ||
580 | if ( mAllDay ) { | 580 | if ( mAllDay ) { |
581 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { | 581 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { |
582 | if ( mIncidence->doesRecur() ) { | 582 | if ( mIncidence->doesRecur() ) { |
583 | mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; | 583 | mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; |
584 | } else { | 584 | } else { |
585 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; | 585 | int dur = 1+ (static_cast<Event*>(mIncidence))->dtStart().date().daysTo( (static_cast<Event*>(mIncidence))->dtEnd().date() ); |
586 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) + " ("+QString::number( dur )+i18n(" days") +")" ; | ||
586 | } | 587 | } |
587 | } | 588 | } |
588 | } | 589 | } |
589 | } | 590 | } |
590 | 591 | ||
591 | if ( !mIncidence->location().isEmpty() ) { | 592 | if ( !mIncidence->location().isEmpty() ) { |
592 | if ( mAllDay ) | 593 | if ( mAllDay ) |
593 | mDisplayedText += " ("; | 594 | mDisplayedText += " ("; |
@@ -653,31 +654,32 @@ int KOAgendaItem::cellHeight() | |||
653 | ret = 1; | 654 | ret = 1; |
654 | mCellYBottom = 0; | 655 | mCellYBottom = 0; |
655 | mCellYTop = 0; | 656 | mCellYTop = 0; |
656 | } | 657 | } |
657 | return ret; | 658 | return ret; |
658 | } | 659 | } |
659 | // it may be that allday agenda items have a needed width > 32000 | 660 | // it may be that allday agenda items have a needed width > 32000 |
660 | // this code is to fix this problem | 661 | // this code is to fix this problem |
661 | int KOAgendaItem::resizeMe( int grid, int wid, int hei ) | 662 | int KOAgendaItem::resizeMe( int grid, int wid, int hei, bool invalidWidth ) |
662 | { | 663 | { |
663 | int diff = 0; | 664 | int diff = 0; |
664 | if ( mCellX < -3 && mAllDay ) { | 665 | if ( mCellX < -3 && mAllDay ) { |
665 | diff = (mCellX + 3) * -grid; | 666 | diff = (mCellX + 3) * -grid; |
666 | //qDebug("%s: cellX %d diff %d wid %d grid %d ", mDisplayedText.latin1(), mCellX, diff, wid, grid); | 667 | //qDebug("%s: cellX %d diff %d wid %d grid %d ", mDisplayedText.latin1(), mCellX, diff, wid, grid); |
667 | if ( diff >= wid ) { | 668 | if ( diff >= wid ) { |
668 | // qDebug("KOAgendaItem::resizeMe: diff >= wid: diff %d wid %d ", diff, wid); | 669 | // qDebug("KOAgendaItem::resizeMe: diff >= wid: diff %d wid %d ", diff, wid); |
669 | //diff = 0; | 670 | //diff = 0; |
670 | } | 671 | } |
671 | } | 672 | } |
672 | if ( wid == width() || diff >= wid ) | 673 | if ( (!invalidWidth && wid == width() ) || diff >= wid ) |
673 | resize( wid, hei ); | 674 | resize( wid, hei ); |
674 | else | 675 | else |
675 | resize( wid - diff, hei ); | 676 | resize( wid - diff, hei ); |
677 | //qDebug("wid %d x %d ", width(), x()); | ||
676 | return diff; | 678 | return diff; |
677 | } | 679 | } |
678 | /* | 680 | /* |
679 | Return height of item in units of agenda cells | 681 | Return height of item in units of agenda cells |
680 | */ | 682 | */ |
681 | int KOAgendaItem::cellWidth() | 683 | int KOAgendaItem::cellWidth() |
682 | { | 684 | { |
683 | return mCellXWidth - mCellX + 1; | 685 | return mCellXWidth - mCellX + 1; |
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h index 97acd4c..37d89a6 100644 --- a/korganizer/koagendaitem.h +++ b/korganizer/koagendaitem.h | |||
@@ -104,17 +104,17 @@ class KOAgendaItem : public QWidget | |||
104 | static QPixmap * paintPix(); | 104 | static QPixmap * paintPix(); |
105 | static QPixmap * paintPixAllday(); | 105 | static QPixmap * paintPixAllday(); |
106 | void updateItem(); | 106 | void updateItem(); |
107 | void computeText(); | 107 | void computeText(); |
108 | void recreateIncidence(); | 108 | void recreateIncidence(); |
109 | bool checkLayout(); | 109 | bool checkLayout(); |
110 | void initColor (); | 110 | void initColor (); |
111 | bool isAllDay() { return mAllDay; } | 111 | bool isAllDay() { return mAllDay; } |
112 | int resizeMe( int grid, int wid, int hei ); | 112 | int resizeMe( int grid, int wid, int hei, bool invalidHei = false ); |
113 | public slots: | 113 | public slots: |
114 | bool updateIcons( QPainter *, bool ); | 114 | bool updateIcons( QPainter *, bool ); |
115 | void select(bool=true); | 115 | void select(bool=true); |
116 | void repaintItem(); | 116 | void repaintItem(); |
117 | 117 | ||
118 | protected: | 118 | protected: |
119 | void dragEnterEvent(QDragEnterEvent *e); | 119 | void dragEnterEvent(QDragEnterEvent *e); |
120 | void dropEvent(QDropEvent *e); | 120 | void dropEvent(QDropEvent *e); |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 1cf03a0..d8a2134 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1230,17 +1230,16 @@ void KOAgendaView::fillAgenda() | |||
1230 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); | 1230 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); |
1231 | } | 1231 | } |
1232 | } | 1232 | } |
1233 | } | 1233 | } |
1234 | } | 1234 | } |
1235 | } else { | 1235 | } else { |
1236 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1236 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1237 | } | 1237 | } |
1238 | |||
1239 | } else { | 1238 | } else { |
1240 | if (beginX <= 0 && curCol == 0) { | 1239 | if (beginX <= 0 && curCol == 0) { |
1241 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1240 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1242 | } else if (beginX == curCol) { | 1241 | } else if (beginX == curCol) { |
1243 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1242 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1244 | } | 1243 | } |
1245 | } | 1244 | } |
1246 | } else if (event->isMultiDay()) { | 1245 | } else if (event->isMultiDay()) { |