summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index b5d52d2..148d914 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1313,143 +1313,194 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
1313 // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); 1313 // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y);
1314 //item->updateItem(); 1314 //item->updateItem();
1315 } 1315 }
1316 // Adjust sub cell geometry of all conflict items of all conflict items 1316 // Adjust sub cell geometry of all conflict items of all conflict items
1317 for ( item=conflictItems.first(); item != 0; 1317 for ( item=conflictItems.first(); item != 0;
1318 item=conflictItems.next() ) { 1318 item=conflictItems.next() ) {
1319 if ( placeItem != item ) { 1319 if ( placeItem != item ) {
1320 KOAgendaItem *item2; 1320 KOAgendaItem *item2;
1321 QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); 1321 QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems();
1322 for ( item2=conflictItems2.first(); item2 != 0; 1322 for ( item2=conflictItems2.first(); item2 != 0;
1323 item2=conflictItems2.next() ) { 1323 item2=conflictItems2.next() ) {
1324 if ( item2->subCells() != maxSubCells) { 1324 if ( item2->subCells() != maxSubCells) {
1325 item2->setSubCells(maxSubCells); 1325 item2->setSubCells(maxSubCells);
1326 if (mAllDayMode) { 1326 if (mAllDayMode) {
1327 item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); 1327 item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth);
1328 } else { 1328 } else {
1329 item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); 1329 item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY);
1330 } 1330 }
1331 int x,y; 1331 int x,y;
1332 gridToContents(item2->cellX(),item2->cellYTop(),x,y); 1332 gridToContents(item2->cellX(),item2->cellYTop(),x,y);
1333 if (mAllDayMode) { 1333 if (mAllDayMode) {
1334 y += item2->subCell() * newSubCellWidth; 1334 y += item2->subCell() * newSubCellWidth;
1335 } else { 1335 } else {
1336 x += item2->subCell() * newSubCellWidth; 1336 x += item2->subCell() * newSubCellWidth;
1337 } 1337 }
1338 moveChild(item2,x,y); 1338 moveChild(item2,x,y);
1339 //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); 1339 //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() );
1340 } 1340 }
1341 } 1341 }
1342 } 1342 }
1343 } 1343 }
1344 } else { 1344 } else {
1345 placeItem->setSubCell(0); 1345 placeItem->setSubCell(0);
1346 placeItem->setSubCells(1); 1346 placeItem->setSubCells(1);
1347 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); 1347 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY);
1348 else placeItem->resize(mGridSpacingX,placeItem->height()); 1348 else placeItem->resize(mGridSpacingX,placeItem->height());
1349 int x,y; 1349 int x,y;
1350 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); 1350 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y);
1351 moveChild(placeItem,x,y); 1351 moveChild(placeItem,x,y);
1352 } 1352 }
1353 placeItem->setConflictItems(conflictItems); 1353 placeItem->setConflictItems(conflictItems);
1354 // for ( item=conflictItems.first(); item != 0; 1354 // for ( item=conflictItems.first(); item != 0;
1355// item=conflictItems.next() ) { 1355// item=conflictItems.next() ) {
1356// //item->updateItem(); 1356// //item->updateItem();
1357// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); 1357// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() );
1358// } 1358// }
1359// placeItem->updateItem(); 1359// placeItem->updateItem();
1360} 1360}
1361 1361
1362void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 1362void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1363{ 1363{
1364 if ( globalFlagBlockAgenda ) 1364 if ( globalFlagBlockAgenda )
1365 return; 1365 return;
1366 //qDebug("KOAgenda::drawContents "); 1366 //qDebug("KOAgenda::drawContents ");
1367 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) 1367 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() )
1368 ;//drawContentsToPainter(); 1368 ;//drawContentsToPainter();
1369 1369
1370 QPaintDevice* pd = p->device(); 1370 QPaintDevice* pd = p->device();
1371 p->end(); 1371 p->end();
1372 int vx, vy; 1372 int vx, vy;
1373 int selectionX = KOGlobals::self()->reverseLayout() ? 1373 int selectionX = KOGlobals::self()->reverseLayout() ?
1374 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1374 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1375 mSelectionCellX * mGridSpacingX; 1375 mSelectionCellX * mGridSpacingX;
1376 contentsToViewport ( cx, cy, vx,vy); 1376 contentsToViewport ( cx, cy, vx,vy);
1377 //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ;
1378
1379 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) {
1380 if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1381 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) {
1382
1383 int vxSel, vySel;
1384 contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel);
1385 int off = mSelectionHeight;
1386 if ( vySel < 0 )
1387 off += vySel;
1388 //qDebug("OFF %d %d %d", off,vySel, vy );
1389 bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP);
1390 } else {
1391 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP);
1392 }
1393 }
1394 if ( mSelectionHeight > 0 ) {
1395 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
1396 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1397 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1398 contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
1399 bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
1400 }
1401 }
1402 //qDebug("btbl ");
1403 p->begin( pd );
1404 //qDebug("end ");
1405#if 0
1406
1407 if ( globalFlagBlockAgenda )
1408 return;
1409 //qDebug("KOAgenda::drawContents ");
1410 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() )
1411 ;//drawContentsToPainter();
1412
1413 QPaintDevice* pd = p->device();
1414 p->end();
1415 int vx, vy;
1416 int selectionX = KOGlobals::self()->reverseLayout() ?
1417 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1418 mSelectionCellX * mGridSpacingX;
1419 contentsToViewport ( cx, cy, vx,vy);
1377 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; 1420 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ;
1378 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) 1421 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) )
1379 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); 1422 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP);
1380 1423
1381 if ( mSelectionHeight > 0 ) { 1424 if ( mSelectionHeight > 0 ) {
1382 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); 1425 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
1383 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1426 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1384 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1427 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1385 contentsToViewport ( selectionX, mSelectionYTop, vx,vy); 1428 contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
1386 bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); 1429 bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
1387 } 1430 }
1388 } 1431 }
1389 //qDebug("btbl "); 1432 //qDebug("btbl ");
1390 p->begin( pd ); 1433 p->begin( pd );
1391 //qDebug("end "); 1434 //qDebug("end ");
1435
1436
1437
1438
1439
1440
1441
1442#endif
1392} 1443}
1393 1444
1394void KOAgenda::finishUpdate() 1445void KOAgenda::finishUpdate()
1395{ 1446{
1396 1447
1397 KOAgendaItem *item; 1448 KOAgendaItem *item;
1398 globalFlagBlockAgendaItemPaint = 1; 1449 globalFlagBlockAgendaItemPaint = 1;
1399 // 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 1450 // 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
1400 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1451 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1401 if ( !item->checkLayout() ) { 1452 if ( !item->checkLayout() ) {
1402 //qDebug(" conflictitem found "); 1453 //qDebug(" conflictitem found ");
1403 int newSubCellWidth; 1454 int newSubCellWidth;
1404 if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); 1455 if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells();
1405 else newSubCellWidth = mGridSpacingX / item->subCells(); 1456 else newSubCellWidth = mGridSpacingX / item->subCells();
1406 1457
1407 if (mAllDayMode) { 1458 if (mAllDayMode) {
1408 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); 1459 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth);
1409 } else { 1460 } else {
1410 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); 1461 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
1411 } 1462 }
1412 int x,y; 1463 int x,y;
1413 gridToContents(item->cellX(),item->cellYTop(),x,y); 1464 gridToContents(item->cellX(),item->cellYTop(),x,y);
1414 if (mAllDayMode) { 1465 if (mAllDayMode) {
1415 y += item->subCell() * newSubCellWidth; 1466 y += item->subCell() * newSubCellWidth;
1416 } else { 1467 } else {
1417 x += item->subCell() * newSubCellWidth; 1468 x += item->subCell() * newSubCellWidth;
1418 } 1469 }
1419 moveChild(item,x,y); 1470 moveChild(item,x,y);
1420 } 1471 }
1421 } 1472 }
1422 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1473 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1423 if ( !item->isVisible() ) 1474 if ( !item->isVisible() )
1424 item->show(); 1475 item->show();
1425 1476
1426 } 1477 }
1427 globalFlagBlockAgendaItemUpdate = 0; 1478 globalFlagBlockAgendaItemUpdate = 0;
1428 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1479 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1429 item->repaintMe( ); 1480 item->repaintMe( );
1430 } 1481 }
1431 globalFlagBlockAgendaItemUpdate = 1; 1482 globalFlagBlockAgendaItemUpdate = 1;
1432 qApp->processEvents(); 1483 qApp->processEvents();
1433 globalFlagBlockAgendaItemPaint = 0; 1484 globalFlagBlockAgendaItemPaint = 0;
1434 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1485 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1435 item->repaint( false ); 1486 item->repaint( false );
1436 } 1487 }
1437 1488
1438} 1489}
1439 1490
1440/* 1491/*
1441 Draw grid in the background of the agenda. 1492 Draw grid in the background of the agenda.
1442*/ 1493*/
1443void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) 1494void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch)
1444{ 1495{
1445 1496
1446 1497
1447 if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) 1498 if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask )
1448 return; 1499 return;
1449 if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) 1500 if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 )
1450 return; 1501 return;
1451 int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); 1502 int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight();
1452 if ( ch < 1 ) 1503 if ( ch < 1 )
1453 ch = 1; 1504 ch = 1;
1454 if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { 1505 if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) {
1455 mPaintPixmap.resize( contentsWidth()+42, ch ); 1506 mPaintPixmap.resize( contentsWidth()+42, ch );