Diffstat (limited to 'korganizer/datenavigatorcontainer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 74 |
1 files changed, 44 insertions, 30 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index d1caff3..2290c53 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp | |||
@@ -74,17 +74,49 @@ void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) | |||
74 | connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); | 74 | connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); |
75 | connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); | 75 | connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); |
76 | 76 | ||
77 | connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); | 77 | connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) ); |
78 | connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); | 78 | connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) ); |
79 | connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); | 79 | connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) ); |
80 | connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); | 80 | connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) ); |
81 | 81 | ||
82 | connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); | 82 | connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); |
83 | } | 83 | } |
84 | void DateNavigatorContainer::slotgoNextYear() | ||
85 | { | ||
86 | jumpMonth( 12 ); | ||
87 | emit goNextYear(); | ||
88 | |||
89 | } | ||
90 | void DateNavigatorContainer::slotgoPrevYear() | ||
91 | { | ||
92 | jumpMonth( -12 ); | ||
93 | emit goPrevYear(); | ||
94 | |||
95 | } | ||
96 | void DateNavigatorContainer::slotgoPrevMonth() | ||
97 | { | ||
98 | jumpMonth( -1 ); | ||
99 | emit goPrevMonth(); | ||
100 | |||
101 | } | ||
102 | void DateNavigatorContainer::slotgoNextMonth() | ||
103 | { | ||
104 | jumpMonth( 1 ); | ||
105 | emit goNextMonth(); | ||
106 | } | ||
107 | void DateNavigatorContainer::jumpMonth( int month ) | ||
108 | { | ||
84 | 109 | ||
110 | QDate baseDate = mNavigatorView->baseDate(); | ||
111 | computeMonthSelected( baseDate.month() + month, false ); | ||
112 | } | ||
85 | void DateNavigatorContainer::slotMonthSelected( int month ) | 113 | void DateNavigatorContainer::slotMonthSelected( int month ) |
86 | { | 114 | { |
87 | //qDebug("slotMonthSelected %d ", month); | 115 | computeMonthSelected( month, true ); |
116 | } | ||
117 | void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit ) | ||
118 | { | ||
119 | //qDebug("slotMonthSelected %d ", month); | ||
88 | QDate baseDate = mNavigatorView->baseDate(); | 120 | QDate baseDate = mNavigatorView->baseDate(); |
89 | if ( baseDate.month() == month ) | 121 | if ( baseDate.month() == month ) |
90 | return; | 122 | return; |
@@ -93,27 +125,6 @@ void DateNavigatorContainer::slotMonthSelected( int month ) | |||
93 | date = date.addDays( -(baseDate.month()-month ) *30 ); | 125 | date = date.addDays( -(baseDate.month()-month ) *30 ); |
94 | QDate newBase = QDate ( date.year(), date.month() , baseDate.day() ); | 126 | QDate newBase = QDate ( date.year(), date.month() , baseDate.day() ); |
95 | 127 | ||
96 | #if 0 | ||
97 | mFirstSelectedDate = dateList.first() ; | ||
98 | mSelectedDateCount = dateList.count() ; | ||
99 | |||
100 | KDateNavigator *view = mExtraViews.at( 0 ); | ||
101 | QDate date = view->baseDate(); | ||
102 | |||
103 | QDate curEnd = date.addDays( (mLastDisplayedDN)*30 +7); | ||
104 | //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() ); | ||
105 | if ( lDate < curEnd && date.addDays( -30 ) < fDate) { | ||
106 | mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate ); | ||
107 | mNavigatorView->dayMatrix()->repaint( false ); | ||
108 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | ||
109 | KDateNavigator *n = mExtraViews.at( i ); | ||
110 | if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) { | ||
111 | n->dayMatrix()->repaint( false ); | ||
112 | } | ||
113 | } | ||
114 | return; | ||
115 | } | ||
116 | #endif | ||
117 | //qDebug("NEW BASE %s", newBase.toString().latin1()); | 128 | //qDebug("NEW BASE %s", newBase.toString().latin1()); |
118 | mNavigatorView->setBaseDate( newBase ); | 129 | mNavigatorView->setBaseDate( newBase ); |
119 | QDate last = lastAvailableDate(); | 130 | QDate last = lastAvailableDate(); |
@@ -121,14 +132,17 @@ void DateNavigatorContainer::slotMonthSelected( int month ) | |||
121 | 132 | ||
122 | QDate selFirst = mFirstSelectedDate; | 133 | QDate selFirst = mFirstSelectedDate; |
123 | QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); | 134 | QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); |
124 | if ( selFirst >= first && selLast <= last ) { | 135 | if ( selFirst >= first && selLast <= last ) { |
125 | setBaseDates(); | 136 | setBaseDates(); |
126 | updateDayMatrixDates(); | 137 | if ( forceEmit ) |
138 | updateDayMatrixDates(); | ||
127 | } | 139 | } |
128 | else { | 140 | else { |
129 | setBaseDates(); | 141 | setBaseDates(); |
130 | updateDayMatrixDates(); | 142 | if ( forceEmit ) |
131 | emit monthSelected( month ); | 143 | updateDayMatrixDates(); |
144 | if ( forceEmit ) | ||
145 | emit monthSelected( month ); | ||
132 | } | 146 | } |
133 | } | 147 | } |
134 | void DateNavigatorContainer::setCalendar( Calendar *cal ) | 148 | void DateNavigatorContainer::setCalendar( Calendar *cal ) |