summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
authorzautrix <zautrix>2005-08-17 13:06:53 (UTC)
committer zautrix <zautrix>2005-08-17 13:06:53 (UTC)
commit4b66565ed2db51bc636b7b4c12f19f036d9b80f3 (patch) (side-by-side diff)
tree402372be9f52835e15757a51c18cfc46d47c8953 /korganizer/koagenda.cpp
parent31393a99cd2b190e62a7a09a7739a14af83936d1 (diff)
downloadkdepimpi-4b66565ed2db51bc636b7b4c12f19f036d9b80f3.zip
kdepimpi-4b66565ed2db51bc636b7b4c12f19f036d9b80f3.tar.gz
kdepimpi-4b66565ed2db51bc636b7b4c12f19f036d9b80f3.tar.bz2
allday agenda item fix
Diffstat (limited to 'korganizer/koagenda.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp42
1 files changed, 24 insertions, 18 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 88f5d99..796d633 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -954,16 +954,16 @@ void KOAgenda::performItemAction(QPoint viewportPos)
int dy;
if (isMultiItem) dy = 0;
else dy = gy - mCurrentCellY;
moveItem->moveRelative(gx - mCurrentCellX,dy);
int x,y;
gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y);
- moveItem->resize(mGridSpacingX * moveItem->cellWidth(),
+ int diff = moveItem->resizeMe(mGridSpacingX, mGridSpacingX* moveItem->cellWidth(),
mGridSpacingY * moveItem->cellHeight());
moveItem->raise();
- moveChild(moveItem,x,y);
+ moveChild(moveItem,x+diff,y);
moveItem = moveItem->nextMultiItem();
}
} else if (mActionType == RESIZETOP) {
if (mCurrentCellY <= mActionItem->cellYBottom()) {
mActionItem->expandTop(gy - mCurrentCellY);
mActionItem->resize(mActionItem->width(),
@@ -979,22 +979,23 @@ void KOAgenda::performItemAction(QPoint viewportPos)
mActionItem->resize(mActionItem->width(),
mGridSpacingY * mActionItem->cellHeight());
}
} else if (mActionType == RESIZELEFT) {
if (mCurrentCellX <= mActionItem->cellXWidth()) {
mActionItem->expandLeft(gx - mCurrentCellX);
- mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(),
- mActionItem->height());
+ int diff = mActionItem->resizeMe(mGridSpacingX ,
+ mGridSpacingX * mActionItem->cellWidth(),
+ mActionItem->height());
int x,y;
gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y);
- moveChild(mActionItem,x,childY(mActionItem));
+ moveChild(mActionItem,x+diff,childY(mActionItem));
}
} else if (mActionType == RESIZERIGHT) {
if (mCurrentCellX >= mActionItem->cellX()) {
mActionItem->expandRight(gx - mCurrentCellX);
- mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(),
+ mActionItem->resizeMe(mGridSpacingX, mGridSpacingX * mActionItem->cellWidth(),
mActionItem->height());
}
}
mCurrentCellX = gx;
mCurrentCellY = gy;
}
@@ -1214,25 +1215,26 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
// Adjust sub cell geometry of all direct conflict items
for ( item=conflictItems.first(); item != 0;
item=conflictItems.next() ) {
item->setSubCells(maxSubCells);
+ int diff = 0;
if (mAllDayMode) {
- item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth);
+ diff = item->resizeMe( mGridSpacingX, item->cellWidth() * mGridSpacingX, newSubCellWidth);
} else {
item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
}
int x,y;
gridToContents(item->cellX(),item->cellYTop(),x,y);
if (mAllDayMode) {
y += item->subCell() * newSubCellWidth;
} else {
x += item->subCell() * newSubCellWidth;
}
- moveChild(item,x,y);
+ moveChild(item,x+diff,y);
// qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y);
//item->updateItem();
}
// Adjust sub cell geometry of all conflict items of all conflict items
for ( item=conflictItems.first(); item != 0;
item=conflictItems.next() ) {
@@ -1240,38 +1242,40 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
KOAgendaItem *item2;
QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems();
for ( item2=conflictItems2.first(); item2 != 0;
item2=conflictItems2.next() ) {
if ( item2->subCells() != maxSubCells) {
item2->setSubCells(maxSubCells);
+ int diff = 0;
if (mAllDayMode) {
- item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth);
+ diff = item2->resizeMe(mGridSpacingX, item2->cellWidth() * mGridSpacingX, newSubCellWidth);
} else {
item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY);
}
int x,y;
gridToContents(item2->cellX(),item2->cellYTop(),x,y);
if (mAllDayMode) {
y += item2->subCell() * newSubCellWidth;
} else {
x += item2->subCell() * newSubCellWidth;
}
- moveChild(item2,x,y);
+ moveChild(item2,x+diff,y);
//qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() );
}
}
}
}
} else {
placeItem->setSubCell(0);
placeItem->setSubCells(1);
- if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY);
+ int diff = 0;
+ if (mAllDayMode) diff = placeItem->resizeMe( mGridSpacingX, placeItem->width(),mGridSpacingY);
else placeItem->resize(mGridSpacingX,placeItem->height());
int x,y;
gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y);
- moveChild(placeItem,x,y);
+ moveChild(placeItem,x+diff,y);
}
placeItem->setConflictItems(conflictItems);
// for ( item=conflictItems.first(); item != 0;
// item=conflictItems.next() ) {
// //item->updateItem();
// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() );
@@ -1392,28 +1396,29 @@ void KOAgenda::finishUpdate()
globalFlagBlockAgendaItemPaint = 1;
// Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
if ( !item->checkLayout() ) {
//qDebug(" conflictitem found ");
int newSubCellWidth;
+ int diff = 0;
if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells();
else newSubCellWidth = mGridSpacingX / item->subCells();
if (mAllDayMode) {
- item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth);
+ diff = item->resizeMe(mGridSpacingX, item->cellWidth() * mGridSpacingX, newSubCellWidth);
} else {
item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
}
int x,y;
gridToContents(item->cellX(),item->cellYTop(),x,y);
if (mAllDayMode) {
y += item->subCell() * newSubCellWidth;
} else {
x += item->subCell() * newSubCellWidth;
}
- moveChild(item,x,y);
+ moveChild(item,x+diff,y);
}
}
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
if ( !item->isVisible() )
item->show();
@@ -1833,13 +1838,13 @@ KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,i
}
KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
agendaItem->setCellXY(XBegin,0,0);
agendaItem->setCellXWidth(XEnd);
- agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY);
+ agendaItem->resizeMe(mGridSpacingX, mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY);
//addChild(agendaItem,XBegin*mGridSpacingX,0);
mItems.append(agendaItem);
placeSubCells(agendaItem);
@@ -1939,16 +1944,17 @@ void KOAgenda::computeSizes()
// resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
KOAgendaItem *item;
int subCellWidth;
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
subCellWidth = mGridSpacingY / item->subCells();
- item->resize(mGridSpacingX * item->cellWidth(),subCellWidth);
- moveChild(item,KOGlobals::self()->reverseLayout() ?
+ int diff = 0;
+ diff = item->resizeMe(mGridSpacingX ,mGridSpacingX * item->cellWidth(),subCellWidth);
+ moveChild(item,(KOGlobals::self()->reverseLayout() ?
(mColumns - 1 - item->cellX()) * mGridSpacingX :
- item->cellX() * mGridSpacingX,
+ item->cellX() * mGridSpacingX) + diff,
item->subCell() * subCellWidth);
}
KOPrefs::instance()->mAllDaySize = mGridSpacingY;
} else {
mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns;
if (height() > mGridSpacingY * mRows + 1 ) {