-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 | |||
@@ -304,46 +304,53 @@ void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) | |||
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; |
@@ -597,32 +604,33 @@ void MonthViewCell::setHoliday( const QString &holiday ) | |||
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 ); |
@@ -750,40 +758,47 @@ int MonthViewCell::insertEvent(Event *event) | |||
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 | { |