author | zautrix <zautrix> | 2005-07-04 21:23:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-04 21:23:46 (UTC) |
commit | 35f1ad23e06a0f6014d98c952e8b8652b5cffc49 (patch) (unidiff) | |
tree | 4c3b222a9d2baff7b43c366bb0bfa1fab24a5177 | |
parent | 2767ffda27fa0e88816832d4b2c6efdd0c52a8eb (diff) | |
download | kdepimpi-35f1ad23e06a0f6014d98c952e8b8652b5cffc49.zip kdepimpi-35f1ad23e06a0f6014d98c952e8b8652b5cffc49.tar.gz kdepimpi-35f1ad23e06a0f6014d98c952e8b8652b5cffc49.tar.bz2 |
highlight pix smaller
-rw-r--r-- | korganizer/koagenda.cpp | 225 |
1 files changed, 113 insertions, 112 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 63fdecd..9b817bc 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1412,119 +1412,121 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i | |||
1412 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); | 1412 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); |
1413 | 1413 | ||
1414 | //--cx;++cw; | 1414 | //--cx;++cw; |
1415 | int lGridSpacingY = mGridSpacingY*2; | 1415 | int lGridSpacingY = mGridSpacingY*2; |
1416 | int selDay; | 1416 | int selDay; |
1417 | if ( !backgroundOnly ) | 1417 | QDate curDate = QDate::currentDate(); |
1418 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) | 1418 | if ( !backgroundOnly ) { |
1419 | { | 1419 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) |
1420 | if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { | 1420 | { |
1421 | int x1 = cx; | 1421 | if ( mSelectedDates[selDay] == curDate && KOPrefs::instance()->mHighlightCurrentDay) { |
1422 | int y1 = 0; | 1422 | int x1 = cx; |
1423 | if (y1 < cy) y1 = cy; | 1423 | int y1 = 0; |
1424 | int x2 = cx+cw-1; | 1424 | if (y1 < cy) y1 = cy; |
1425 | int y2 = contentsHeight(); | 1425 | int x2 = cx+cw-1; |
1426 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1426 | int y2 = contentsHeight(); |
1427 | if (x2 >= x1 && y2 >= y1) { | 1427 | if (y2 > cy+ch-1) y2=cy+ch-1; |
1428 | int gxStart = selDay; | 1428 | if (x2 >= x1 && y2 >= y1) { |
1429 | int gxEnd = gxStart ; | 1429 | int gxStart = selDay; |
1430 | int xStart = KOGlobals::self()->reverseLayout() ? | 1430 | int gxEnd = gxStart ; |
1431 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1431 | int xStart = KOGlobals::self()->reverseLayout() ? |
1432 | gxStart*mGridSpacingX; | 1432 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1433 | if (xStart < x1) xStart = x1; | 1433 | gxStart*mGridSpacingX; |
1434 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1434 | if (xStart < x1) xStart = x1; |
1435 | (mColumns - gxStart)*mGridSpacingX-1 : | 1435 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1436 | (gxStart+1)*mGridSpacingX-1; | 1436 | (mColumns - gxStart)*mGridSpacingX-1 : |
1437 | if (xEnd > x2) xEnd = x2; | 1437 | (gxStart+1)*mGridSpacingX-1; |
1438 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1438 | if (xEnd > x2) xEnd = x2; |
1439 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1439 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1440 | KOPrefs::instance()->mAgendaBgColor.light()); | 1440 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1441 | else | 1441 | KOPrefs::instance()->mAgendaBgColor.light()); |
1442 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1442 | else |
1443 | KOPrefs::instance()->mAgendaBgColor.dark()); | 1443 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1444 | KOPrefs::instance()->mAgendaBgColor.dark()); | ||
1444 | 1445 | ||
1445 | } | 1446 | } |
1446 | } | 1447 | } |
1447 | } | 1448 | } |
1448 | // Highlight working hours | 1449 | } |
1449 | 1450 | // Highlight working hours | |
1450 | if ( !backgroundOnly ) | 1451 | |
1451 | if (mWorkingHoursEnable) { | 1452 | if ( !backgroundOnly ) |
1452 | int x1 = cx; | 1453 | if (mWorkingHoursEnable) { |
1453 | int y1 = mWorkingHoursYTop; | 1454 | int x1 = cx; |
1454 | if (y1 < cy) y1 = cy; | 1455 | int y1 = mWorkingHoursYTop; |
1455 | int x2 = cx+cw-1; | 1456 | if (y1 < cy) y1 = cy; |
1456 | // int x2 = mGridSpacingX * 5 - 1; | 1457 | int x2 = cx+cw-1; |
1457 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; | 1458 | // int x2 = mGridSpacingX * 5 - 1; |
1458 | int y2 = mWorkingHoursYBottom; | 1459 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; |
1459 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1460 | int y2 = mWorkingHoursYBottom; |
1460 | 1461 | if (y2 > cy+ch-1) y2=cy+ch-1; | |
1461 | if (x2 >= x1 && y2 >= y1) { | 1462 | |
1462 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); | 1463 | if (x2 >= x1 && y2 >= y1) { |
1463 | int gxStart = x1/mGridSpacingX; | 1464 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); |
1464 | int gxEnd = x2/mGridSpacingX; | 1465 | int gxStart = x1/mGridSpacingX; |
1465 | while(gxStart <= gxEnd) { | 1466 | int gxEnd = x2/mGridSpacingX; |
1466 | if (gxStart < int(mHolidayMask->count()) && | 1467 | while(gxStart <= gxEnd) { |
1467 | !mHolidayMask->at(gxStart)) { | 1468 | if (gxStart < int(mHolidayMask->count()) && |
1468 | int xStart = KOGlobals::self()->reverseLayout() ? | 1469 | !mHolidayMask->at(gxStart)) { |
1469 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1470 | int xStart = KOGlobals::self()->reverseLayout() ? |
1470 | gxStart*mGridSpacingX; | 1471 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1471 | if (xStart < x1) xStart = x1; | 1472 | gxStart*mGridSpacingX; |
1472 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1473 | if (xStart < x1) xStart = x1; |
1473 | (mColumns - gxStart)*mGridSpacingX-1 : | 1474 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1474 | (gxStart+1)*mGridSpacingX-1; | 1475 | (mColumns - gxStart)*mGridSpacingX-1 : |
1475 | if (xEnd > x2) xEnd = x2; | 1476 | (gxStart+1)*mGridSpacingX-1; |
1476 | if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { | 1477 | if (xEnd > x2) xEnd = x2; |
1477 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1478 | if ( mSelectedDates[gxStart] == curDate && KOPrefs::instance()->mHighlightCurrentDay ) { |
1478 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1479 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1479 | KOPrefs::instance()->mWorkingHoursColor.light()); | 1480 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1480 | else | 1481 | KOPrefs::instance()->mWorkingHoursColor.light()); |
1481 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1482 | else |
1482 | KOPrefs::instance()->mWorkingHoursColor.dark()); | 1483 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1483 | } else { | 1484 | KOPrefs::instance()->mWorkingHoursColor.dark()); |
1484 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1485 | } else { |
1485 | KOPrefs::instance()->mWorkingHoursColor); | 1486 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1486 | } | 1487 | KOPrefs::instance()->mWorkingHoursColor); |
1488 | } | ||
1489 | } | ||
1490 | ++gxStart; | ||
1491 | } | ||
1492 | } | ||
1487 | } | 1493 | } |
1488 | ++gxStart; | 1494 | /* |
1495 | int selectionX = KOGlobals::self()->reverseLayout() ? | ||
1496 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | ||
1497 | mSelectionCellX * mGridSpacingX; | ||
1498 | |||
1499 | // Draw selection | ||
1500 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | ||
1501 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | ||
1502 | // TODO: paint only part within cx,cy,cw,ch | ||
1503 | p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, | ||
1504 | mSelectionHeight, KOPrefs::instance()->mHighlightColor ); | ||
1489 | } | 1505 | } |
1490 | } | 1506 | */ |
1491 | } | 1507 | // Draw vertical lines of grid |
1492 | /* | ||
1493 | int selectionX = KOGlobals::self()->reverseLayout() ? | ||
1494 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | ||
1495 | mSelectionCellX * mGridSpacingX; | ||
1496 | |||
1497 | // Draw selection | ||
1498 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | ||
1499 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | ||
1500 | // TODO: paint only part within cx,cy,cw,ch | ||
1501 | p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, | ||
1502 | mSelectionHeight, KOPrefs::instance()->mHighlightColor ); | ||
1503 | } | ||
1504 | */ | ||
1505 | // Draw vertical lines of grid | ||
1506 | 1508 | ||
1507 | int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; | 1509 | int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; |
1508 | if ( mGridSpacingX > 0 ) { | 1510 | if ( mGridSpacingX > 0 ) { |
1509 | while (x < cx + cw) { | 1511 | while (x < cx + cw) { |
1510 | p->drawLine(x,cy,x,cy+ch); | 1512 | p->drawLine(x,cy,x,cy+ch); |
1511 | x+=mGridSpacingX; | 1513 | x+=mGridSpacingX; |
1512 | } | 1514 | } |
1513 | } | 1515 | } |
1514 | // Draw horizontal lines of grid | 1516 | // Draw horizontal lines of grid |
1515 | int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; | 1517 | int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; |
1516 | if ( lGridSpacingY > 0 ) { | 1518 | if ( lGridSpacingY > 0 ) { |
1517 | while (y < cy + ch) { | 1519 | while (y < cy + ch) { |
1518 | p->setPen( SolidLine ); | 1520 | p->setPen( SolidLine ); |
1519 | p->drawLine(cx,y,cx+cw,y); | 1521 | p->drawLine(cx,y,cx+cw,y); |
1520 | y+=lGridSpacingY; | 1522 | y+=lGridSpacingY; |
1521 | p->setPen( DotLine ); | 1523 | p->setPen( DotLine ); |
1522 | p->drawLine(cx,y,cx+cw,y); | 1524 | p->drawLine(cx,y,cx+cw,y); |
1523 | y+=lGridSpacingY; | 1525 | y+=lGridSpacingY; |
1524 | } | 1526 | } |
1525 | p->setPen( SolidLine ); | 1527 | p->setPen( SolidLine ); |
1526 | } | 1528 | } |
1527 | mPixPainter.end() ; | 1529 | mPixPainter.end() ; |
1528 | } | 1530 | } |
1529 | 1531 | ||
1530 | /* | 1532 | /* |
@@ -1676,15 +1678,14 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | |||
1676 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) | 1678 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) |
1677 | return; | 1679 | return; |
1678 | //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); | 1680 | //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); |
1679 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); | 1681 | QDate currentDate = QDate::currentDate(); |
1680 | QDate currentDate; | 1682 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda ); |
1681 | QDateTime dt; | 1683 | QDateTime dt; |
1682 | if ( todo->hasCompletedDate() ) | 1684 | if ( todo->hasCompletedDate() ) |
1683 | dt = todo->completed(); | 1685 | dt = todo->completed(); |
1684 | else | 1686 | else |
1685 | dt = todo->dtDue(); | 1687 | dt = todo->dtDue(); |
1686 | if ( overdue ) { | 1688 | if ( overdue ) { |
1687 | currentDate = QDate::currentDate(); | ||
1688 | days += todo->dtDue().date().daysTo( currentDate ); | 1689 | days += todo->dtDue().date().daysTo( currentDate ); |
1689 | } | 1690 | } |
1690 | else | 1691 | else |