author | zautrix <zautrix> | 2005-10-22 17:03:38 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-22 17:03:38 (UTC) |
commit | c1cb0653160e8e449d07a0df7b84b2398c0201fb (patch) (unidiff) | |
tree | 41c648d74574cb47b1e3341a918b448b86c264d9 | |
parent | 3ec18dd19fdf4eb7e763b8022f90de83249facfd (diff) | |
download | kdepimpi-c1cb0653160e8e449d07a0df7b84b2398c0201fb.zip kdepimpi-c1cb0653160e8e449d07a0df7b84b2398c0201fb.tar.gz kdepimpi-c1cb0653160e8e449d07a0df7b84b2398c0201fb.tar.bz2 |
fix
-rw-r--r-- | korganizer/kodaymatrix.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 7076e05..52fd1e8 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -603,130 +603,130 @@ void KODayMatrix::updateViewTimed() | |||
603 | if ( !event->location().isEmpty() ) | 603 | if ( !event->location().isEmpty() ) |
604 | holiStr += " (" + event->location() + ")"; | 604 | holiStr += " (" + event->location() + ")"; |
605 | bDays.setBit(i); | 605 | bDays.setBit(i); |
606 | } | 606 | } |
607 | } | 607 | } |
608 | if ( numEvents ) | 608 | if ( numEvents ) |
609 | eDays.setBit(i); | 609 | eDays.setBit(i); |
610 | //if it is a holy day then draw it red. Sundays are consider holidays, too | 610 | //if it is a holy day then draw it red. Sundays are consider holidays, too |
611 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 611 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
612 | !holiStr.isEmpty()) { | 612 | !holiStr.isEmpty()) { |
613 | mHolidays[i] = holiStr; | 613 | mHolidays[i] = holiStr; |
614 | } else { | 614 | } else { |
615 | mHolidays[i] = QString::null; | 615 | mHolidays[i] = QString::null; |
616 | } | 616 | } |
617 | } | 617 | } |
618 | #endif | 618 | #endif |
619 | mRedrawNeeded = true; | 619 | mRedrawNeeded = true; |
620 | if ( ! mPendingUpdateBeforeRepaint ) | 620 | if ( ! mPendingUpdateBeforeRepaint ) |
621 | repaint(false); | 621 | repaint(false); |
622 | } | 622 | } |
623 | void KODayMatrix::updateView(QDate actdate) | 623 | void KODayMatrix::updateView(QDate actdate) |
624 | { | 624 | { |
625 | if ( mLastView != KOPrefs::instance()->mCurrentDisplayedView ) | 625 | if ( mLastView != KOPrefs::instance()->mCurrentDisplayedView ) |
626 | mRedrawNeeded = true; | 626 | mRedrawNeeded = true; |
627 | mLastView = KOPrefs::instance()->mCurrentDisplayedView; | 627 | mLastView = KOPrefs::instance()->mCurrentDisplayedView; |
628 | if ( ! actdate.isValid() ) { | 628 | if ( ! actdate.isValid() ) { |
629 | //qDebug("date not valid "); | 629 | //qDebug("date not valid "); |
630 | return; | 630 | return; |
631 | } | 631 | } |
632 | mDayChanged = false; | 632 | mDayChanged = false; |
633 | //flag to indicate if the starting day of the matrix has changed by this call | 633 | //flag to indicate if the starting day of the matrix has changed by this call |
634 | //mDayChanged = false; | 634 | //mDayChanged = false; |
635 | // if a new startdate is to be set then apply Cornelius's calculation | 635 | // if a new startdate is to be set then apply Cornelius's calculation |
636 | // of the first day to be shown | 636 | // of the first day to be shown |
637 | if (actdate != startdate) { | 637 | if (actdate != startdate) { |
638 | // reset index of selection according to shift of starting date from startdate to actdate | 638 | // reset index of selection according to shift of starting date from startdate to actdate |
639 | if (mSelStart != NOSELECTION) { | 639 | if (mSelStart != NOSELECTION) { |
640 | int tmp = actdate.daysTo(startdate); | 640 | int tmp = actdate.daysTo(startdate); |
641 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | 641 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; |
642 | // shift selection if new one would be visible at least partly ! | 642 | // shift selection if new one would be visible at least partly ! |
643 | 643 | ||
644 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | 644 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { |
645 | // nested if is required for next X display pushed from a different month - correction required | 645 | // nested if is required for next X display pushed from a different month - correction required |
646 | // otherwise, for month forward and backward, it must be avoided | 646 | // otherwise, for month forward and backward, it must be avoided |
647 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | 647 | if( mSelStart > NUMDAYS || mSelStart < 0 ) |
648 | mSelStart = mSelStart + tmp; | 648 | mSelStart = mSelStart + tmp; |
649 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | 649 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) |
650 | mSelEnd = mSelEnd + tmp; | 650 | mSelEnd = mSelEnd + tmp; |
651 | } | 651 | } |
652 | } | 652 | } |
653 | startdate = actdate; | 653 | startdate = actdate; |
654 | mDayChanged = true; | 654 | mDayChanged = true; |
655 | recalculateToday(); | 655 | recalculateToday(); |
656 | mRedrawNeeded = true; | 656 | mRedrawNeeded = true; |
657 | } | 657 | } |
658 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); | 658 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); |
659 | if ( !isVisible() ) { | 659 | if ( !isVisible() ) { |
660 | mPendingUpdateBeforeRepaint = true; | 660 | mPendingUpdateBeforeRepaint = true; |
661 | } else { | 661 | } else { |
662 | #ifdef DESKTOP_VERSION | 662 | #ifdef DESKTOP_VERSION |
663 | //mRepaintTimer->start( 100 ); | 663 | //mRepaintTimer->start( 100 ); |
664 | //updateViewTimed(); | 664 | //updateViewTimed(); |
665 | mUpdateTimer->start( 50 ); | 665 | mUpdateTimer->start( 50 ); |
666 | #else | 666 | #else |
667 | mRepaintTimer->start( 350 ); | 667 | mRepaintTimer->start( 250 ); |
668 | mUpdateTimer->start( 800 ); | 668 | mUpdateTimer->start( 500 ); |
669 | #endif | 669 | #endif |
670 | } | 670 | } |
671 | } | 671 | } |
672 | void KODayMatrix::updateEvents() | 672 | void KODayMatrix::updateEvents() |
673 | { | 673 | { |
674 | if ( !mCalendar ) return; | 674 | if ( !mCalendar ) return; |
675 | 675 | ||
676 | for( int i = 0; i < NUMDAYS; i++ ) { | 676 | for( int i = 0; i < NUMDAYS; i++ ) { |
677 | // if events are set for the day then remember to draw it bold | 677 | // if events are set for the day then remember to draw it bold |
678 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); | 678 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); |
679 | int numEvents = eventlist.count(); | 679 | int numEvents = eventlist.count(); |
680 | Event *event; | 680 | Event *event; |
681 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { | 681 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { |
682 | ushort recurType = event->doesRecur(); | 682 | ushort recurType = event->doesRecur(); |
683 | 683 | ||
684 | if ( ( recurType == Recurrence::rDaily && | 684 | if ( ( recurType == Recurrence::rDaily && |
685 | !KOPrefs::instance()->mDailyRecur ) || | 685 | !KOPrefs::instance()->mDailyRecur ) || |
686 | ( recurType == Recurrence::rWeekly && | 686 | ( recurType == Recurrence::rWeekly && |
687 | !KOPrefs::instance()->mWeeklyRecur ) ) { | 687 | !KOPrefs::instance()->mWeeklyRecur ) ) { |
688 | numEvents--; | 688 | numEvents--; |
689 | } | 689 | } |
690 | if ( !KOPrefs::instance()->mLongAllday && event->doesFloat()&& event->isMultiDay() ) { | 690 | if ( !KOPrefs::instance()->mLongAllday && event->doesFloat()&& event->isMultiDay() ) { |
691 | numEvents--; | 691 | numEvents--; |
692 | } | 692 | } |
693 | } | 693 | } |
694 | if ( numEvents ) | 694 | if ( numEvents ) |
695 | eDays.setBit(i); | 695 | eDays.setBit(i); |
696 | else | 696 | else |
697 | eDays.clearBit(i); | 697 | eDays.clearBit(i); |
698 | } | 698 | } |
699 | } | 699 | } |
700 | 700 | ||
701 | const QDate& KODayMatrix::getDate(int offset) | 701 | const QDate& KODayMatrix::getDate(int offset) |
702 | { | 702 | { |
703 | if (offset < 0 || offset > NUMDAYS-1) { | 703 | if (offset < 0 || offset > NUMDAYS-1) { |
704 | qDebug("Wrong offset2 %d", offset); | 704 | qDebug("Wrong offset2 %d", offset); |
705 | return days[0]; | 705 | return days[0]; |
706 | } | 706 | } |
707 | return days[offset]; | 707 | return days[offset]; |
708 | } | 708 | } |
709 | 709 | ||
710 | QString KODayMatrix::getHolidayLabel(int offset) | 710 | QString KODayMatrix::getHolidayLabel(int offset) |
711 | { | 711 | { |
712 | if (offset < 0 || offset > NUMDAYS-1) { | 712 | if (offset < 0 || offset > NUMDAYS-1) { |
713 | qDebug("Wrong offset1 %d", offset); | 713 | qDebug("Wrong offset1 %d", offset); |
714 | return QString(); | 714 | return QString(); |
715 | } | 715 | } |
716 | return mHolidays[offset]; | 716 | return mHolidays[offset]; |
717 | } | 717 | } |
718 | 718 | ||
719 | int KODayMatrix::getDayIndexFrom(int x, int y) | 719 | int KODayMatrix::getDayIndexFrom(int x, int y) |
720 | { | 720 | { |
721 | int colModulo = (width()-2) % 7; | 721 | int colModulo = (width()-2) % 7; |
722 | int rowModulo = (height()-2) % 6; | 722 | int rowModulo = (height()-2) % 6; |
723 | #if 0 | 723 | #if 0 |
724 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? | 724 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? |
725 | 6 - x/daysize.width() : x/daysize.width()); | 725 | 6 - x/daysize.width() : x/daysize.width()); |
726 | #endif | 726 | #endif |
727 | int xVal = (x-colModulo/2-2)/daysize.width(); | 727 | int xVal = (x-colModulo/2-2)/daysize.width(); |
728 | int yVal = (y-rowModulo/2-2)/daysize.height(); | 728 | int yVal = (y-rowModulo/2-2)/daysize.height(); |
729 | 729 | ||
730 | 730 | ||
731 | return 7*(yVal) + xVal; | 731 | return 7*(yVal) + xVal; |
732 | 732 | ||