-rw-r--r-- | korganizer/komonthview.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 2150654..475bb4a 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -272,110 +272,117 @@ void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | |||
272 | { | 272 | { |
273 | QListBox::mousePressEvent(e); | 273 | QListBox::mousePressEvent(e); |
274 | 274 | ||
275 | if(e->button() == RightButton) { | 275 | if(e->button() == RightButton) { |
276 | emit rightClick(); | 276 | emit rightClick(); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 280 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
281 | : QListBoxItem() | 281 | : QListBoxItem() |
282 | { | 282 | { |
283 | mblockRepaint = true; | 283 | mblockRepaint = true; |
284 | setText( s ); | 284 | setText( s ); |
285 | mMultiday = 0; | 285 | mMultiday = 0; |
286 | mIncidence = incidence; | 286 | mIncidence = incidence; |
287 | mDate = qd; | 287 | mDate = qd; |
288 | mRecur = false; | 288 | mRecur = false; |
289 | mAlarm = false; | 289 | mAlarm = false; |
290 | mReply = false; | 290 | mReply = false; |
291 | mInfo = false; | 291 | mInfo = false; |
292 | mdayPos = 0; | 292 | mdayPos = 0; |
293 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; | 293 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; |
294 | } | 294 | } |
295 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) | 295 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) |
296 | { | 296 | { |
297 | setText( s ); | 297 | setText( s ); |
298 | mMultiday = 0; | 298 | mMultiday = 0; |
299 | mIncidence = incidence; | 299 | mIncidence = incidence; |
300 | mDate = qd; | 300 | mDate = qd; |
301 | mRecur = false; | 301 | mRecur = false; |
302 | mAlarm = false; | 302 | mAlarm = false; |
303 | mReply = false; | 303 | mReply = false; |
304 | mInfo = false; | 304 | mInfo = false; |
305 | mdayPos = 0; | 305 | mdayPos = 0; |
306 | } | 306 | } |
307 | 307 | ||
308 | void MonthViewItem::paint(QPainter *p) | 308 | void MonthViewItem::paint(QPainter *p) |
309 | { | 309 | { |
310 | if ( mblockRepaint ) { | 310 | if ( mblockRepaint ) { |
311 | return; | 311 | return; |
312 | } | 312 | } |
313 | #if QT_VERSION >= 0x030000 | 313 | #if QT_VERSION >= 0x030000 |
314 | bool sel = isSelected(); | 314 | bool sel = isSelected(); |
315 | #else | 315 | #else |
316 | bool sel = selected(); | 316 | bool sel = selected(); |
317 | #endif | 317 | #endif |
318 | 318 | ||
319 | 319 | ||
320 | int heihei = height( listBox () ); | ||
321 | int x = 1; | ||
320 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 322 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
321 | { | 323 | { |
322 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 324 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
323 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 325 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
324 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 326 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); |
325 | } | 327 | } |
326 | int x = 1; | 328 | |
327 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 329 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
328 | int size = PIXMAP_SIZE; | 330 | int size = PIXMAP_SIZE; |
329 | if ( QApplication::desktop()->width() < 300 ) | 331 | if ( QApplication::desktop()->width() < 300 ) |
330 | size = 3; | 332 | size = 3; |
331 | int heihei = height( listBox () ); | ||
332 | int y = (heihei - size -1 ) /2; | 333 | int y = (heihei - size -1 ) /2; |
333 | 334 | ||
335 | if ( mIncidence->calID() > 1 ) { | ||
336 | p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); | ||
337 | p->drawRect ( x, y-2,size,size+4); | ||
338 | x += size + 1; | ||
339 | } | ||
340 | |||
334 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 341 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
335 | if ( mInfo ) { | 342 | if ( mInfo ) { |
336 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 343 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
337 | x += size + 1; | 344 | x += size + 1; |
338 | } | 345 | } |
339 | if ( mRecur ) { | 346 | if ( mRecur ) { |
340 | p->fillRect ( x, y,size,size, Qt::blue ); | 347 | p->fillRect ( x, y,size,size, Qt::blue ); |
341 | x += size + 1; | 348 | x += size + 1; |
342 | } | 349 | } |
343 | if ( mAlarm ) { | 350 | if ( mAlarm ) { |
344 | p->fillRect ( x, y,size,size, Qt::red ); | 351 | p->fillRect ( x, y,size,size, Qt::red ); |
345 | x += size + 1; | 352 | x += size + 1; |
346 | } | 353 | } |
347 | if ( mReply ) { | 354 | if ( mReply ) { |
348 | p->fillRect ( x, y,size,size, Qt::yellow ); | 355 | p->fillRect ( x, y,size,size, Qt::yellow ); |
349 | x += size + 1; | 356 | x += size + 1; |
350 | } | 357 | } |
351 | } | 358 | } |
352 | if ( mMultiday ) { | 359 | if ( mMultiday ) { |
353 | int yyy = y+(size/2); | 360 | int yyy = y+(size/2); |
354 | int sizeM = size+2; | 361 | int sizeM = size+2; |
355 | p->setBrush( QBrush::SolidPattern ); | 362 | p->setBrush( QBrush::SolidPattern ); |
356 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 363 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
357 | if ( mMultiday == 2 || mMultiday == 3 ) { | 364 | if ( mMultiday == 2 || mMultiday == 3 ) { |
358 | QPointArray pa ( 3 ); | 365 | QPointArray pa ( 3 ); |
359 | pa.setPoint (0, x, yyy ); | 366 | pa.setPoint (0, x, yyy ); |
360 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 367 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
361 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 368 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
362 | p->drawPolygon( pa ); | 369 | p->drawPolygon( pa ); |
363 | } | 370 | } |
364 | if ( mMultiday == 2 || mMultiday == 1 ) { | 371 | if ( mMultiday == 2 || mMultiday == 1 ) { |
365 | QPointArray pa ( 3 ); | 372 | QPointArray pa ( 3 ); |
366 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 373 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
367 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 374 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
368 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 375 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
369 | p->drawPolygon( pa ); | 376 | p->drawPolygon( pa ); |
370 | } | 377 | } |
371 | if ( mMultiday == 1 ) { | 378 | if ( mMultiday == 1 ) { |
372 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 379 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
373 | 380 | ||
374 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 381 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
375 | } | 382 | } |
376 | if ( mMultiday == 3 ) { | 383 | if ( mMultiday == 3 ) { |
377 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 384 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
378 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 385 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
379 | 386 | ||
380 | } | 387 | } |
381 | x += sizeM/2 + 1; | 388 | x += sizeM/2 + 1; |
@@ -565,96 +572,97 @@ void MonthViewCell::setMyPalette() | |||
565 | QPalette MonthViewCell::getPalette () | 572 | QPalette MonthViewCell::getPalette () |
566 | { | 573 | { |
567 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 574 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
568 | return mStandardPalette; | 575 | return mStandardPalette; |
569 | if ( mHoliday) { | 576 | if ( mHoliday) { |
570 | return mHolidayPalette ; | 577 | return mHolidayPalette ; |
571 | } else { | 578 | } else { |
572 | if ( mPrimary ) { | 579 | if ( mPrimary ) { |
573 | return mPrimaryPalette ; | 580 | return mPrimaryPalette ; |
574 | } | 581 | } |
575 | } | 582 | } |
576 | return mNonPrimaryPalette; | 583 | return mNonPrimaryPalette; |
577 | } | 584 | } |
578 | bool MonthViewCell::isPrimary() const | 585 | bool MonthViewCell::isPrimary() const |
579 | { | 586 | { |
580 | return mPrimary; | 587 | return mPrimary; |
581 | } | 588 | } |
582 | 589 | ||
583 | void MonthViewCell::setHoliday( bool holiday ) | 590 | void MonthViewCell::setHoliday( bool holiday ) |
584 | { | 591 | { |
585 | mHoliday = holiday; | 592 | mHoliday = holiday; |
586 | //setMyPalette(); | 593 | //setMyPalette(); |
587 | } | 594 | } |
588 | 595 | ||
589 | void MonthViewCell::setHoliday( const QString &holiday ) | 596 | void MonthViewCell::setHoliday( const QString &holiday ) |
590 | { | 597 | { |
591 | mHolidayString = holiday; | 598 | mHolidayString = holiday; |
592 | 599 | ||
593 | if ( !holiday.isEmpty() ) { | 600 | if ( !holiday.isEmpty() ) { |
594 | setHoliday( true ); | 601 | setHoliday( true ); |
595 | } | 602 | } |
596 | } | 603 | } |
597 | 604 | ||
598 | void MonthViewCell::startUpdateCell() | 605 | void MonthViewCell::startUpdateCell() |
599 | { | 606 | { |
600 | mdayCount = 0; | 607 | mdayCount = 0; |
601 | setFocusPolicy(NoFocus); | 608 | setFocusPolicy(NoFocus); |
602 | if ( !mMonthView->isUpdatePossible() ) | 609 | if ( !mMonthView->isUpdatePossible() ) |
603 | return; | 610 | return; |
604 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 611 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
605 | while ( mitem ) { | 612 | while ( mitem ) { |
606 | mitem->setBlockRepaint( true ); | 613 | mitem->setBlockRepaint( true ); |
607 | mitem = (MonthViewItem *)mitem->next(); | 614 | mitem = (MonthViewItem *)mitem->next(); |
608 | } | 615 | } |
609 | if ( mAvailItemList.count() > 20 ) { | 616 | if ( mAvailItemList.count() > 20 ) { |
610 | mAvailItemList.setAutoDelete( true ); | 617 | mAvailItemList.setAutoDelete( true ); |
611 | mAvailItemList.clear(); | 618 | mAvailItemList.clear(); |
612 | mAvailItemList.setAutoDelete( false ); | 619 | mAvailItemList.setAutoDelete( false ); |
620 | clear(); | ||
613 | } | 621 | } |
614 | 622 | ||
615 | setPrimary( mDate.month()%2 ); | 623 | setPrimary( mDate.month()%2 ); |
616 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 624 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
617 | if ( mDate == QDate::currentDate() ) { | 625 | if ( mDate == QDate::currentDate() ) { |
618 | setLineWidth( 3 ); | 626 | setLineWidth( 3 ); |
619 | } else { | 627 | } else { |
620 | setLineWidth( 1 ); | 628 | setLineWidth( 1 ); |
621 | } | 629 | } |
622 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); | 630 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); |
623 | //clear(); | 631 | //clear(); |
624 | while ( CurrentAvailItem ) { | 632 | while ( CurrentAvailItem ) { |
625 | MonthViewItem *item = CurrentAvailItem; | 633 | MonthViewItem *item = CurrentAvailItem; |
626 | CurrentAvailItem = (MonthViewItem *)item->next(); | 634 | CurrentAvailItem = (MonthViewItem *)item->next(); |
627 | mAvailItemList.append( item ); | 635 | mAvailItemList.append( item ); |
628 | takeItem ( item ); | 636 | takeItem ( item ); |
629 | } | 637 | } |
630 | 638 | ||
631 | #ifdef DESKTOP_VERSION | 639 | #ifdef DESKTOP_VERSION |
632 | QToolTip::remove(this); | 640 | QToolTip::remove(this); |
633 | #endif | 641 | #endif |
634 | mToolTip.clear(); | 642 | mToolTip.clear(); |
635 | //qApp->processEvents(); | 643 | //qApp->processEvents(); |
636 | #if 0 | 644 | #if 0 |
637 | if ( !mHolidayString.isEmpty() ) { | 645 | if ( !mHolidayString.isEmpty() ) { |
638 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 646 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
639 | item->setPalette( mHolidayPalette ); | 647 | item->setPalette( mHolidayPalette ); |
640 | insertItem( item ); | 648 | insertItem( item ); |
641 | mToolTip.append ( mHolidayString ); | 649 | mToolTip.append ( mHolidayString ); |
642 | } | 650 | } |
643 | #endif | 651 | #endif |
644 | } | 652 | } |
645 | 653 | ||
646 | int MonthViewCell::insertEvent(Event *event) | 654 | int MonthViewCell::insertEvent(Event *event) |
647 | { | 655 | { |
648 | bool useToolTips = true; | 656 | bool useToolTips = true; |
649 | #ifndef DESKTOP_VERSION | 657 | #ifndef DESKTOP_VERSION |
650 | useToolTips = false; | 658 | useToolTips = false; |
651 | #endif | 659 | #endif |
652 | QString mToolTipText; | 660 | QString mToolTipText; |
653 | setFocusPolicy(WheelFocus); | 661 | setFocusPolicy(WheelFocus); |
654 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 662 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
655 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 663 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
656 | return mdayCount; | 664 | return mdayCount; |
657 | else | 665 | else |
658 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 666 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
659 | return mdayCount; | 667 | return mdayCount; |
660 | } | 668 | } |
@@ -718,104 +726,111 @@ int MonthViewCell::insertEvent(Event *event) | |||
718 | if ( mAvailItemList.count() ) { | 726 | if ( mAvailItemList.count() ) { |
719 | item = mAvailItemList.first(); | 727 | item = mAvailItemList.first(); |
720 | mAvailItemList.remove( item ); | 728 | mAvailItemList.remove( item ); |
721 | item->recycle( event, mDate, text ); | 729 | item->recycle( event, mDate, text ); |
722 | } else { | 730 | } else { |
723 | item = new MonthViewItem( event, mDate, text ); | 731 | item = new MonthViewItem( event, mDate, text ); |
724 | } | 732 | } |
725 | 733 | ||
726 | QPalette pal; | 734 | QPalette pal; |
727 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 735 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
728 | QStringList categories = event->categories(); | 736 | QStringList categories = event->categories(); |
729 | QString cat = categories.first(); | 737 | QString cat = categories.first(); |
730 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 738 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
731 | pal = getPalette(); | 739 | pal = getPalette(); |
732 | if (cat.isEmpty()) { | 740 | if (cat.isEmpty()) { |
733 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 741 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
734 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() )); | 742 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() )); |
735 | } else { | 743 | } else { |
736 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 744 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
737 | } | 745 | } |
738 | 746 | ||
739 | } else { | 747 | } else { |
740 | if (cat.isEmpty()) { | 748 | if (cat.isEmpty()) { |
741 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 749 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
742 | pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() )); | 750 | pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() )); |
743 | } else { | 751 | } else { |
744 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 752 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
745 | } | 753 | } |
746 | } | 754 | } |
747 | 755 | ||
748 | } else { | 756 | } else { |
749 | pal = mStandardPalette ; | 757 | pal = mStandardPalette ; |
750 | } | 758 | } |
751 | item->setPalette( pal ); | 759 | item->setPalette( pal ); |
752 | item->setRecur( event->recurrence()->doesRecur() ); | 760 | item->setRecur( event->recurrence()->doesRecur() ); |
753 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); | 761 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); |
754 | item->setMoreInfo( event->description().length() > 0 ); | 762 | item->setMoreInfo( event->description().length() > 0 ); |
755 | #ifdef DESKTOP_VERSION | 763 | #ifdef DESKTOP_VERSION |
756 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 764 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
757 | KOPrefs::instance()->email()); | 765 | KOPrefs::instance()->email()); |
758 | if ( me != 0 ) { | 766 | if ( me != 0 ) { |
759 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 767 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
760 | item->setReply(true && multiday < 2); | 768 | item->setReply(true && multiday < 2); |
761 | else | 769 | else |
762 | item->setReply(false); | 770 | item->setReply(false); |
763 | } else | 771 | } else |
764 | item->setReply(false); | 772 | item->setReply(false); |
765 | #endif | 773 | #endif |
774 | |||
766 | item->setMultiDay( multiday ); | 775 | item->setMultiDay( multiday ); |
767 | if ( multiday ) { | 776 | if ( multiday ) { |
768 | insertItem( item ,mdayCount); | 777 | insertItem( item ,mdayCount); |
769 | ++mdayCount; | 778 | ++mdayCount; |
770 | } else { | 779 | } else { |
771 | uint i; | 780 | uint i = mdayCount; |
772 | int pos = mdayCount; | 781 | uint pos = mdayCount; |
773 | for ( i = mdayCount; i < count();++i ) { | 782 | uint itcount = count(); |
783 | if ( itcount > 1000 ) { | ||
784 | qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount); | ||
785 | itcount = 0; | ||
786 | } | ||
787 | for ( i = pos; i < itcount;++i ) { | ||
788 | // qDebug("i %d mday %u count %d ",i,itcount,mdayCount ); | ||
774 | QListBoxItem* it = this->item ( i ); | 789 | QListBoxItem* it = this->item ( i ); |
775 | if ( it && text < it->text() ) { | 790 | if ( it && text < it->text() ) { |
776 | pos = i; | 791 | pos = i; |
777 | break; | 792 | break; |
778 | } | 793 | } |
779 | ++pos; | 794 | ++pos; |
780 | } | 795 | } |
781 | insertItem( item ,pos); | 796 | insertItem( item ,pos); |
782 | } | 797 | } |
783 | if ( useToolTips ) { | 798 | if ( useToolTips ) { |
784 | mToolTip.append( mToolTipText ); | 799 | mToolTip.append( mToolTipText ); |
785 | } | 800 | } |
786 | return mdayCount; | 801 | return mdayCount; |
787 | } | 802 | } |
788 | void MonthViewCell::insertTodo(Todo *todo) | 803 | void MonthViewCell::insertTodo(Todo *todo) |
789 | { | 804 | { |
790 | setFocusPolicy(WheelFocus); | 805 | setFocusPolicy(WheelFocus); |
791 | QString text; | 806 | QString text; |
792 | if (todo->hasDueDate()) { | 807 | if (todo->hasDueDate()) { |
793 | if (!todo->doesFloat()) { | 808 | if (!todo->doesFloat()) { |
794 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 809 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
795 | text += " "; | 810 | text += " "; |
796 | } | 811 | } |
797 | } | 812 | } |
798 | text += todo->summary(); | 813 | text += todo->summary(); |
799 | MonthViewItem *item ; | 814 | MonthViewItem *item ; |
800 | if ( mAvailItemList.count() ) { | 815 | if ( mAvailItemList.count() ) { |
801 | item = mAvailItemList.first(); | 816 | item = mAvailItemList.first(); |
802 | mAvailItemList.remove( item ); | 817 | mAvailItemList.remove( item ); |
803 | item->recycle( todo, mDate, text ); | 818 | item->recycle( todo, mDate, text ); |
804 | } else { | 819 | } else { |
805 | item = new MonthViewItem( todo, mDate, text ); | 820 | item = new MonthViewItem( todo, mDate, text ); |
806 | } | 821 | } |
807 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 822 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
808 | //item->setPalette( mStandardPalette ); | 823 | //item->setPalette( mStandardPalette ); |
809 | QPalette pal; | 824 | QPalette pal; |
810 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 825 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
811 | QStringList categories = todo->categories(); | 826 | QStringList categories = todo->categories(); |
812 | QString cat = categories.first(); | 827 | QString cat = categories.first(); |
813 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 828 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
814 | pal = getPalette(); | 829 | pal = getPalette(); |
815 | if (cat.isEmpty()) { | 830 | if (cat.isEmpty()) { |
816 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 831 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
817 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() )); | 832 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() )); |
818 | } else { | 833 | } else { |
819 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 834 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
820 | } | 835 | } |
821 | 836 | ||