-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 2 | ||||
-rw-r--r-- | korganizer/kdatenavigator.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index d4173e8..9506768 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp | |||
@@ -110,49 +110,49 @@ void DateNavigatorContainer::updateView() | |||
110 | { | 110 | { |
111 | mNavigatorView->updateView(); | 111 | mNavigatorView->updateView(); |
112 | KDateNavigator *n; | 112 | KDateNavigator *n; |
113 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 113 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
114 | n->updateView(); | 114 | n->updateView(); |
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | void DateNavigatorContainer::updateConfig() | 118 | void DateNavigatorContainer::updateConfig() |
119 | { | 119 | { |
120 | mNavigatorView->updateConfig(); | 120 | mNavigatorView->updateConfig(); |
121 | KDateNavigator *n; | 121 | KDateNavigator *n; |
122 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 122 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
123 | n->updateConfig(); | 123 | n->updateConfig(); |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | void DateNavigatorContainer::selectDates( const DateList &dateList ) | 127 | void DateNavigatorContainer::selectDates( const DateList &dateList ) |
128 | { | 128 | { |
129 | mNavigatorView->selectDates( dateList ); | 129 | mNavigatorView->selectDates( dateList ); |
130 | setBaseDates(); | 130 | setBaseDates(); |
131 | if ( mExtraViews.count() ) { | 131 | if ( mExtraViews.count() ) { |
132 | KDateNavigator *view = mExtraViews.at( 0 ); | 132 | KDateNavigator *view = mExtraViews.at( 0 ); |
133 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | 133 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); |
134 | view->dayMatrix()->repaint(); | 134 | view->dayMatrix()->repaint( false ); |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | void DateNavigatorContainer::setBaseDates() | 138 | void DateNavigatorContainer::setBaseDates() |
139 | { | 139 | { |
140 | KCal::DateList dateList = mNavigatorView->selectedDates(); | 140 | KCal::DateList dateList = mNavigatorView->selectedDates(); |
141 | if ( dateList.isEmpty() ) { | 141 | if ( dateList.isEmpty() ) { |
142 | kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; | 142 | kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; |
143 | } | 143 | } |
144 | QDate baseDate = dateList.first(); | 144 | QDate baseDate = dateList.first(); |
145 | KDateNavigator *n; | 145 | KDateNavigator *n; |
146 | bool doRepaint = false; // skip first repaint | 146 | bool doRepaint = false; // skip first repaint |
147 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 147 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
148 | baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); | 148 | baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); |
149 | n->setBaseDate( baseDate, doRepaint ); | 149 | n->setBaseDate( baseDate, doRepaint ); |
150 | doRepaint = true; | 150 | doRepaint = true; |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) | 154 | void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) |
155 | { | 155 | { |
156 | #if 0 | 156 | #if 0 |
157 | kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; | 157 | kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; |
158 | kdDebug(5850) << " CURRENT SIZE: " << size() << endl; | 158 | kdDebug(5850) << " CURRENT SIZE: " << size() << endl; |
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 2321acb..fe83e09 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -174,98 +174,98 @@ void KDateNavigator::slotMonthSelected( int m ) | |||
174 | if ( m_MthYr.month() <= mMonthSignalOffset) | 174 | if ( m_MthYr.month() <= mMonthSignalOffset) |
175 | m += 12; | 175 | m += 12; |
176 | //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, 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; |
193 | dates.append( date ); | 193 | dates.append( date ); |
194 | mNavigatorBar->selectDates( dates ); | 194 | mNavigatorBar->selectDates( dates ); |
195 | 195 | ||
196 | daymatrix->clearSelection(); | 196 | daymatrix->clearSelection(); |
197 | if ( doRepaint ) | 197 | if ( doRepaint ) |
198 | daymatrix->repaint(); | 198 | daymatrix->repaint( false ); |
199 | } | 199 | } |
200 | 200 | ||
201 | void KDateNavigator::enableRollover(RolloverType r) | 201 | void KDateNavigator::enableRollover(RolloverType r) |
202 | { | 202 | { |
203 | switch(r) | 203 | switch(r) |
204 | { | 204 | { |
205 | case None : | 205 | case None : |
206 | if (updateTimer) | 206 | if (updateTimer) |
207 | { | 207 | { |
208 | updateTimer->stop(); | 208 | updateTimer->stop(); |
209 | delete updateTimer; | 209 | delete updateTimer; |
210 | updateTimer=0L; | 210 | updateTimer=0L; |
211 | } | 211 | } |
212 | break; | 212 | break; |
213 | case FollowDay : | 213 | case FollowDay : |
214 | case FollowMonth : | 214 | case FollowMonth : |
215 | if (!updateTimer) | 215 | if (!updateTimer) |
216 | { | 216 | { |
217 | updateTimer = new QTimer(this); | 217 | updateTimer = new QTimer(this); |
218 | QObject::connect(updateTimer,SIGNAL(timeout()), | 218 | QObject::connect(updateTimer,SIGNAL(timeout()), |
219 | this,SLOT(possiblyPastMidnight())); | 219 | this,SLOT(possiblyPastMidnight())); |
220 | } | 220 | } |
221 | updateTimer->start(0,true); | 221 | updateTimer->start(0,true); |
222 | lastDayChecked = QDate::currentDate(); | 222 | lastDayChecked = QDate::currentDate(); |
223 | } | 223 | } |
224 | updateRollover=r; | 224 | updateRollover=r; |
225 | } | 225 | } |
226 | 226 | ||
227 | 227 | ||
228 | KDateNavigator::~KDateNavigator() | 228 | KDateNavigator::~KDateNavigator() |
229 | { | 229 | { |
230 | } | 230 | } |
231 | 231 | ||
232 | 232 | ||
233 | void KDateNavigator::passedMidnight() | 233 | void KDateNavigator::passedMidnight() |
234 | { | 234 | { |
235 | QDate today = QDate::currentDate(); | 235 | QDate today = QDate::currentDate(); |
236 | bool emitMonth = false; | 236 | bool emitMonth = false; |
237 | 237 | ||
238 | if (today.month() != lastDayChecked.month()) | 238 | if (today.month() != lastDayChecked.month()) |
239 | { | 239 | { |
240 | if (updateRollover==FollowMonth && | 240 | if (updateRollover==FollowMonth && |
241 | daymatrix->isEndOfMonth()) { | 241 | daymatrix->isEndOfMonth()) { |
242 | goNextMonth(); | 242 | goNextMonth(); |
243 | emitMonth=true; | 243 | emitMonth=true; |
244 | } | 244 | } |
245 | } | 245 | } |
246 | daymatrix->recalculateToday(); | 246 | daymatrix->recalculateToday(); |
247 | daymatrix->repaint(); | 247 | daymatrix->repaint( false ); |
248 | emit dayPassed(today); | 248 | emit dayPassed(today); |
249 | if (emitMonth) { emit monthPassed(today); } | 249 | if (emitMonth) { emit monthPassed(today); } |
250 | } | 250 | } |
251 | 251 | ||
252 | /* slot */ void KDateNavigator::possiblyPastMidnight() | 252 | /* slot */ void KDateNavigator::possiblyPastMidnight() |
253 | { | 253 | { |
254 | if (lastDayChecked!=QDate::currentDate()) | 254 | if (lastDayChecked!=QDate::currentDate()) |
255 | { | 255 | { |
256 | passedMidnight(); | 256 | passedMidnight(); |
257 | lastDayChecked=QDate::currentDate(); | 257 | lastDayChecked=QDate::currentDate(); |
258 | } | 258 | } |
259 | // Set the timer to go off 1 second after midnight | 259 | // Set the timer to go off 1 second after midnight |
260 | // or after 8 minutes, whichever comes first. | 260 | // or after 8 minutes, whichever comes first. |
261 | if (updateTimer) | 261 | if (updateTimer) |
262 | { | 262 | { |
263 | QTime now = QTime::currentTime(); | 263 | QTime now = QTime::currentTime(); |
264 | QTime midnight = QTime(23,59,59); | 264 | QTime midnight = QTime(23,59,59); |
265 | int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); | 265 | int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); |
266 | 266 | ||
267 | // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) | 267 | // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) |
268 | //.arg(now.toString()).arg(midnight.toString())); | 268 | //.arg(now.toString()).arg(midnight.toString())); |
269 | 269 | ||
270 | updateTimer->stop(); | 270 | updateTimer->stop(); |
271 | updateTimer->start(msecsWait,true); | 271 | updateTimer->start(msecsWait,true); |