author | zautrix <zautrix> | 2005-03-18 15:11:51 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-18 15:11:51 (UTC) |
commit | 66bc0202d4e2306f7029362fe09d0c7ab0e7cc36 (patch) (unidiff) | |
tree | eafee97f377c32339488833065313c2494e1f5a5 | |
parent | 414cb038cbe353f2fdb90969bc2531b687acc85f (diff) | |
download | kdepimpi-66bc0202d4e2306f7029362fe09d0c7ab0e7cc36.zip kdepimpi-66bc0202d4e2306f7029362fe09d0c7ab0e7cc36.tar.gz kdepimpi-66bc0202d4e2306f7029362fe09d0c7ab0e7cc36.tar.bz2 |
rec fix
-rw-r--r-- | korganizer/komonthview.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 004ff50..cb69832 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1135,292 +1135,301 @@ void KOMonthView::updateDayLabels() | |||
1135 | for (int i = 0; i < 7; i++) { | 1135 | for (int i = 0; i < 7; i++) { |
1136 | if (mWeekStartsMonday) { | 1136 | if (mWeekStartsMonday) { |
1137 | bool show = mShortDayLabelsW; | 1137 | bool show = mShortDayLabelsW; |
1138 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1138 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1139 | show = true; | 1139 | show = true; |
1140 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1140 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1141 | } else { | 1141 | } else { |
1142 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); | 1142 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); |
1143 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); | 1143 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); |
1144 | 1144 | ||
1145 | } | 1145 | } |
1146 | } | 1146 | } |
1147 | mDayLabelsT = &mDayLabels; | 1147 | mDayLabelsT = &mDayLabels; |
1148 | for (int i = 0; i < 7; i++) { | 1148 | for (int i = 0; i < 7; i++) { |
1149 | if (mWeekStartsMonday) { | 1149 | if (mWeekStartsMonday) { |
1150 | bool show = mShortDayLabelsM; | 1150 | bool show = mShortDayLabelsM; |
1151 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1151 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1152 | show = true; | 1152 | show = true; |
1153 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1153 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1154 | } else { | 1154 | } else { |
1155 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); | 1155 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); |
1156 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); | 1156 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); |
1157 | 1157 | ||
1158 | } | 1158 | } |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | } | 1161 | } |
1162 | 1162 | ||
1163 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1163 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1164 | { | 1164 | { |
1165 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1165 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1166 | 1166 | ||
1167 | QPtrVector<MonthViewCell> *cells; | 1167 | QPtrVector<MonthViewCell> *cells; |
1168 | QPtrVector<QLabel> *dayLabels; | 1168 | QPtrVector<QLabel> *dayLabels; |
1169 | QPtrVector<KOWeekButton> *weekLabels; | 1169 | QPtrVector<KOWeekButton> *weekLabels; |
1170 | int weekNum = 6; | 1170 | int weekNum = 6; |
1171 | if ( mShowWeekView ) { | 1171 | if ( mShowWeekView ) { |
1172 | weekNum = 1; | 1172 | weekNum = 1; |
1173 | cells = &mCellsW; | 1173 | cells = &mCellsW; |
1174 | dayLabels = &mDayLabelsW; | 1174 | dayLabels = &mDayLabelsW; |
1175 | weekLabels = &mWeekLabelsW; | 1175 | weekLabels = &mWeekLabelsW; |
1176 | } else { | 1176 | } else { |
1177 | cells = &mCells; | 1177 | cells = &mCells; |
1178 | dayLabels = &mDayLabels; | 1178 | dayLabels = &mDayLabels; |
1179 | weekLabels = &mWeekLabels; | 1179 | weekLabels = &mWeekLabels; |
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | mStartDate = start; | 1182 | mStartDate = start; |
1183 | 1183 | ||
1184 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1184 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1185 | 1185 | ||
1186 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1186 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1187 | mStartDate = mStartDate.addDays( -1 ); | 1187 | mStartDate = mStartDate.addDays( -1 ); |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | bool primary = false; | 1190 | bool primary = false; |
1191 | uint i; | 1191 | uint i; |
1192 | for( i = 0; i < (*cells).size(); ++i ) { | 1192 | for( i = 0; i < (*cells).size(); ++i ) { |
1193 | QDate date = mStartDate.addDays( i ); | 1193 | QDate date = mStartDate.addDays( i ); |
1194 | (*cells)[i]->setDate( date ); | 1194 | (*cells)[i]->setDate( date ); |
1195 | 1195 | ||
1196 | #ifndef KORG_NOPLUGINS | 1196 | #ifndef KORG_NOPLUGINS |
1197 | // add holiday, if present | 1197 | // add holiday, if present |
1198 | QString hstring(KOCore::self()->holiday(date)); | 1198 | QString hstring(KOCore::self()->holiday(date)); |
1199 | (*cells)[i]->setHoliday( hstring ); | 1199 | (*cells)[i]->setHoliday( hstring ); |
1200 | #endif | 1200 | #endif |
1201 | 1201 | ||
1202 | } | 1202 | } |
1203 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1203 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
1204 | for( i = 0; i < weekNum; ++i ) { | 1204 | for( i = 0; i < weekNum; ++i ) { |
1205 | int wno; | 1205 | int wno; |
1206 | // remember, according to ISO 8601, the first week of the year is the | 1206 | // remember, according to ISO 8601, the first week of the year is the |
1207 | // first week that contains a thursday. Thus we must subtract off 4, | 1207 | // first week that contains a thursday. Thus we must subtract off 4, |
1208 | // not just 1. | 1208 | // not just 1. |
1209 | int dayOfYear = date.dayOfYear(); | 1209 | int dayOfYear = date.dayOfYear(); |
1210 | if (dayOfYear % 7 != 0) | 1210 | if (dayOfYear % 7 != 0) |
1211 | wno = dayOfYear / 7 + 1; | 1211 | wno = dayOfYear / 7 + 1; |
1212 | else | 1212 | else |
1213 | wno =dayOfYear / 7; | 1213 | wno =dayOfYear / 7; |
1214 | (*weekLabels)[i]->setWeekNum( wno ); | 1214 | (*weekLabels)[i]->setWeekNum( wno ); |
1215 | date = date.addDays( 7 ); | 1215 | date = date.addDays( 7 ); |
1216 | } | 1216 | } |
1217 | updateView(); | 1217 | updateView(); |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | void KOMonthView::showEvents(QPtrList<Event>) | 1220 | void KOMonthView::showEvents(QPtrList<Event>) |
1221 | { | 1221 | { |
1222 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1222 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | void KOMonthView::changeEventDisplay(Event *, int) | 1225 | void KOMonthView::changeEventDisplay(Event *, int) |
1226 | { | 1226 | { |
1227 | // this should be re-written to be much more efficient, but this | 1227 | // this should be re-written to be much more efficient, but this |
1228 | // quick-and-dirty-hack gets the job done for right now. | 1228 | // quick-and-dirty-hack gets the job done for right now. |
1229 | updateView(); | 1229 | updateView(); |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | void KOMonthView::updateView() | 1232 | void KOMonthView::updateView() |
1233 | { | 1233 | { |
1234 | 1234 | ||
1235 | if ( !updatePossible ) | 1235 | if ( !updatePossible ) |
1236 | return; | 1236 | return; |
1237 | //QTime ti; | 1237 | //QTime ti; |
1238 | //ti.start(); | 1238 | //ti.start(); |
1239 | clearSelection(); | 1239 | clearSelection(); |
1240 | QPtrVector<MonthViewCell> *cells; | 1240 | QPtrVector<MonthViewCell> *cells; |
1241 | if ( mShowWeekView ) { | 1241 | if ( mShowWeekView ) { |
1242 | cells = &mCellsW; | 1242 | cells = &mCellsW; |
1243 | } else { | 1243 | } else { |
1244 | cells = &mCells; | 1244 | cells = &mCells; |
1245 | } | 1245 | } |
1246 | #if 1 | 1246 | #if 1 |
1247 | int i; | 1247 | int i; |
1248 | int timeSpan = (*cells).size()-1; | 1248 | int timeSpan = (*cells).size()-1; |
1249 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1249 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1250 | timeSpan = 6; | 1250 | timeSpan = 6; |
1251 | for( i = 0; i < timeSpan + 1; ++i ) { | 1251 | for( i = 0; i < timeSpan + 1; ++i ) { |
1252 | (*cells)[i]->startUpdateCell(); | 1252 | (*cells)[i]->startUpdateCell(); |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | QPtrList<Event> events = calendar()->events(); | 1255 | QPtrList<Event> events = calendar()->events(); |
1256 | Event *event; | 1256 | Event *event; |
1257 | QDateTime dt; | 1257 | QDateTime dt; |
1258 | bool ok; | 1258 | bool ok; |
1259 | QDate endDate = mStartDate.addDays( timeSpan ); | 1259 | QDate endDate = mStartDate.addDays( timeSpan ); |
1260 | for( event = events.first(); event; event = events.next() ) { // for event | 1260 | for( event = events.first(); event; event = events.next() ) { // for event |
1261 | if ( event->doesRecur() ) { | 1261 | if ( event->doesRecur() ) { |
1262 | bool last; | 1262 | bool last; |
1263 | qDebug("********************************************** "); | ||
1264 | qDebug("Event summary: %s ", event->summary().latin1()); | ||
1263 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1265 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1264 | QDateTime incidenceEnd; | 1266 | QDateTime incidenceEnd; |
1265 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1267 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1268 | qDebug("eventlen %d ", eventlen); | ||
1266 | bool invalid = false; | 1269 | bool invalid = false; |
1267 | while( true ) { | 1270 | while( true ) { |
1268 | if ( incidenceStart.isValid() ) { | 1271 | if ( incidenceStart.isValid() ) { |
1269 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1272 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1270 | int st = incidenceStart.date().daysTo( endDate ); | 1273 | int st = incidenceStart.date().daysTo( endDate ); |
1271 | if ( st >= 0 ) { // start before timeend | 1274 | if ( st >= 0 ) { // start before timeend |
1272 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1275 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1273 | if ( end >= 0 ) { // end after timestart --- got one! | 1276 | if ( end >= 0 ) { // end after timestart --- got one! |
1274 | //normalize | 1277 | //normalize |
1275 | st = timeSpan - st; | 1278 | st = timeSpan - st; |
1276 | if ( st < 0 ) st = 0; | 1279 | if ( st < 0 ) st = 0; |
1277 | if ( end > timeSpan ) end = timeSpan; | 1280 | if ( end > timeSpan ) end = timeSpan; |
1278 | int iii; | 1281 | int iii; |
1279 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1282 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1280 | for ( iii = st;iii<= end;++iii) | 1283 | for ( iii = st;iii<= end;++iii) |
1281 | (*cells)[iii]->insertEvent( event ); | 1284 | (*cells)[iii]->insertEvent( event ); |
1282 | } | 1285 | } |
1283 | } | 1286 | } |
1284 | } else { | 1287 | } else { |
1285 | if ( invalid ) | 1288 | if ( invalid ) |
1286 | break; | 1289 | break; |
1287 | invalid = true; | 1290 | invalid = true; |
1288 | //qDebug("invalid %s", event->summary().latin1()); | 1291 | qDebug("invalid %s", event->summary().latin1()); |
1289 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 1292 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1290 | } | 1293 | } |
1291 | if ( last ) | 1294 | if ( last ) |
1292 | break; | 1295 | break; |
1293 | bool ok; | 1296 | bool ok; |
1297 | qDebug("TRY next occurence %s ", incidenceStart.toString().latin1()); | ||
1294 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1298 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1295 | if ( ! ok ) | 1299 | if ( ! ok ) { |
1300 | qDebug("NOT OK "); | ||
1296 | break; | 1301 | break; |
1297 | if ( incidenceStart.date() > endDate ) | 1302 | } |
1303 | if ( incidenceStart.date() > endDate ) { | ||
1304 | qDebug("incidenceStart.date() > endDate "); | ||
1298 | break; | 1305 | break; |
1306 | } | ||
1307 | qDebug("next occurence %s ", incidenceStart.toString().latin1()); | ||
1299 | } | 1308 | } |
1300 | } else { // no recur | 1309 | } else { // no recur |
1301 | int st = event->dtStart().date().daysTo( endDate ); | 1310 | int st = event->dtStart().date().daysTo( endDate ); |
1302 | if ( st >= 0 ) { // start before timeend | 1311 | if ( st >= 0 ) { // start before timeend |
1303 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1312 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1304 | if ( end >= 0 ) { // end after timestart --- got one! | 1313 | if ( end >= 0 ) { // end after timestart --- got one! |
1305 | //normalize | 1314 | //normalize |
1306 | st = timeSpan - st; | 1315 | st = timeSpan - st; |
1307 | if ( st < 0 ) st = 0; | 1316 | if ( st < 0 ) st = 0; |
1308 | if ( end > timeSpan ) end = timeSpan; | 1317 | if ( end > timeSpan ) end = timeSpan; |
1309 | int iii; | 1318 | int iii; |
1310 | for ( iii = st;iii<= end;++iii) | 1319 | for ( iii = st;iii<= end;++iii) |
1311 | (*cells)[iii]->insertEvent( event ); | 1320 | (*cells)[iii]->insertEvent( event ); |
1312 | } | 1321 | } |
1313 | } | 1322 | } |
1314 | } | 1323 | } |
1315 | } | 1324 | } |
1316 | // insert due todos | 1325 | // insert due todos |
1317 | QPtrList<Todo> todos = calendar()->todos( ); | 1326 | QPtrList<Todo> todos = calendar()->todos( ); |
1318 | Todo *todo; | 1327 | Todo *todo; |
1319 | for(todo = todos.first(); todo; todo = todos.next()) { | 1328 | for(todo = todos.first(); todo; todo = todos.next()) { |
1320 | //insertTodo( todo ); | 1329 | //insertTodo( todo ); |
1321 | if ( todo->hasDueDate() ) { | 1330 | if ( todo->hasDueDate() ) { |
1322 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1331 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1323 | if ( day >= 0 && day < timeSpan + 1) { | 1332 | if ( day >= 0 && day < timeSpan + 1) { |
1324 | (*cells)[day]->insertTodo( todo ); | 1333 | (*cells)[day]->insertTodo( todo ); |
1325 | } | 1334 | } |
1326 | } | 1335 | } |
1327 | } | 1336 | } |
1328 | 1337 | ||
1329 | for( i = 0; i < timeSpan+1; ++i ) { | 1338 | for( i = 0; i < timeSpan+1; ++i ) { |
1330 | (*cells)[i]->finishUpdateCell(); | 1339 | (*cells)[i]->finishUpdateCell(); |
1331 | } | 1340 | } |
1332 | processSelectionChange(); | 1341 | processSelectionChange(); |
1333 | (*cells)[0]->setFocus(); | 1342 | (*cells)[0]->setFocus(); |
1334 | 1343 | ||
1335 | 1344 | ||
1336 | #else | 1345 | #else |
1337 | // old code | 1346 | // old code |
1338 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1347 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1339 | int i; | 1348 | int i; |
1340 | for( i = 0; i < (*cells).count(); ++i ) { | 1349 | for( i = 0; i < (*cells).count(); ++i ) { |
1341 | (*cells)[i]->updateCell(); | 1350 | (*cells)[i]->updateCell(); |
1342 | } | 1351 | } |
1343 | 1352 | ||
1344 | //qDebug("KOMonthView::updateView() "); | 1353 | //qDebug("KOMonthView::updateView() "); |
1345 | processSelectionChange(); | 1354 | processSelectionChange(); |
1346 | // qDebug("---------------------------------------------------------------------+ "); | 1355 | // qDebug("---------------------------------------------------------------------+ "); |
1347 | (*cells)[0]->setFocus(); | 1356 | (*cells)[0]->setFocus(); |
1348 | #endif | 1357 | #endif |
1349 | 1358 | ||
1350 | //qDebug("update time %d ", ti.elapsed()); | 1359 | //qDebug("update time %d ", ti.elapsed()); |
1351 | } | 1360 | } |
1352 | 1361 | ||
1353 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1362 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1354 | { | 1363 | { |
1355 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1364 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1356 | computeLayout(); | 1365 | computeLayout(); |
1357 | clPending = true; | 1366 | clPending = true; |
1358 | if ( mShowWeekView ) | 1367 | if ( mShowWeekView ) |
1359 | mCellsW[0]->setFocus(); | 1368 | mCellsW[0]->setFocus(); |
1360 | else | 1369 | else |
1361 | mCells[0]->setFocus(); | 1370 | mCells[0]->setFocus(); |
1362 | } | 1371 | } |
1363 | void KOMonthView::computeLayoutWeek() | 1372 | void KOMonthView::computeLayoutWeek() |
1364 | { | 1373 | { |
1365 | static int lastWid = 0; | 1374 | static int lastWid = 0; |
1366 | static int lastHei = 0; | 1375 | static int lastHei = 0; |
1367 | int daysToShow; | 1376 | int daysToShow; |
1368 | bool combinedSatSun = false; | 1377 | bool combinedSatSun = false; |
1369 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1378 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1370 | daysToShow = 6; | 1379 | daysToShow = 6; |
1371 | combinedSatSun = true; | 1380 | combinedSatSun = true; |
1372 | } | 1381 | } |
1373 | int tWid = topLevelWidget()->size().width(); | 1382 | int tWid = topLevelWidget()->size().width(); |
1374 | int tHei = topLevelWidget()->size().height(); | 1383 | int tHei = topLevelWidget()->size().height(); |
1375 | 1384 | ||
1376 | int wid = width();//e | 1385 | int wid = width();//e |
1377 | int hei = height()-1-mNavigatorBar->height(); | 1386 | int hei = height()-1-mNavigatorBar->height(); |
1378 | 1387 | ||
1379 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1388 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1380 | return; | 1389 | return; |
1381 | 1390 | ||
1382 | if ( lastWid == width() && lastHei == height() ) | 1391 | if ( lastWid == width() && lastHei == height() ) |
1383 | return; | 1392 | return; |
1384 | lastWid = width(); | 1393 | lastWid = width(); |
1385 | lastHei = height(); | 1394 | lastHei = height(); |
1386 | 1395 | ||
1387 | 1396 | ||
1388 | if ( wid < hei ) | 1397 | if ( wid < hei ) |
1389 | daysToShow = 2; | 1398 | daysToShow = 2; |
1390 | else | 1399 | else |
1391 | daysToShow = 3; | 1400 | daysToShow = 3; |
1392 | mShowSatSunComp = true; | 1401 | mShowSatSunComp = true; |
1393 | combinedSatSun = true; | 1402 | combinedSatSun = true; |
1394 | 1403 | ||
1395 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); | 1404 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); |
1396 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1405 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1397 | int weeklabelwid = fm.width( "888" ); | 1406 | int weeklabelwid = fm.width( "888" ); |
1398 | wid -= weeklabelwid; | 1407 | wid -= weeklabelwid; |
1399 | 1408 | ||
1400 | int colWid = wid / daysToShow; | 1409 | int colWid = wid / daysToShow; |
1401 | int lastCol = wid - ( colWid*6 ); | 1410 | int lastCol = wid - ( colWid*6 ); |
1402 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1411 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1403 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1412 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1404 | int colModulo = wid % daysToShow; | 1413 | int colModulo = wid % daysToShow; |
1405 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1414 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1406 | //qDebug("rowmod %d ", rowModulo); | 1415 | //qDebug("rowmod %d ", rowModulo); |
1407 | int i; | 1416 | int i; |
1408 | int x,y,w,h; | 1417 | int x,y,w,h; |
1409 | x= 0; | 1418 | x= 0; |
1410 | y= 0; | 1419 | y= 0; |
1411 | w = colWid; | 1420 | w = colWid; |
1412 | h = dayLabelHei ; | 1421 | h = dayLabelHei ; |
1413 | for ( i = 0; i < 7; i++) { | 1422 | for ( i = 0; i < 7; i++) { |
1414 | if ( i && !( i % daysToShow) && i < 6) { | 1423 | if ( i && !( i % daysToShow) && i < 6) { |
1415 | y += hei/(5-daysToShow); | 1424 | y += hei/(5-daysToShow); |
1416 | x = 0; | 1425 | x = 0; |
1417 | w = colWid; | 1426 | w = colWid; |
1418 | } | 1427 | } |
1419 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1428 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1420 | ++w; | 1429 | ++w; |
1421 | } | 1430 | } |
1422 | if ( i >= 5 ) { | 1431 | if ( i >= 5 ) { |
1423 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); | 1432 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); |
1424 | x -= (w/2 ); | 1433 | x -= (w/2 ); |
1425 | } | 1434 | } |
1426 | else | 1435 | else |