summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-01-05 14:55:14 (UTC)
committer zautrix <zautrix>2005-01-05 14:55:14 (UTC)
commit71017beb975666a0f654898ed6a40a5303d567dc (patch) (unidiff)
tree39f3c0e3c890ee90806e93d9ce9bd9024be11d55 /korganizer
parentdf0200487afbfa59b80a79e548d70b5203019003 (diff)
downloadkdepimpi-71017beb975666a0f654898ed6a40a5303d567dc.zip
kdepimpi-71017beb975666a0f654898ed6a40a5303d567dc.tar.gz
kdepimpi-71017beb975666a0f654898ed6a40a5303d567dc.tar.bz2
minor fixes
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagenda.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 6532705..eb3791e 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1194,99 +1194,104 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i
1194 gxStart*mGridSpacingX; 1194 gxStart*mGridSpacingX;
1195 if (xStart < x1) xStart = x1; 1195 if (xStart < x1) xStart = x1;
1196 int xEnd = KOGlobals::self()->reverseLayout() ? 1196 int xEnd = KOGlobals::self()->reverseLayout() ?
1197 (mColumns - gxStart)*mGridSpacingX-1 : 1197 (mColumns - gxStart)*mGridSpacingX-1 :
1198 (gxStart+1)*mGridSpacingX-1; 1198 (gxStart+1)*mGridSpacingX-1;
1199 if (xEnd > x2) xEnd = x2; 1199 if (xEnd > x2) xEnd = x2;
1200 if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { 1200 if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) {
1201 if ( KOPrefs::instance()->mUseHighlightLightColor ) 1201 if ( KOPrefs::instance()->mUseHighlightLightColor )
1202 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1202 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1203 KOPrefs::instance()->mWorkingHoursColor.light()); 1203 KOPrefs::instance()->mWorkingHoursColor.light());
1204 else 1204 else
1205 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1205 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1206 KOPrefs::instance()->mWorkingHoursColor.dark()); 1206 KOPrefs::instance()->mWorkingHoursColor.dark());
1207 } else { 1207 } else {
1208 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1208 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1209 KOPrefs::instance()->mWorkingHoursColor); 1209 KOPrefs::instance()->mWorkingHoursColor);
1210 } 1210 }
1211 } 1211 }
1212 ++gxStart; 1212 ++gxStart;
1213 } 1213 }
1214 } 1214 }
1215 } 1215 }
1216 /* 1216 /*
1217 int selectionX = KOGlobals::self()->reverseLayout() ? 1217 int selectionX = KOGlobals::self()->reverseLayout() ?
1218 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1218 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1219 mSelectionCellX * mGridSpacingX; 1219 mSelectionCellX * mGridSpacingX;
1220 1220
1221 // Draw selection 1221 // Draw selection
1222 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1222 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1223 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1223 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1224 // TODO: paint only part within cx,cy,cw,ch 1224 // TODO: paint only part within cx,cy,cw,ch
1225 p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, 1225 p->fillRect( selectionX, mSelectionYTop, mGridSpacingX,
1226 mSelectionHeight, KOPrefs::instance()->mHighlightColor ); 1226 mSelectionHeight, KOPrefs::instance()->mHighlightColor );
1227 } 1227 }
1228 */ 1228 */
1229 // Draw vertical lines of grid 1229 // Draw vertical lines of grid
1230 1230
1231 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; 1231 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
1232 if ( mGridSpacingX > 0 ) { 1232 if ( mGridSpacingX > 0 ) {
1233 while (x < cx + cw) { 1233 while (x < cx + cw) {
1234 p->drawLine(x,cy,x,cy+ch); 1234 p->drawLine(x,cy,x,cy+ch);
1235 x+=mGridSpacingX; 1235 x+=mGridSpacingX;
1236 } 1236 }
1237 } 1237 }
1238 // Draw horizontal lines of grid 1238 // Draw horizontal lines of grid
1239 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; 1239 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY;
1240 if ( lGridSpacingY > 0 ) { 1240 if ( lGridSpacingY > 0 ) {
1241 while (y < cy + ch) { 1241 while (y < cy + ch) {
1242 p->setPen( SolidLine );
1243 p->drawLine(cx,y,cx+cw,y);
1244 y+=lGridSpacingY;
1245 p->setPen( DotLine );
1242 p->drawLine(cx,y,cx+cw,y); 1246 p->drawLine(cx,y,cx+cw,y);
1243 y+=lGridSpacingY; 1247 y+=lGridSpacingY;
1244 } 1248 }
1249 p->setPen( SolidLine );
1245 } 1250 }
1246 mPixPainter.end() ; 1251 mPixPainter.end() ;
1247} 1252}
1248 1253
1249/* 1254/*
1250 Convert srcollview contents coordinates to agenda grid coordinates. 1255 Convert srcollview contents coordinates to agenda grid coordinates.
1251*/ 1256*/
1252void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) 1257void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy)
1253{ 1258{
1254 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : 1259 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX :
1255 x/mGridSpacingX; 1260 x/mGridSpacingX;
1256 gy = y/mGridSpacingY; 1261 gy = y/mGridSpacingY;
1257} 1262}
1258 1263
1259/* 1264/*
1260 Convert agenda grid coordinates to scrollview contents coordinates. 1265 Convert agenda grid coordinates to scrollview contents coordinates.
1261*/ 1266*/
1262void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) 1267void KOAgenda::gridToContents (int gx, int gy, int& x, int& y)
1263{ 1268{
1264 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: 1269 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX:
1265 gx*mGridSpacingX; 1270 gx*mGridSpacingX;
1266 y = gy*mGridSpacingY; 1271 y = gy*mGridSpacingY;
1267} 1272}
1268 1273
1269 1274
1270/* 1275/*
1271 Return Y coordinate corresponding to time. Coordinates are rounded to fit into 1276 Return Y coordinate corresponding to time. Coordinates are rounded to fit into
1272 the grid. 1277 the grid.
1273*/ 1278*/
1274int KOAgenda::timeToY(const QTime &time) 1279int KOAgenda::timeToY(const QTime &time)
1275{ 1280{
1276 int minutesPerCell = 24 * 60 / mRows; 1281 int minutesPerCell = 24 * 60 / mRows;
1277 int timeMinutes = time.hour() * 60 + time.minute(); 1282 int timeMinutes = time.hour() * 60 + time.minute();
1278 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; 1283 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell;
1279 return Y; 1284 return Y;
1280} 1285}
1281 1286
1282 1287
1283/* 1288/*
1284 Return time corresponding to cell y coordinate. Coordinates are rounded to 1289 Return time corresponding to cell y coordinate. Coordinates are rounded to
1285 fit into the grid. 1290 fit into the grid.
1286*/ 1291*/
1287QTime KOAgenda::gyToTime(int gy) 1292QTime KOAgenda::gyToTime(int gy)
1288{ 1293{
1289 1294
1290 int secondsPerCell = 24 * 60 * 60/ mRows; 1295 int secondsPerCell = 24 * 60 * 60/ mRows;
1291 1296
1292 int timeSeconds = secondsPerCell * gy; 1297 int timeSeconds = secondsPerCell * gy;