-rw-r--r-- | korganizer/koeditorgeneralevent.cpp | 8 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 2 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 10 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 6 |
4 files changed, 15 insertions, 11 deletions
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp index adc733b..2a49528 100644 --- a/korganizer/koeditorgeneralevent.cpp +++ b/korganizer/koeditorgeneralevent.cpp | |||
@@ -352,76 +352,76 @@ void KOEditorGeneralEvent::setDuration() | |||
352 | tmpStr.append(i18n("1 Day","%n Days",daydiff)); | 352 | tmpStr.append(i18n("1 Day","%n Days",daydiff)); |
353 | } else { | 353 | } else { |
354 | int secto = mCurrStartDateTime.secsTo( mCurrEndDateTime ); | 354 | int secto = mCurrStartDateTime.secsTo( mCurrEndDateTime ); |
355 | hourdiff = secto / 3600; | 355 | hourdiff = secto / 3600; |
356 | minutediff = (secto/60 ) % 60; | 356 | minutediff = (secto/60 ) % 60; |
357 | if (hourdiff || minutediff){ | 357 | if (hourdiff || minutediff){ |
358 | tmpStr = i18n("Duration: "); | 358 | tmpStr = i18n("Duration: "); |
359 | if (hourdiff){ | 359 | if (hourdiff){ |
360 | catStr = i18n("1 h","%n h",hourdiff); | 360 | catStr = i18n("1 h","%n h",hourdiff); |
361 | tmpStr.append(catStr); | 361 | tmpStr.append(catStr); |
362 | } | 362 | } |
363 | if (hourdiff && minutediff){ | 363 | if (hourdiff && minutediff){ |
364 | tmpStr += i18n(", "); | 364 | tmpStr += i18n(", "); |
365 | } | 365 | } |
366 | if (minutediff){ | 366 | if (minutediff){ |
367 | catStr = i18n("1 min","%n min",minutediff); | 367 | catStr = i18n("1 min","%n min",minutediff); |
368 | tmpStr += catStr; | 368 | tmpStr += catStr; |
369 | } | 369 | } |
370 | } else tmpStr = ""; | 370 | } else tmpStr = ""; |
371 | } | 371 | } |
372 | } | 372 | } |
373 | mDurationLabel->setText(tmpStr); | 373 | mDurationLabel->setText(tmpStr); |
374 | } | 374 | } |
375 | 375 | ||
376 | void KOEditorGeneralEvent::emitDateTimeStr() | 376 | void KOEditorGeneralEvent::emitDateTimeStr() |
377 | { | 377 | { |
378 | KLocale *l = KGlobal::locale(); | 378 | KLocale *l = KGlobal::locale(); |
379 | 379 | ||
380 | QString from,to; | 380 | QString from,to; |
381 | if (mNoTimeButton->isChecked()) { | 381 | if (mNoTimeButton->isChecked()) { |
382 | from = l->formatDate(mCurrStartDateTime.date()); | 382 | from = l->formatDate(mCurrStartDateTime.date()); |
383 | to = l->formatDate(mCurrEndDateTime.date()); | 383 | to = l->formatDate(mCurrEndDateTime.date()); |
384 | } else { | 384 | } else { |
385 | from = l->formatDateTime(mCurrStartDateTime); | 385 | from = l->formatDateTime(mCurrStartDateTime); |
386 | to = l->formatDateTime(mCurrEndDateTime); | 386 | to = l->formatDateTime(mCurrEndDateTime); |
387 | } | 387 | } |
388 | 388 | ||
389 | QString str = i18n("From: %1 To: %2 %3").arg(from).arg(to) | 389 | QString str = i18n("From: %1 To: %2 %3").arg(from).arg(to) |
390 | .arg(mDurationLabel->text()); | 390 | .arg(mDurationLabel->text()); |
391 | 391 | ||
392 | emit dateTimeStrChanged(str); | 392 | emit dateTimeStrChanged(str); |
393 | } | 393 | } |
394 | 394 | ||
395 | bool KOEditorGeneralEvent::validateInput() | 395 | bool KOEditorGeneralEvent::validateInput() |
396 | { | 396 | { |
397 | 397 | ||
398 | if (!mStartDateEdit->inputIsValid()) { | 398 | if (!mStartDateEdit->inputIsValid()) { |
399 | KMessageBox::sorry( 0, | 399 | KMessageBox::sorry( 0, |
400 | i18n("Please specify a valid start date, for example '%1'.") | 400 | i18n("Please specify a valid start date,\nfor example '%1'.") |
401 | .arg( KGlobal::locale()->formatDate( QDate::currentDate() ) ) ); | 401 | .arg( KGlobal::locale()->formatDate( QDate::currentDate(), true ) ) ); |
402 | return false; | 402 | return false; |
403 | } | 403 | } |
404 | 404 | ||
405 | if (!mEndDateEdit->inputIsValid()) { | 405 | if (!mEndDateEdit->inputIsValid()) { |
406 | KMessageBox::sorry( 0, | 406 | KMessageBox::sorry( 0, |
407 | i18n("Please specify a valid end date, for example '%1'.") | 407 | i18n("Please specify a valid end date,\nfor example '%1'.") |
408 | .arg( KGlobal::locale()->formatDate( QDate::currentDate() ) ) ); | 408 | .arg( KGlobal::locale()->formatDate( QDate::currentDate(), true ) ) ); |
409 | return false; | 409 | return false; |
410 | } | 410 | } |
411 | 411 | ||
412 | QDateTime startDt,endDt; | 412 | QDateTime startDt,endDt; |
413 | startDt.setDate(mStartDateEdit->date()); | 413 | startDt.setDate(mStartDateEdit->date()); |
414 | endDt.setDate(mEndDateEdit->date()); | 414 | endDt.setDate(mEndDateEdit->date()); |
415 | if (!mNoTimeButton->isChecked()) { | 415 | if (!mNoTimeButton->isChecked()) { |
416 | startDt.setTime(mStartTimeEdit->getTime()); | 416 | startDt.setTime(mStartTimeEdit->getTime()); |
417 | endDt.setTime(mEndTimeEdit->getTime()); | 417 | endDt.setTime(mEndTimeEdit->getTime()); |
418 | } | 418 | } |
419 | 419 | ||
420 | if (startDt > endDt) { | 420 | if (startDt > endDt) { |
421 | KMessageBox::sorry(0,i18n("The event ends before it starts.\n" | 421 | KMessageBox::sorry(0,i18n("The event ends before it starts.\n" |
422 | "Please correct dates and times.")); | 422 | "Please correct dates and times.")); |
423 | return false; | 423 | return false; |
424 | } | 424 | } |
425 | 425 | ||
426 | return KOEditorGeneral::validateInput(); | 426 | return KOEditorGeneral::validateInput(); |
427 | } | 427 | } |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index da81586..f595d35 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -508,97 +508,97 @@ void MonthViewCell::insertEvent(Event *event) | |||
508 | QString cat = categories.first(); | 508 | QString cat = categories.first(); |
509 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 509 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
510 | pal = getPalette(); | 510 | pal = getPalette(); |
511 | if (cat.isEmpty()) { | 511 | if (cat.isEmpty()) { |
512 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 512 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
513 | } else { | 513 | } else { |
514 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 514 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
515 | } | 515 | } |
516 | 516 | ||
517 | } else { | 517 | } else { |
518 | if (cat.isEmpty()) { | 518 | if (cat.isEmpty()) { |
519 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 519 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
520 | } else { | 520 | } else { |
521 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 521 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
522 | } | 522 | } |
523 | } | 523 | } |
524 | 524 | ||
525 | } else { | 525 | } else { |
526 | pal = mStandardPalette ; | 526 | pal = mStandardPalette ; |
527 | } | 527 | } |
528 | item->setPalette( pal ); | 528 | item->setPalette( pal ); |
529 | item->setRecur( event->recurrence()->doesRecur() ); | 529 | item->setRecur( event->recurrence()->doesRecur() ); |
530 | item->setAlarm( event->isAlarmEnabled() ); | 530 | item->setAlarm( event->isAlarmEnabled() ); |
531 | item->setMoreInfo( event->description().length() > 0 ); | 531 | item->setMoreInfo( event->description().length() > 0 ); |
532 | #ifdef DESKTOP_VERSION | 532 | #ifdef DESKTOP_VERSION |
533 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 533 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
534 | KOPrefs::instance()->email()); | 534 | KOPrefs::instance()->email()); |
535 | if ( me != 0 ) { | 535 | if ( me != 0 ) { |
536 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 536 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
537 | item->setReply(true); | 537 | item->setReply(true); |
538 | else | 538 | else |
539 | item->setReply(false); | 539 | item->setReply(false); |
540 | } else | 540 | } else |
541 | item->setReply(false); | 541 | item->setReply(false); |
542 | #endif | 542 | #endif |
543 | mItemList->insertItem( item ); | 543 | mItemList->insertItem( item ); |
544 | mToolTip += "\n"; | 544 | mToolTip += "\n"; |
545 | } | 545 | } |
546 | void MonthViewCell::insertTodo(Todo *todo) | 546 | void MonthViewCell::insertTodo(Todo *todo) |
547 | { | 547 | { |
548 | mItemList->setFocusPolicy(WheelFocus); | 548 | mItemList->setFocusPolicy(WheelFocus); |
549 | QString text; | 549 | QString text; |
550 | if (todo->hasDueDate()) { | 550 | if (todo->hasDueDate()) { |
551 | if (!todo->doesFloat()) { | 551 | if (!todo->doesFloat()) { |
552 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 552 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
553 | text += " "; | 553 | text += " "; |
554 | } | 554 | } |
555 | } | 555 | } |
556 | text += i18n("Td: %1").arg(todo->summary()); | 556 | text += i18n("T: %1").arg(todo->summary()); |
557 | 557 | ||
558 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 558 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
559 | //item->setPalette( mStandardPalette ); | 559 | //item->setPalette( mStandardPalette ); |
560 | QPalette pal; | 560 | QPalette pal; |
561 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 561 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
562 | QStringList categories = todo->categories(); | 562 | QStringList categories = todo->categories(); |
563 | QString cat = categories.first(); | 563 | QString cat = categories.first(); |
564 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 564 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
565 | pal = getPalette(); | 565 | pal = getPalette(); |
566 | if (cat.isEmpty()) { | 566 | if (cat.isEmpty()) { |
567 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 567 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
568 | } else { | 568 | } else { |
569 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 569 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
570 | } | 570 | } |
571 | 571 | ||
572 | } else { | 572 | } else { |
573 | if (cat.isEmpty()) { | 573 | if (cat.isEmpty()) { |
574 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 574 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
575 | } else { | 575 | } else { |
576 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 576 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
577 | } | 577 | } |
578 | } | 578 | } |
579 | 579 | ||
580 | } else { | 580 | } else { |
581 | pal = mStandardPalette ; | 581 | pal = mStandardPalette ; |
582 | } | 582 | } |
583 | item->setPalette( pal ); | 583 | item->setPalette( pal ); |
584 | mItemList->insertItem( item ); | 584 | mItemList->insertItem( item ); |
585 | mToolTip += text+"\n"; | 585 | mToolTip += text+"\n"; |
586 | } | 586 | } |
587 | void MonthViewCell::finishUpdateCell() | 587 | void MonthViewCell::finishUpdateCell() |
588 | { | 588 | { |
589 | #ifdef DESKTOP_VERSION | 589 | #ifdef DESKTOP_VERSION |
590 | if (mToolTip != "") | 590 | if (mToolTip != "") |
591 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 591 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
592 | #endif | 592 | #endif |
593 | mItemList->sort(); | 593 | mItemList->sort(); |
594 | //setMyPalette(); | 594 | //setMyPalette(); |
595 | setMyPalette(); | 595 | setMyPalette(); |
596 | QString text; | 596 | QString text; |
597 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 597 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
598 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 598 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
599 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 599 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
600 | mLabel->resize( mLabelBigSize ); | 600 | mLabel->resize( mLabelBigSize ); |
601 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 601 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
602 | } else { | 602 | } else { |
603 | mLabel->resize( mLabelSize ); | 603 | mLabel->resize( mLabelSize ); |
604 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 604 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 44db209..0e847c2 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -226,123 +226,123 @@ void KOTodoViewItem::stateChange(bool state) | |||
226 | if (mTodo->doesFloat()) { | 226 | if (mTodo->doesFloat()) { |
227 | setText(4,""); | 227 | setText(4,""); |
228 | } | 228 | } |
229 | else { | 229 | else { |
230 | setText(4,mTodo->dtDueTimeStr()); | 230 | setText(4,mTodo->dtDueTimeStr()); |
231 | QTime t = mTodo->dtDue().time(); | 231 | QTime t = mTodo->dtDue().time(); |
232 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 232 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
233 | setSortKey(4,keyt); | 233 | setSortKey(4,keyt); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 236 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
237 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 237 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
238 | 238 | ||
239 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 239 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
240 | if (mTodo->percentComplete()<100) { | 240 | if (mTodo->percentComplete()<100) { |
241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
242 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 242 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
243 | } | 243 | } |
244 | else { | 244 | else { |
245 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 245 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
246 | else setSortKey(2,QString::number(99)); | 246 | else setSortKey(2,QString::number(99)); |
247 | } | 247 | } |
248 | if ( state ) { | 248 | if ( state ) { |
249 | QListViewItem * myChild = firstChild(); | 249 | QListViewItem * myChild = firstChild(); |
250 | KOTodoViewItem *item; | 250 | KOTodoViewItem *item; |
251 | while( myChild ) { | 251 | while( myChild ) { |
252 | //qDebug("stateCH "); | 252 | //qDebug("stateCH "); |
253 | item = static_cast<KOTodoViewItem*>(myChild); | 253 | item = static_cast<KOTodoViewItem*>(myChild); |
254 | item->stateChange(state); | 254 | item->stateChange(state); |
255 | myChild = myChild->nextSibling(); | 255 | myChild = myChild->nextSibling(); |
256 | } | 256 | } |
257 | } else { | 257 | } else { |
258 | QListViewItem * myChild = parent(); | 258 | QListViewItem * myChild = parent(); |
259 | if ( myChild ) | 259 | if ( myChild ) |
260 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); | 260 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); |
261 | } | 261 | } |
262 | mTodoView->modified(true); | 262 | mTodoView->modified(true); |
263 | setMyPixmap(); | 263 | setMyPixmap(); |
264 | mTodoView->setTodoModified( mTodo ); | 264 | mTodoView->setTodoModified( mTodo ); |
265 | } | 265 | } |
266 | 266 | ||
267 | bool KOTodoViewItem::isAlternate() | 267 | bool KOTodoViewItem::isAlternate() |
268 | { | 268 | { |
269 | 269 | ||
270 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 270 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
271 | if (lv && lv->alternateBackground().isValid()) | 271 | if (lv && lv->alternateBackground().isValid()) |
272 | { | 272 | { |
273 | KOTodoViewItem *above = 0; | 273 | KOTodoViewItem *above = 0; |
274 | above = dynamic_cast<KOTodoViewItem *>(itemAbove()); | 274 | above = static_cast<KOTodoViewItem *>(itemAbove()); |
275 | m_known = above ? above->m_known : true; | 275 | m_known = above ? above->m_known : true; |
276 | if (m_known) | 276 | if (m_known) |
277 | { | 277 | { |
278 | m_odd = above ? !above->m_odd : false; | 278 | m_odd = above ? !above->m_odd : false; |
279 | } | 279 | } |
280 | else | 280 | else |
281 | { | 281 | { |
282 | KOTodoViewItem *item; | 282 | KOTodoViewItem *item; |
283 | bool previous = true; | 283 | bool previous = true; |
284 | if (QListViewItem::parent()) | 284 | if (QListViewItem::parent()) |
285 | { | 285 | { |
286 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()); | 286 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); |
287 | if (item) | 287 | if (item) |
288 | previous = item->m_odd; | 288 | previous = item->m_odd; |
289 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); | 289 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); |
290 | } | 290 | } |
291 | else | 291 | else |
292 | { | 292 | { |
293 | item = dynamic_cast<KOTodoViewItem *>(lv->firstChild()); | 293 | item = static_cast<KOTodoViewItem *>(lv->firstChild()); |
294 | } | 294 | } |
295 | 295 | ||
296 | while(item) | 296 | while(item) |
297 | { | 297 | { |
298 | item->m_odd = previous = !previous; | 298 | item->m_odd = previous = !previous; |
299 | item->m_known = true; | 299 | item->m_known = true; |
300 | item = dynamic_cast<KOTodoViewItem *>(item->nextSibling()); | 300 | item = static_cast<KOTodoViewItem *>(item->nextSibling()); |
301 | } | 301 | } |
302 | } | 302 | } |
303 | return m_odd; | 303 | return m_odd; |
304 | } | 304 | } |
305 | return false; | 305 | return false; |
306 | } | 306 | } |
307 | 307 | ||
308 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 308 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
309 | { | 309 | { |
310 | QColorGroup _cg = cg; | 310 | QColorGroup _cg = cg; |
311 | QColorGroup::ColorRole role; | 311 | QColorGroup::ColorRole role; |
312 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) | 312 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) |
313 | role = QColorGroup::Text; | 313 | role = QColorGroup::Text; |
314 | else | 314 | else |
315 | role = QColorGroup::Base; | 315 | role = QColorGroup::Base; |
316 | //#ifndef KORG_NOLVALTERNATION | 316 | //#ifndef KORG_NOLVALTERNATION |
317 | if (isAlternate()) | 317 | if (isAlternate()) |
318 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); | 318 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); |
319 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; | 319 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; |
320 | QColor colorToSet; | 320 | QColor colorToSet; |
321 | if ( setColor ) { | 321 | if ( setColor ) { |
322 | QStringList categories = mTodo->categories(); | 322 | QStringList categories = mTodo->categories(); |
323 | QString cat = categories.first(); | 323 | QString cat = categories.first(); |
324 | if ( !cat.isEmpty()) { | 324 | if ( !cat.isEmpty()) { |
325 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); | 325 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); |
326 | } else | 326 | } else |
327 | setColor = false; | 327 | setColor = false; |
328 | } | 328 | } |
329 | 329 | ||
330 | int odue = mTodo->hasDueSubTodo( !isOpen()); | 330 | int odue = mTodo->hasDueSubTodo( !isOpen()); |
331 | if (odue == 2) { | 331 | if (odue == 2) { |
332 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; | 332 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; |
333 | setColor = true; | 333 | setColor = true; |
334 | } else if ( odue == 1 ) { | 334 | } else if ( odue == 1 ) { |
335 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; | 335 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; |
336 | setColor = true; | 336 | setColor = true; |
337 | } | 337 | } |
338 | 338 | ||
339 | 339 | ||
340 | if ( setColor ) { | 340 | if ( setColor ) { |
341 | _cg.setColor(role,colorToSet ); | 341 | _cg.setColor(role,colorToSet ); |
342 | if ( role == QColorGroup::Base) { | 342 | if ( role == QColorGroup::Base) { |
343 | int rgb = colorToSet.red(); | 343 | int rgb = colorToSet.red(); |
344 | rgb += colorToSet.blue()/2; | 344 | rgb += colorToSet.blue()/2; |
345 | rgb += colorToSet.green(); | 345 | rgb += colorToSet.green(); |
346 | if ( rgb < 200 ) | 346 | if ( rgb < 200 ) |
347 | _cg.setColor(QColorGroup::Text,Qt::white ); | 347 | _cg.setColor(QColorGroup::Text,Qt::white ); |
348 | } | 348 | } |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 10665f4..391b3bb 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -570,97 +570,101 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
570 | } else | 570 | } else |
571 | tempText +=((Todo*)ev)->dtDueTimeStr(); | 571 | tempText +=((Todo*)ev)->dtDueTimeStr(); |
572 | mTodos.append( ev ); | 572 | mTodos.append( ev ); |
573 | } | 573 | } |
574 | } | 574 | } |
575 | } | 575 | } |
576 | tempText += "</b></td><td>"; | 576 | tempText += "</b></td><td>"; |
577 | bool needClose = false; | 577 | bool needClose = false; |
578 | if ( ev->cancelled() ) { | 578 | if ( ev->cancelled() ) { |
579 | tempText += "<font color=\"#F00000\">[c"; | 579 | tempText += "<font color=\"#F00000\">[c"; |
580 | needClose =true; | 580 | needClose =true; |
581 | 581 | ||
582 | } | 582 | } |
583 | if ( ev->isAlarmEnabled() ) { | 583 | if ( ev->isAlarmEnabled() ) { |
584 | if ( !needClose) | 584 | if ( !needClose) |
585 | tempText +="["; | 585 | tempText +="["; |
586 | tempText += "a"; | 586 | tempText += "a"; |
587 | needClose =true; | 587 | needClose =true; |
588 | 588 | ||
589 | } | 589 | } |
590 | if ( ev->description().length() > 0 ) { | 590 | if ( ev->description().length() > 0 ) { |
591 | if ( !needClose) | 591 | if ( !needClose) |
592 | tempText +="["; | 592 | tempText +="["; |
593 | tempText += "i"; | 593 | tempText += "i"; |
594 | needClose =true; | 594 | needClose =true; |
595 | } | 595 | } |
596 | if ( ev->recurrence()->doesRecur() ) { | 596 | if ( ev->recurrence()->doesRecur() ) { |
597 | if ( !needClose) | 597 | if ( !needClose) |
598 | tempText +="["; | 598 | tempText +="["; |
599 | tempText += "r"; | 599 | tempText += "r"; |
600 | needClose =true; | 600 | needClose =true; |
601 | } | 601 | } |
602 | if ( needClose ) { | 602 | if ( needClose ) { |
603 | tempText += "] "; | 603 | tempText += "] "; |
604 | } | 604 | } |
605 | if ( ev->cancelled() ) | 605 | if ( ev->cancelled() ) |
606 | tempText += "</font>"; | 606 | tempText += "</font>"; |
607 | tempText += "<a "; | 607 | tempText += "<a "; |
608 | if (ev->type()=="Event") tempText += "href=\"event:"; | 608 | if (ev->type()=="Event") tempText += "href=\"event:"; |
609 | if (ev->type()=="Todo") tempText += "href=\"todo:"; | 609 | if (ev->type()=="Todo") tempText += "href=\"todo:"; |
610 | tempText += ev->uid() + "\">"; | 610 | tempText += ev->uid() + "\">"; |
611 | if ( ev->summary().length() > 0 ) | 611 | if ( ev->summary().length() > 0 ) |
612 | tempText += ev->summary(); | 612 | tempText += ev->summary(); |
613 | else | 613 | else |
614 | tempText += i18n("-no summary-"); | 614 | tempText += i18n("-no summary-"); |
615 | if ( bDay ) { | 615 | if ( bDay ) { |
616 | noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); | 616 | noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); |
617 | if ( ok ) { | 617 | if ( ok ) { |
618 | int years = noc.date().year() - ev->dtStart().date().year(); | 618 | int years = 0; |
619 | if ( ev->type() =="Todo" ) { | ||
620 | years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); | ||
621 | } else | ||
622 | years = noc.date().year() - ev->dtStart().date().year(); | ||
619 | tempText += i18n(" (%1 y.)"). arg( years ); | 623 | tempText += i18n(" (%1 y.)"). arg( years ); |
620 | } | 624 | } |
621 | } | 625 | } |
622 | 626 | ||
623 | tempText += "</a>"; | 627 | tempText += "</a>"; |
624 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 628 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
625 | if ( !ev->location().isEmpty() ) | 629 | if ( !ev->location().isEmpty() ) |
626 | tempText += " ("+ev->location() +")"; | 630 | tempText += " ("+ev->location() +")"; |
627 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) | 631 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) |
628 | tempText += " ["+ev->relatedTo()->summary() +"]"; | 632 | tempText += " ["+ev->relatedTo()->summary() +"]"; |
629 | tempText += "</td></tr>\n"; | 633 | tempText += "</td></tr>\n"; |
630 | mText += tempText; | 634 | mText += tempText; |
631 | return true; | 635 | return true; |
632 | } | 636 | } |
633 | 637 | ||
634 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) | 638 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) |
635 | { | 639 | { |
636 | if ( mTodos.find( ev ) != mTodos.end() ) return false; | 640 | if ( mTodos.find( ev ) != mTodos.end() ) return false; |
637 | 641 | ||
638 | mTodos.append( ev ); | 642 | mTodos.append( ev ); |
639 | if ( !isSub ) | 643 | if ( !isSub ) |
640 | mText += "<p>"; | 644 | mText += "<p>"; |
641 | else | 645 | else |
642 | mText += "<li>"; | 646 | mText += "<li>"; |
643 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; | 647 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; |
644 | 648 | ||
645 | 649 | ||
646 | mText += ind; | 650 | mText += ind; |
647 | bool needClose = false; | 651 | bool needClose = false; |
648 | if ( ev->cancelled() ) { | 652 | if ( ev->cancelled() ) { |
649 | mText += "<font color=\"#F00000\">[c"; | 653 | mText += "<font color=\"#F00000\">[c"; |
650 | needClose =true; | 654 | needClose =true; |
651 | 655 | ||
652 | } | 656 | } |
653 | if ( ev->isAlarmEnabled() ) { | 657 | if ( ev->isAlarmEnabled() ) { |
654 | if ( !needClose) | 658 | if ( !needClose) |
655 | mText +="["; | 659 | mText +="["; |
656 | mText += "a"; | 660 | mText += "a"; |
657 | needClose =true; | 661 | needClose =true; |
658 | 662 | ||
659 | } | 663 | } |
660 | 664 | ||
661 | if ( ev->description().length() > 0 ) { | 665 | if ( ev->description().length() > 0 ) { |
662 | if ( !needClose) | 666 | if ( !needClose) |
663 | mText +="["; | 667 | mText +="["; |
664 | mText += "i"; | 668 | mText += "i"; |
665 | needClose =true; | 669 | needClose =true; |
666 | } | 670 | } |