summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/datebookmonth.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/library/datebookmonth.cpp b/library/datebookmonth.cpp
index 421559e..013ab66 100644
--- a/library/datebookmonth.cpp
+++ b/library/datebookmonth.cpp
@@ -538,39 +538,44 @@ void DayItemMonth::paint( QPainter *p, const QColorGroup &cg,
538 if ( selected ) 538 if ( selected )
539 p->setPen( g.highlightedText() ); 539 p->setPen( g.highlightedText() );
540 else 540 else
541 p->setPen( g.text() ); 541 p->setPen( g.text() );
542 542
543 QValueStack<int> normalLine; 543 QValueStack<int> normalLine;
544 QValueStack<int> repeatLine; 544 QValueStack<int> repeatLine;
545 QValueStack<int> travelLine; 545 QValueStack<int> travelLine;
546 546
547 bool normalAllDay = FALSE; 547 bool normalAllDay = FALSE;
548 bool repeatAllDay = FALSE; 548 bool repeatAllDay = FALSE;
549 bool travelAllDay = FALSE; 549 bool travelAllDay = FALSE;
550 bool holidayAllDay = FALSE;
550 551
551 QValueListIterator<EffectiveEvent> itDays = d->mDayEvents.begin(); 552 QValueListIterator<EffectiveEvent> itDays = d->mDayEvents.begin();
552 553
553 for ( ; itDays != d->mDayEvents.end(); ++itDays ) { 554 for ( ; itDays != d->mDayEvents.end(); ++itDays ) {
554 int w = cr.width(); 555 int w = cr.width();
555 Event ev = (*itDays).event(); 556 Event ev = (*itDays).event();
556 557
557 int f = (*itDays).start().hour(); // assume Effective event 558 int f = (*itDays).start().hour(); // assume Effective event
558 int t = (*itDays).end().hour(); // is truncated. 559 int t = (*itDays).end().hour(); // is truncated.
559 560
560 if (ev.isAllDay()) { 561 if (ev.isAllDay()) {
561 if (!ev.hasRepeat()) 562 if (!ev.hasRepeat()) {
562 normalAllDay = TRUE; 563 normalAllDay = TRUE;
563 else 564 if (!ev.isValidUid()) {
564 repeatAllDay = TRUE; 565 holidayAllDay = TRUE;
566 }
567 } else {
568 repeatAllDay = TRUE;
569 }
565 } else { 570 } else {
566 int sLine, eLine; 571 int sLine, eLine;
567 if (f == 0) 572 if (f == 0)
568 sLine = 0; 573 sLine = 0;
569 else if (f < 8 ) 574 else if (f < 8 )
570 sLine = 1; 575 sLine = 1;
571 else if (f >= 17) 576 else if (f >= 17)
572 sLine = w - 4; 577 sLine = w - 4;
573 else { 578 else {
574 sLine = (f - 8) * (w - 8); 579 sLine = (f - 8) * (w - 8);
575 if (sLine) 580 if (sLine)
576 sLine /= 8; 581 sLine /= 8;
@@ -590,39 +595,45 @@ void DayItemMonth::paint( QPainter *p, const QColorGroup &cg,
590 } 595 }
591 if (!ev.hasRepeat()) { 596 if (!ev.hasRepeat()) {
592 normalLine.push(sLine); 597 normalLine.push(sLine);
593 normalLine.push(eLine); 598 normalLine.push(eLine);
594 } else { 599 } else {
595 repeatLine.push(sLine); 600 repeatLine.push(sLine);
596 repeatLine.push(eLine); 601 repeatLine.push(eLine);
597 } 602 }
598 } 603 }
599 } 604 }
600 605
601 // draw the background 606 // draw the background
602 if (normalAllDay || repeatAllDay || travelAllDay) { 607 if (normalAllDay || repeatAllDay || travelAllDay || holidayAllDay) {
603 p->save(); 608 p->save();
604 609
605 if (normalAllDay) 610 if (normalAllDay)
606 if (repeatAllDay) { 611 if (repeatAllDay) {
607 p->fillRect( 0, 0, cr.width(), cr.height() / 2, 612 p->fillRect( 0, 0, cr.width(), cr.height() / 2,
608 colorNormalLight ); 613 colorNormalLight );
609 p->fillRect( 0, cr.height() / 2, cr.width(), cr.height() / 2, 614 p->fillRect( 0, cr.height() / 2, cr.width(), cr.height() / 2,
610 colorRepeatLight ); 615 colorRepeatLight );
611 } else 616 } else {
617 if (!holidayAllDay) {
612 p->fillRect( 0, 0, cr.width(), cr.height(), 618 p->fillRect( 0, 0, cr.width(), cr.height(),
613 colorNormalLight ); 619 colorNormalLight );
614 else if (repeatAllDay) 620 } else {
621 p->fillRect( 0, 0, cr.width(), cr.height(),
622 QColor(0,220,0) );
623 }
624 } else if (repeatAllDay) {
615 p->fillRect( 0, 0, cr.width(), cr.height(), 625 p->fillRect( 0, 0, cr.width(), cr.height(),
616 colorRepeatLight ); 626 colorRepeatLight );
627 }
617 } else { 628 } else {
618 p->fillRect( 0, 0, cr.width(), 629 p->fillRect( 0, 0, cr.width(),
619 cr.height(), selected 630 cr.height(), selected
620 ? g.brush( QColorGroup::Highlight ) 631 ? g.brush( QColorGroup::Highlight )
621 : g.brush( QColorGroup::Base ) ); 632 : g.brush( QColorGroup::Base ) );
622 } 633 }
623 634
624 // The lines 635 // The lines
625 // now for the lines. 636 // now for the lines.
626 int h = 5; 637 int h = 5;
627 int y = cr.height() / 2 - h; 638 int y = cr.height() / 2 - h;
628 639