author | zautrix <zautrix> | 2005-02-05 11:26:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-05 11:26:35 (UTC) |
commit | 86c0d35262454a31ed7d50d3e20cbdace954ebdf (patch) (unidiff) | |
tree | 7ded091fe9111fe20014f8edbc5f338293e36386 /korganizer | |
parent | 3a822a4c4867acb28dc1b3b9557918d0971f732c (diff) | |
download | kdepimpi-86c0d35262454a31ed7d50d3e20cbdace954ebdf.zip kdepimpi-86c0d35262454a31ed7d50d3e20cbdace954ebdf.tar.gz kdepimpi-86c0d35262454a31ed7d50d3e20cbdace954ebdf.tar.bz2 |
another fixx
-rw-r--r-- | korganizer/komonthview.cpp | 2 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 26 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 11 |
3 files changed, 22 insertions, 17 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 31c5659..cb519b2 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1181,49 +1181,49 @@ void KOMonthView::updateView() | |||
1181 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1181 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1182 | bool invalid = false; | 1182 | bool invalid = false; |
1183 | while( true ) { | 1183 | while( true ) { |
1184 | if ( incidenceStart.isValid() ) { | 1184 | if ( incidenceStart.isValid() ) { |
1185 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1185 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1186 | int st = incidenceStart.date().daysTo( endDate ); | 1186 | int st = incidenceStart.date().daysTo( endDate ); |
1187 | if ( st >= 0 ) { // start before timeend | 1187 | if ( st >= 0 ) { // start before timeend |
1188 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1188 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1189 | if ( end >= 0 ) { // end after timestart --- got one! | 1189 | if ( end >= 0 ) { // end after timestart --- got one! |
1190 | //normalize | 1190 | //normalize |
1191 | st = timeSpan - st; | 1191 | st = timeSpan - st; |
1192 | if ( st < 0 ) st = 0; | 1192 | if ( st < 0 ) st = 0; |
1193 | if ( end > timeSpan ) end = timeSpan; | 1193 | if ( end > timeSpan ) end = timeSpan; |
1194 | int iii; | 1194 | int iii; |
1195 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1195 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1196 | for ( iii = st;iii<= end;++iii) | 1196 | for ( iii = st;iii<= end;++iii) |
1197 | (*cells)[iii]->insertEvent( event ); | 1197 | (*cells)[iii]->insertEvent( event ); |
1198 | } | 1198 | } |
1199 | } | 1199 | } |
1200 | } else { | 1200 | } else { |
1201 | if ( invalid ) | 1201 | if ( invalid ) |
1202 | break; | 1202 | break; |
1203 | invalid = true; | 1203 | invalid = true; |
1204 | //qDebug("invalid %s", event->summary().latin1()); | 1204 | //qDebug("invalid %s", event->summary().latin1()); |
1205 | incidenceStart = QDateTime( mStartDate ); | 1205 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1206 | } | 1206 | } |
1207 | if ( last ) | 1207 | if ( last ) |
1208 | break; | 1208 | break; |
1209 | bool ok; | 1209 | bool ok; |
1210 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1210 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1211 | if ( ! ok ) | 1211 | if ( ! ok ) |
1212 | break; | 1212 | break; |
1213 | if ( incidenceStart.date() > endDate ) | 1213 | if ( incidenceStart.date() > endDate ) |
1214 | break; | 1214 | break; |
1215 | } | 1215 | } |
1216 | } else { // no recur | 1216 | } else { // no recur |
1217 | int st = event->dtStart().date().daysTo( endDate ); | 1217 | int st = event->dtStart().date().daysTo( endDate ); |
1218 | if ( st >= 0 ) { // start before timeend | 1218 | if ( st >= 0 ) { // start before timeend |
1219 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1219 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1220 | if ( end >= 0 ) { // end after timestart --- got one! | 1220 | if ( end >= 0 ) { // end after timestart --- got one! |
1221 | //normalize | 1221 | //normalize |
1222 | st = timeSpan - st; | 1222 | st = timeSpan - st; |
1223 | if ( st < 0 ) st = 0; | 1223 | if ( st < 0 ) st = 0; |
1224 | if ( end > timeSpan ) end = timeSpan; | 1224 | if ( end > timeSpan ) end = timeSpan; |
1225 | int iii; | 1225 | int iii; |
1226 | for ( iii = st;iii<= end;++iii) | 1226 | for ( iii = st;iii<= end;++iii) |
1227 | (*cells)[iii]->insertEvent( event ); | 1227 | (*cells)[iii]->insertEvent( event ); |
1228 | } | 1228 | } |
1229 | } | 1229 | } |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 6bdee18..78d4027 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -307,63 +307,59 @@ bool KOTodoViewItem::isAlternate() | |||
307 | return false; | 307 | return false; |
308 | #endif | 308 | #endif |
309 | } | 309 | } |
310 | 310 | ||
311 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 311 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
312 | { | 312 | { |
313 | QColorGroup _cg = cg; | 313 | QColorGroup _cg = cg; |
314 | QColorGroup::ColorRole role; | 314 | QColorGroup::ColorRole role; |
315 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) | 315 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) |
316 | role = QColorGroup::Text; | 316 | role = QColorGroup::Text; |
317 | else | 317 | else |
318 | role = QColorGroup::Base; | 318 | role = QColorGroup::Base; |
319 | //#ifndef KORG_NOLVALTERNATION | 319 | //#ifndef KORG_NOLVALTERNATION |
320 | // if (isAlternate()) | 320 | // if (isAlternate()) |
321 | // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); | 321 | // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); |
322 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; | 322 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; |
323 | QColor colorToSet; | 323 | QColor colorToSet; |
324 | if ( setColor ) { | 324 | if ( setColor ) { |
325 | QStringList categories = mTodo->categories(); | 325 | QStringList categories = mTodo->categories(); |
326 | QString cat = categories.first(); | 326 | QString cat = categories.first(); |
327 | if ( !cat.isEmpty()) { | 327 | if ( !cat.isEmpty()) { |
328 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); | 328 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); |
329 | } else | 329 | } else |
330 | setColor = false; | 330 | setColor = false; |
331 | } | 331 | } |
332 | if (mTodo->hasDueDate()) { | 332 | |
333 | if (mTodo->dtDue().date()==QDate::currentDate() && | 333 | int odue = mTodo->hasDueSubTodo( !isOpen()); |
334 | !mTodo->isCompleted()) { | 334 | if (odue == 2) { |
335 | //_cg.setColor( role , KOPrefs::instance()->mTodoDueTodayColor); | 335 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; |
336 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; | 336 | setColor = true; |
337 | setColor = true; | 337 | } else if ( odue == 1 ) { |
338 | } | 338 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; |
339 | if (mTodo->dtDue().date() < QDate::currentDate() && | 339 | setColor = true; |
340 | !mTodo->isCompleted()) { | 340 | } |
341 | //_cg.setColor( role, KOPrefs::instance()->mTodoOverdueColor); | 341 | |
342 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; | ||
343 | setColor = true; | ||
344 | } | ||
345 | } | ||
346 | 342 | ||
347 | if ( setColor ) { | 343 | if ( setColor ) { |
348 | _cg.setColor(role,colorToSet ); | 344 | _cg.setColor(role,colorToSet ); |
349 | if ( role == QColorGroup::Base) { | 345 | if ( role == QColorGroup::Base) { |
350 | int rgb = colorToSet.red(); | 346 | int rgb = colorToSet.red(); |
351 | rgb += colorToSet.blue()/2; | 347 | rgb += colorToSet.blue()/2; |
352 | rgb += colorToSet.green(); | 348 | rgb += colorToSet.green(); |
353 | if ( rgb < 200 ) | 349 | if ( rgb < 200 ) |
354 | _cg.setColor(QColorGroup::Text,Qt::white ); | 350 | _cg.setColor(QColorGroup::Text,Qt::white ); |
355 | } | 351 | } |
356 | } | 352 | } |
357 | //#endif | 353 | //#endif |
358 | if ( column > 0 ){ | 354 | if ( column > 0 ){ |
359 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { | 355 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { |
360 | p->save(); | 356 | p->save(); |
361 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); | 357 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); |
362 | 358 | ||
363 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background | 359 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background |
364 | // p->setPen(Qt::black ); //border | 360 | // p->setPen(Qt::black ); //border |
365 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling | 361 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling |
366 | QColor fc = KOPrefs::instance()->mHighlightColor; | 362 | QColor fc = KOPrefs::instance()->mHighlightColor; |
367 | if ( mTodo->percentComplete() == 100 ) | 363 | if ( mTodo->percentComplete() == 100 ) |
368 | fc = darkGreen; | 364 | fc = darkGreen; |
369 | p->drawRect( 2, 2, width-4, height()-4); | 365 | p->drawRect( 2, 2, width-4, height()-4); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index a2c20a8..5bc8c00 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1325,49 +1325,58 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) | |||
1325 | mNewSubTodoAction->setEnabled( false ); | 1325 | mNewSubTodoAction->setEnabled( false ); |
1326 | setCaptionToDates(); | 1326 | setCaptionToDates(); |
1327 | return; | 1327 | return; |
1328 | 1328 | ||
1329 | } | 1329 | } |
1330 | 1330 | ||
1331 | //KGlobal::locale()->formatDateTime(nextA, true); | 1331 | //KGlobal::locale()->formatDateTime(nextA, true); |
1332 | QString startString = ""; | 1332 | QString startString = ""; |
1333 | if ( incidence->type() != "Todo" ) { | 1333 | if ( incidence->type() != "Todo" ) { |
1334 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1334 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1335 | if ( incidence->doesFloat() ) { | 1335 | if ( incidence->doesFloat() ) { |
1336 | startString += ": "+incidence->dtStartDateStr( true ); | 1336 | startString += ": "+incidence->dtStartDateStr( true ); |
1337 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1337 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1338 | 1338 | ||
1339 | } else { | 1339 | } else { |
1340 | startString = ": "+incidence->dtStartStr(true); | 1340 | startString = ": "+incidence->dtStartStr(true); |
1341 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1341 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1342 | 1342 | ||
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | } else { | 1345 | } else { |
1346 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1346 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1347 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1347 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1348 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1348 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1349 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1349 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1350 | bool ok; | ||
1351 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | ||
1352 | if ( ok ) { | ||
1353 | int years = noc.date().year() - incidence->dtStart().date().year(); | ||
1354 | startString += i18n(" (%1 y.)"). arg( years ); | ||
1355 | } | ||
1356 | } | ||
1357 | else | ||
1358 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | ||
1350 | } | 1359 | } |
1351 | 1360 | ||
1352 | } | 1361 | } |
1353 | else | 1362 | else |
1354 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1363 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1355 | if ( !incidence->location().isEmpty() ) | 1364 | if ( !incidence->location().isEmpty() ) |
1356 | startString += " (" +incidence->location()+")"; | 1365 | startString += " (" +incidence->location()+")"; |
1357 | setCaption( incidence->summary()+startString); | 1366 | setCaption( incidence->summary()+startString); |
1358 | 1367 | ||
1359 | enableIncidenceActions( true ); | 1368 | enableIncidenceActions( true ); |
1360 | 1369 | ||
1361 | if ( incidence->type() == "Event" ) { | 1370 | if ( incidence->type() == "Event" ) { |
1362 | mShowAction->setText( i18n("Show Event...") ); | 1371 | mShowAction->setText( i18n("Show Event...") ); |
1363 | mEditAction->setText( i18n("Edit Event...") ); | 1372 | mEditAction->setText( i18n("Edit Event...") ); |
1364 | mDeleteAction->setText( i18n("Delete Event...") ); | 1373 | mDeleteAction->setText( i18n("Delete Event...") ); |
1365 | 1374 | ||
1366 | mNewSubTodoAction->setEnabled( false ); | 1375 | mNewSubTodoAction->setEnabled( false ); |
1367 | } else if ( incidence->type() == "Todo" ) { | 1376 | } else if ( incidence->type() == "Todo" ) { |
1368 | mShowAction->setText( i18n("Show Todo...") ); | 1377 | mShowAction->setText( i18n("Show Todo...") ); |
1369 | mEditAction->setText( i18n("Edit Todo...") ); | 1378 | mEditAction->setText( i18n("Edit Todo...") ); |
1370 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1379 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1371 | 1380 | ||
1372 | mNewSubTodoAction->setEnabled( true ); | 1381 | mNewSubTodoAction->setEnabled( true ); |
1373 | } else { | 1382 | } else { |