-rw-r--r-- | korganizer/kdatenavigator.cpp | 4 | ||||
-rw-r--r-- | korganizer/kdatenavigator.h | 2 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 8 |
3 files changed, 9 insertions, 5 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 4b50b5a..2321acb 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -159,34 +159,34 @@ QSize KDateNavigator::sizeHint() const | |||
159 | } | 159 | } |
160 | QSize KDateNavigator::sizeHintTwoButtons() const | 160 | QSize KDateNavigator::sizeHintTwoButtons() const |
161 | { | 161 | { |
162 | QFontMetrics fm ( font() ); | 162 | QFontMetrics fm ( font() ); |
163 | QSize day = daymatrix->sizeHint(); | 163 | QSize day = daymatrix->sizeHint(); |
164 | QSize nav = mNavigatorBar->sizeHintTwoButtons(); | 164 | QSize nav = mNavigatorBar->sizeHintTwoButtons(); |
165 | int wid = fm.width( "30") + day.width()+3; | 165 | int wid = fm.width( "30") + day.width()+3; |
166 | int hei = fm.height() +day.height()+nav.height()+2; | 166 | int hei = fm.height() +day.height()+nav.height()+2; |
167 | if ( wid < nav.width() ) | 167 | if ( wid < nav.width() ) |
168 | wid = nav.width() ; | 168 | wid = nav.width() ; |
169 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); | 169 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); |
170 | return QSize ( wid, hei ); | 170 | return QSize ( wid, hei ); |
171 | } | 171 | } |
172 | void KDateNavigator::slotMonthSelected( int m ) | 172 | void KDateNavigator::slotMonthSelected( int m ) |
173 | { | 173 | { |
174 | if ( m_MthYr.month() <= mMonthSignalOffset) | 174 | if ( m_MthYr.month() <= mMonthSignalOffset) |
175 | m += 12; | 175 | m += 12; |
176 | int mo = m - mMonthSignalOffset; | 176 | //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset); |
177 | emit monthSelected( m - mMonthSignalOffset ); | 177 | emit monthSelected( m - mMonthSignalOffset ); |
178 | 178 | ||
179 | } | 179 | } |
180 | void KDateNavigator::setCalendar( Calendar *cal ) | 180 | void KDateNavigator::setCalendar( Calendar *cal ) |
181 | { | 181 | { |
182 | daymatrix->setCalendar( cal ); | 182 | daymatrix->setCalendar( cal ); |
183 | } | 183 | } |
184 | 184 | ||
185 | void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true | 185 | void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true |
186 | { | 186 | { |
187 | m_MthYr = date; | 187 | m_MthYr = date; |
188 | 188 | ||
189 | updateDates(); | 189 | updateDates(); |
190 | updateView(); | 190 | updateView(); |
191 | 191 | ||
192 | KCal::DateList dates; | 192 | KCal::DateList dates; |
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h index d1f32b6..77b9b7c 100644 --- a/korganizer/kdatenavigator.h +++ b/korganizer/kdatenavigator.h | |||
@@ -50,33 +50,33 @@ class KDateNavigator: public QFrame | |||
50 | * set to None, no signals are emitted and no | 50 | * set to None, no signals are emitted and no |
51 | * processing is done. With rollover set to | 51 | * processing is done. With rollover set to |
52 | * FollowDay, the day highlighter changes at | 52 | * FollowDay, the day highlighter changes at |
53 | * midnight and dayPassed() is emitted. | 53 | * midnight and dayPassed() is emitted. |
54 | * With FollowMonth, it has the same effect | 54 | * With FollowMonth, it has the same effect |
55 | * as FollowDay but also adjusts the month that is | 55 | * as FollowDay but also adjusts the month that is |
56 | * visible and emits monthPassed() when the month changes. | 56 | * visible and emits monthPassed() when the month changes. |
57 | */ | 57 | */ |
58 | enum RolloverType { None, FollowDay, FollowMonth } ; | 58 | enum RolloverType { None, FollowDay, FollowMonth } ; |
59 | void enableRollover( RolloverType ); | 59 | void enableRollover( RolloverType ); |
60 | 60 | ||
61 | void setShowWeekNums( bool enabled ); | 61 | void setShowWeekNums( bool enabled ); |
62 | void setCalendar( Calendar * ); | 62 | void setCalendar( Calendar * ); |
63 | void setBaseDate( const QDate & , bool doRepaint = true ); | 63 | void setBaseDate( const QDate & , bool doRepaint = true ); |
64 | KCal::DateList selectedDates() const { return mSelectedDates; } | 64 | KCal::DateList selectedDates() const { return mSelectedDates; } |
65 | NavigatorBar *navigatorBar() const { return mNavigatorBar; } | 65 | NavigatorBar *navigatorBar() const { return mNavigatorBar; } |
66 | void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;} | 66 | void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;} |
67 | QSize yourSizeHint() { return mySizeHint; } | 67 | QSize yourSizeHint() { return mySizeHint; } |
68 | QFont yourFontHint( QSize , bool * b); | 68 | QFont yourFontHint( QSize , bool * b); |
69 | bool fontChanged() {return mFontChanged; } | 69 | bool fontChanged() {return mFontChanged; } |
70 | void unsetFontChanged() { mFontChanged = false; } | 70 | void unsetFontChanged() { mFontChanged = false; } |
71 | KODayMatrix *dayMatrix() { return daymatrix ;} | 71 | KODayMatrix *dayMatrix() { return daymatrix ;} |
72 | QSize sizeHint() const; | 72 | QSize sizeHint() const; |
73 | QSize sizeHintTwoButtons() const; | 73 | QSize sizeHintTwoButtons() const; |
74 | void changeFont ( QFont fo ); | 74 | void changeFont ( QFont fo ); |
75 | public slots: | 75 | public slots: |
76 | void selectDates( const KCal::DateList & ); | 76 | void selectDates( const KCal::DateList & ); |
77 | void updateView(); | 77 | void updateView(); |
78 | void updateConfig(); | 78 | void updateConfig(); |
79 | void updateDayMatrix(); | 79 | void updateDayMatrix(); |
80 | 80 | ||
81 | signals: | 81 | signals: |
82 | void datesSelected( const KCal::DateList & ); | 82 | void datesSelected( const KCal::DateList & ); |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 9baff20..493382d 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -398,34 +398,34 @@ void KODayMatrix::updateView(QDate actdate) | |||
398 | // otherwise, for month forward and backward, it must be avoided | 398 | // otherwise, for month forward and backward, it must be avoided |
399 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | 399 | if( mSelStart > NUMDAYS || mSelStart < 0 ) |
400 | mSelStart = mSelStart + tmp; | 400 | mSelStart = mSelStart + tmp; |
401 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | 401 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) |
402 | mSelEnd = mSelEnd + tmp; | 402 | mSelEnd = mSelEnd + tmp; |
403 | } | 403 | } |
404 | } | 404 | } |
405 | startdate = actdate; | 405 | startdate = actdate; |
406 | mDayChanged = true; | 406 | mDayChanged = true; |
407 | recalculateToday(); | 407 | recalculateToday(); |
408 | } | 408 | } |
409 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); | 409 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); |
410 | if ( !isVisible() ) { | 410 | if ( !isVisible() ) { |
411 | mPendingUpdateBeforeRepaint = true; | 411 | mPendingUpdateBeforeRepaint = true; |
412 | } else { | 412 | } else { |
413 | #ifdef DESKTOP_VERSION | 413 | #ifdef DESKTOP_VERSION |
414 | //mRepaintTimer->start( 150 ); | 414 | //mRepaintTimer->start( 100 ); |
415 | mUpdateTimer->start( 150 ); | 415 | mUpdateTimer->start( 100 ); |
416 | #else | 416 | #else |
417 | mRepaintTimer->start( 350 ); | 417 | mRepaintTimer->start( 350 ); |
418 | mUpdateTimer->start( 1200 ); | 418 | mUpdateTimer->start( 1200 ); |
419 | #endif | 419 | #endif |
420 | } | 420 | } |
421 | } | 421 | } |
422 | void KODayMatrix::updateEvents() | 422 | void KODayMatrix::updateEvents() |
423 | { | 423 | { |
424 | if ( !mCalendar ) return; | 424 | if ( !mCalendar ) return; |
425 | 425 | ||
426 | for( int i = 0; i < NUMDAYS; i++ ) { | 426 | for( int i = 0; i < NUMDAYS; i++ ) { |
427 | // if events are set for the day then remember to draw it bold | 427 | // if events are set for the day then remember to draw it bold |
428 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); | 428 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); |
429 | int numEvents = eventlist.count(); | 429 | int numEvents = eventlist.count(); |
430 | Event *event; | 430 | Event *event; |
431 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { | 431 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { |
@@ -822,32 +822,34 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
822 | QColor grey("grey"); | 822 | QColor grey("grey"); |
823 | mTodayPen.setColor(grey); | 823 | mTodayPen.setColor(grey); |
824 | } | 824 | } |
825 | p.setPen(mTodayPen); | 825 | p.setPen(mTodayPen); |
826 | 826 | ||
827 | 827 | ||
828 | int addCol = 0; | 828 | int addCol = 0; |
829 | int addRow = 0; | 829 | int addRow = 0; |
830 | if (rowModulo) { | 830 | if (rowModulo) { |
831 | if ( row >= 6 - rowModulo ) | 831 | if ( row >= 6 - rowModulo ) |
832 | addRow = row - 5 + rowModulo; | 832 | addRow = row - 5 + rowModulo; |
833 | } | 833 | } |
834 | if ( colModulo ) { | 834 | if ( colModulo ) { |
835 | if ( col >= 7 - colModulo ) | 835 | if ( col >= 7 - colModulo ) |
836 | addCol = col - 6 + colModulo-1; | 836 | addCol = col - 6 + colModulo-1; |
837 | } | 837 | } |
838 | if ( col == 0 ) | ||
839 | addCol = 1; | ||
838 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); | 840 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); |
839 | p.setPen(tmppen); | 841 | p.setPen(tmppen); |
840 | } | 842 | } |
841 | 843 | ||
842 | // if any events are on that day then draw it using a bold font | 844 | // if any events are on that day then draw it using a bold font |
843 | if (events[i] > 0) { | 845 | if (events[i] > 0) { |
844 | QFont myFont = font(); | 846 | QFont myFont = font(); |
845 | myFont.setBold(true); | 847 | myFont.setBold(true); |
846 | p.setFont(myFont); | 848 | p.setFont(myFont); |
847 | } | 849 | } |
848 | 850 | ||
849 | // if it is a holiday then use the default holiday color | 851 | // if it is a holiday then use the default holiday color |
850 | if (!mHolidays[i].isNull()) { | 852 | if (!mHolidays[i].isNull()) { |
851 | if ( bDays.testBit(i) ) { | 853 | if ( bDays.testBit(i) ) { |
852 | p.setPen(Qt::green); | 854 | p.setPen(Qt::green); |
853 | } else { | 855 | } else { |
@@ -864,32 +866,34 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
864 | if (i >= mSelStartT && i <= mSelEndT) { | 866 | if (i >= mSelStartT && i <= mSelEndT) { |
865 | ;//p.setPen(mSelectedDaysColor); | 867 | ;//p.setPen(mSelectedDaysColor); |
866 | } | 868 | } |
867 | 869 | ||
868 | int addCol = 0; | 870 | int addCol = 0; |
869 | int addRow = 0; | 871 | int addRow = 0; |
870 | if ( colModulo ) { | 872 | if ( colModulo ) { |
871 | if ( col >= 7 - colModulo ) | 873 | if ( col >= 7 - colModulo ) |
872 | addCol = col - 7 + colModulo; | 874 | addCol = col - 7 + colModulo; |
873 | } | 875 | } |
874 | if ( rowModulo ) { | 876 | if ( rowModulo ) { |
875 | if ( row >= 6 - rowModulo ) | 877 | if ( row >= 6 - rowModulo ) |
876 | addRow = row - 5 + rowModulo; | 878 | addRow = row - 5 + rowModulo; |
877 | } | 879 | } |
878 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); | 880 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); |
879 | ++addCol;//++addCol; | 881 | ++addCol;//++addCol; |
882 | if ( row == 0) | ||
883 | addRow = 1; | ||
880 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, | 884 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, |
881 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | 885 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
882 | 886 | ||
883 | // reset color to actual color | 887 | // reset color to actual color |
884 | if (!mHolidays[i].isNull()) { | 888 | if (!mHolidays[i].isNull()) { |
885 | p.setPen(actcol); | 889 | p.setPen(actcol); |
886 | } | 890 | } |
887 | // reset bold font to plain font | 891 | // reset bold font to plain font |
888 | if (events[i] > 0) { | 892 | if (events[i] > 0) { |
889 | QFont myFont = font(); | 893 | QFont myFont = font(); |
890 | myFont.setBold(false); | 894 | myFont.setBold(false); |
891 | p.setFont(myFont); | 895 | p.setFont(myFont); |
892 | } | 896 | } |
893 | } | 897 | } |
894 | int off = xyOff; | 898 | int off = xyOff; |
895 | bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP); | 899 | bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP); |