-rw-r--r-- | korganizer/koagenda.cpp | 42 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 20 | ||||
-rw-r--r-- | korganizer/koagendaitem.h | 1 |
3 files changed, 44 insertions, 19 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 88f5d99..796d633 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -958,8 +958,8 @@ void KOAgenda::performItemAction(QPoint viewportPos) | |||
958 | int x,y; | 958 | int x,y; |
959 | gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); | 959 | gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); |
960 | moveItem->resize(mGridSpacingX * moveItem->cellWidth(), | 960 | int diff = moveItem->resizeMe(mGridSpacingX, mGridSpacingX* moveItem->cellWidth(), |
961 | mGridSpacingY * moveItem->cellHeight()); | 961 | mGridSpacingY * moveItem->cellHeight()); |
962 | moveItem->raise(); | 962 | moveItem->raise(); |
963 | moveChild(moveItem,x,y); | 963 | moveChild(moveItem,x+diff,y); |
964 | moveItem = moveItem->nextMultiItem(); | 964 | moveItem = moveItem->nextMultiItem(); |
965 | } | 965 | } |
@@ -983,14 +983,15 @@ void KOAgenda::performItemAction(QPoint viewportPos) | |||
983 | if (mCurrentCellX <= mActionItem->cellXWidth()) { | 983 | if (mCurrentCellX <= mActionItem->cellXWidth()) { |
984 | mActionItem->expandLeft(gx - mCurrentCellX); | 984 | mActionItem->expandLeft(gx - mCurrentCellX); |
985 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 985 | int diff = mActionItem->resizeMe(mGridSpacingX , |
986 | mActionItem->height()); | 986 | mGridSpacingX * mActionItem->cellWidth(), |
987 | mActionItem->height()); | ||
987 | int x,y; | 988 | int x,y; |
988 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); | 989 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); |
989 | moveChild(mActionItem,x,childY(mActionItem)); | 990 | moveChild(mActionItem,x+diff,childY(mActionItem)); |
990 | } | 991 | } |
991 | } else if (mActionType == RESIZERIGHT) { | 992 | } else if (mActionType == RESIZERIGHT) { |
992 | if (mCurrentCellX >= mActionItem->cellX()) { | 993 | if (mCurrentCellX >= mActionItem->cellX()) { |
993 | mActionItem->expandRight(gx - mCurrentCellX); | 994 | mActionItem->expandRight(gx - mCurrentCellX); |
994 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 995 | mActionItem->resizeMe(mGridSpacingX, mGridSpacingX * mActionItem->cellWidth(), |
995 | mActionItem->height()); | 996 | mActionItem->height()); |
996 | } | 997 | } |
@@ -1218,6 +1219,7 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
1218 | item=conflictItems.next() ) { | 1219 | item=conflictItems.next() ) { |
1219 | item->setSubCells(maxSubCells); | 1220 | item->setSubCells(maxSubCells); |
1221 | int diff = 0; | ||
1220 | if (mAllDayMode) { | 1222 | if (mAllDayMode) { |
1221 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1223 | diff = item->resizeMe( mGridSpacingX, item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1222 | } else { | 1224 | } else { |
1223 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1225 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
@@ -1230,5 +1232,5 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
1230 | x += item->subCell() * newSubCellWidth; | 1232 | x += item->subCell() * newSubCellWidth; |
1231 | } | 1233 | } |
1232 | moveChild(item,x,y); | 1234 | moveChild(item,x+diff,y); |
1233 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); | 1235 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); |
1234 | //item->updateItem(); | 1236 | //item->updateItem(); |
@@ -1244,6 +1246,7 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
1244 | if ( item2->subCells() != maxSubCells) { | 1246 | if ( item2->subCells() != maxSubCells) { |
1245 | item2->setSubCells(maxSubCells); | 1247 | item2->setSubCells(maxSubCells); |
1248 | int diff = 0; | ||
1246 | if (mAllDayMode) { | 1249 | if (mAllDayMode) { |
1247 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); | 1250 | diff = item2->resizeMe(mGridSpacingX, item2->cellWidth() * mGridSpacingX, newSubCellWidth); |
1248 | } else { | 1251 | } else { |
1249 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); | 1252 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); |
@@ -1256,5 +1259,5 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
1256 | x += item2->subCell() * newSubCellWidth; | 1259 | x += item2->subCell() * newSubCellWidth; |
1257 | } | 1260 | } |
1258 | moveChild(item2,x,y); | 1261 | moveChild(item2,x+diff,y); |
1259 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); | 1262 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); |
1260 | } | 1263 | } |
@@ -1265,9 +1268,10 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
1265 | placeItem->setSubCell(0); | 1268 | placeItem->setSubCell(0); |
1266 | placeItem->setSubCells(1); | 1269 | placeItem->setSubCells(1); |
1267 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); | 1270 | int diff = 0; |
1271 | if (mAllDayMode) diff = placeItem->resizeMe( mGridSpacingX, placeItem->width(),mGridSpacingY); | ||
1268 | else placeItem->resize(mGridSpacingX,placeItem->height()); | 1272 | else placeItem->resize(mGridSpacingX,placeItem->height()); |
1269 | int x,y; | 1273 | int x,y; |
1270 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); | 1274 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); |
1271 | moveChild(placeItem,x,y); | 1275 | moveChild(placeItem,x+diff,y); |
1272 | } | 1276 | } |
1273 | placeItem->setConflictItems(conflictItems); | 1277 | placeItem->setConflictItems(conflictItems); |
@@ -1396,9 +1400,10 @@ void KOAgenda::finishUpdate() | |||
1396 | //qDebug(" conflictitem found "); | 1400 | //qDebug(" conflictitem found "); |
1397 | int newSubCellWidth; | 1401 | int newSubCellWidth; |
1402 | int diff = 0; | ||
1398 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); | 1403 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); |
1399 | else newSubCellWidth = mGridSpacingX / item->subCells(); | 1404 | else newSubCellWidth = mGridSpacingX / item->subCells(); |
1400 | 1405 | ||
1401 | if (mAllDayMode) { | 1406 | if (mAllDayMode) { |
1402 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1407 | diff = item->resizeMe(mGridSpacingX, item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1403 | } else { | 1408 | } else { |
1404 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1409 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
@@ -1411,5 +1416,5 @@ void KOAgenda::finishUpdate() | |||
1411 | x += item->subCell() * newSubCellWidth; | 1416 | x += item->subCell() * newSubCellWidth; |
1412 | } | 1417 | } |
1413 | moveChild(item,x,y); | 1418 | moveChild(item,x+diff,y); |
1414 | } | 1419 | } |
1415 | } | 1420 | } |
@@ -1837,5 +1842,5 @@ KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,i | |||
1837 | agendaItem->setCellXY(XBegin,0,0); | 1842 | agendaItem->setCellXY(XBegin,0,0); |
1838 | agendaItem->setCellXWidth(XEnd); | 1843 | agendaItem->setCellXWidth(XEnd); |
1839 | agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); | 1844 | agendaItem->resizeMe(mGridSpacingX, mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); |
1840 | 1845 | ||
1841 | //addChild(agendaItem,XBegin*mGridSpacingX,0); | 1846 | //addChild(agendaItem,XBegin*mGridSpacingX,0); |
@@ -1943,8 +1948,9 @@ void KOAgenda::computeSizes() | |||
1943 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1948 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1944 | subCellWidth = mGridSpacingY / item->subCells(); | 1949 | subCellWidth = mGridSpacingY / item->subCells(); |
1945 | item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); | 1950 | int diff = 0; |
1946 | moveChild(item,KOGlobals::self()->reverseLayout() ? | 1951 | diff = item->resizeMe(mGridSpacingX ,mGridSpacingX * item->cellWidth(),subCellWidth); |
1952 | moveChild(item,(KOGlobals::self()->reverseLayout() ? | ||
1947 | (mColumns - 1 - item->cellX()) * mGridSpacingX : | 1953 | (mColumns - 1 - item->cellX()) * mGridSpacingX : |
1948 | item->cellX() * mGridSpacingX, | 1954 | item->cellX() * mGridSpacingX) + diff, |
1949 | item->subCell() * subCellWidth); | 1955 | item->subCell() * subCellWidth); |
1950 | } | 1956 | } |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 49ad9b8..7a685d8 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -657,5 +657,23 @@ int KOAgendaItem::cellHeight() | |||
657 | return ret; | 657 | return ret; |
658 | } | 658 | } |
659 | 659 | // it may be that allday agenda items have a needed width > 32000 | |
660 | // this code is to fix this problem | ||
661 | int KOAgendaItem::resizeMe( int grid, int wid, int hei ) | ||
662 | { | ||
663 | int diff = 0; | ||
664 | if ( mCellX < -3 && mAllDay ) { | ||
665 | diff = (mCellX + 3) * -grid; | ||
666 | //qDebug("%s: cellX %d diff %d wid %d grid %d ", mDisplayedText.latin1(), mCellX, diff, wid, grid); | ||
667 | if ( diff >= wid ) { | ||
668 | // qDebug("KOAgendaItem::resizeMe: diff >= wid: diff %d wid %d ", diff, wid); | ||
669 | //diff = 0; | ||
670 | } | ||
671 | } | ||
672 | if ( wid == width() || diff >= wid ) | ||
673 | resize( wid, hei ); | ||
674 | else | ||
675 | resize( wid - diff, hei ); | ||
676 | return diff; | ||
677 | } | ||
660 | /* | 678 | /* |
661 | Return height of item in units of agenda cells | 679 | Return height of item in units of agenda cells |
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h index 2b26e95..97acd4c 100644 --- a/korganizer/koagendaitem.h +++ b/korganizer/koagendaitem.h | |||
@@ -110,4 +110,5 @@ class KOAgendaItem : public QWidget | |||
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 | public slots: | 113 | public slots: |
113 | bool updateIcons( QPainter *, bool ); | 114 | bool updateIcons( QPainter *, bool ); |