author | zautrix <zautrix> | 2005-01-30 14:15:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-30 14:15:42 (UTC) |
commit | 8d543aa1d1d1ed20001c8b18352d1d29c2979e48 (patch) (unidiff) | |
tree | 9ca05f4d3bc1de81bcf0446a2f7471d552089c87 /korganizer | |
parent | 1bcef8b3f53419e7155e0862ad61e3e419763d70 (diff) | |
download | kdepimpi-8d543aa1d1d1ed20001c8b18352d1d29c2979e48.zip kdepimpi-8d543aa1d1d1ed20001c8b18352d1d29c2979e48.tar.gz kdepimpi-8d543aa1d1d1ed20001c8b18352d1d29c2979e48.tar.bz2 |
many fixes
-rw-r--r-- | korganizer/kdatenavigator.cpp | 4 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 5 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 100 | ||||
-rw-r--r-- | korganizer/kodaymatrix.h | 5 |
4 files changed, 78 insertions, 36 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index b420351..f31e50a 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -227,3 +227,3 @@ void KDateNavigator::updateDayMatrix() | |||
227 | daymatrix->updateView(); | 227 | daymatrix->updateView(); |
228 | daymatrix->repaint(); | 228 | //daymatrix->repaint(); |
229 | } | 229 | } |
@@ -264,3 +264,3 @@ void KDateNavigator::updateView() | |||
264 | repaint(); | 264 | repaint(); |
265 | daymatrix->repaint(); | 265 | // daymatrix->repaint(); |
266 | } | 266 | } |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 39355b4..ee9f39a 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -471,2 +471,3 @@ void KOAgendaItem::computeText() | |||
471 | if ( (mIncidence->type() == "Todo") ) { | 471 | if ( (mIncidence->type() == "Todo") ) { |
472 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { | ||
472 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) | 473 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) |
@@ -475,5 +476,3 @@ void KOAgendaItem::computeText() | |||
475 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; | 476 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; |
476 | 477 | } | |
477 | |||
478 | |||
479 | } else { | 478 | } else { |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index fc00828..060b4c4 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -110,3 +110,9 @@ KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const | |||
110 | //setFont( QFont("Arial", 10) ); | 110 | //setFont( QFont("Arial", 10) ); |
111 | updateView(date); | 111 | |
112 | mUpdateTimer = new QTimer( this ); | ||
113 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); | ||
114 | mRepaintTimer = new QTimer( this ); | ||
115 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); | ||
116 | mDayChanged = false; | ||
117 | updateView(); | ||
112 | } | 118 | } |
@@ -204,35 +210,20 @@ void KODayMatrix::updateView() | |||
204 | } | 210 | } |
205 | 211 | void KODayMatrix::repaintViewTimed() | |
206 | void KODayMatrix::updateView(QDate actdate) | ||
207 | { | 212 | { |
208 | 213 | qDebug("KODayMatrix::repaintViewTimed "); | |
209 | // kdDebug() << "KODayMatrix::updateView() " << actdate.toString() << endl; | 214 | mRepaintTimer->stop(); |
210 | 215 | repaint(false); | |
211 | //flag to indicate if the starting day of the matrix has changed by this call | ||
212 | bool daychanged = false; | ||
213 | // if a new startdate is to be set then apply Cornelius's calculation | ||
214 | // of the first day to be shown | ||
215 | if (actdate != startdate) { | ||
216 | // reset index of selection according to shift of starting date from startdate to actdate | ||
217 | if (mSelStart != NOSELECTION) { | ||
218 | int tmp = actdate.daysTo(startdate); | ||
219 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | ||
220 | // shift selection if new one would be visible at least partly ! | ||
221 | |||
222 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | ||
223 | // nested if is required for next X display pushed from a different month - correction required | ||
224 | // otherwise, for month forward and backward, it must be avoided | ||
225 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | ||
226 | mSelStart = mSelStart + tmp; | ||
227 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | ||
228 | mSelEnd = mSelEnd + tmp; | ||
229 | } | ||
230 | } | 216 | } |
217 | void KODayMatrix::updateViewTimed() | ||
218 | { | ||
231 | 219 | ||
232 | startdate = actdate; | 220 | mUpdateTimer->stop(); |
233 | daychanged = true; | 221 | //QDate actdate = mPendingNewDate; |
234 | } | 222 | |
223 | static int iii = 0; | ||
224 | qDebug("KODayMatrix::updateView(QDate actdate) %d", ++iii ); | ||
235 | 225 | ||
236 | if (daychanged) { | 226 | if (mDayChanged) { |
237 | recalculateToday(); | 227 | recalculateToday(); |
228 | mDayChanged = false; | ||
238 | } | 229 | } |
@@ -271,2 +262,49 @@ void KODayMatrix::updateView(QDate actdate) | |||
271 | } | 262 | } |
263 | repaint(false); | ||
264 | } | ||
265 | void KODayMatrix::updateView(QDate actdate) | ||
266 | { | ||
267 | |||
268 | //flag to indicate if the starting day of the matrix has changed by this call | ||
269 | //mDayChanged = false; | ||
270 | // if a new startdate is to be set then apply Cornelius's calculation | ||
271 | // of the first day to be shown | ||
272 | if (actdate != startdate) { | ||
273 | // reset index of selection according to shift of starting date from startdate to actdate | ||
274 | if (mSelStart != NOSELECTION) { | ||
275 | int tmp = actdate.daysTo(startdate); | ||
276 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | ||
277 | // shift selection if new one would be visible at least partly ! | ||
278 | |||
279 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | ||
280 | // nested if is required for next X display pushed from a different month - correction required | ||
281 | // otherwise, for month forward and backward, it must be avoided | ||
282 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | ||
283 | mSelStart = mSelStart + tmp; | ||
284 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | ||
285 | mSelEnd = mSelEnd + tmp; | ||
286 | } | ||
287 | } | ||
288 | |||
289 | startdate = actdate; | ||
290 | mDayChanged = true; | ||
291 | } | ||
292 | qDebug("restart Timer %d", mDayChanged ); | ||
293 | static int iii = 0; | ||
294 | if ( iii < 5 ) { | ||
295 | ++iii; | ||
296 | updateViewTimed(); | ||
297 | } else { | ||
298 | if ( !isVisible() ) { | ||
299 | mUpdateTimer->start( 2000 ); | ||
300 | } else { | ||
301 | if ( mDayChanged ) { | ||
302 | mUpdateTimer->start( 250 ); | ||
303 | } else { | ||
304 | mRepaintTimer->start( 250 ); | ||
305 | mUpdateTimer->start( 2000 ); | ||
306 | } | ||
307 | } | ||
308 | } | ||
309 | |||
272 | } | 310 | } |
@@ -276,3 +314,3 @@ const QDate& KODayMatrix::getDate(int offset) | |||
276 | if (offset < 0 || offset > NUMDAYS-1) { | 314 | if (offset < 0 || offset > NUMDAYS-1) { |
277 | kdDebug() << "Wrong offset (" << offset << ") in KODayMatrix::getDate(int)" << endl; | 315 | qDebug("Wrong offset2 "); |
278 | return days[0]; | 316 | return days[0]; |
@@ -285,3 +323,3 @@ QString KODayMatrix::getHolidayLabel(int offset) | |||
285 | if (offset < 0 || offset > NUMDAYS-1) { | 323 | if (offset < 0 || offset > NUMDAYS-1) { |
286 | kdDebug() << "Wrong offset (" << offset << ") in KODayMatrix::getHolidayLabel(int)" << endl; | 324 | qDebug("Wrong offset1 "); |
287 | return 0; | 325 | return 0; |
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index b4eb2a8..0e9640a 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h | |||
@@ -174,2 +174,4 @@ public slots: | |||
174 | void updateView(); | 174 | void updateView(); |
175 | void updateViewTimed(); | ||
176 | void repaintViewTimed(); | ||
175 | 177 | ||
@@ -221,2 +223,5 @@ protected: | |||
221 | private: | 223 | private: |
224 | QTimer* mUpdateTimer; | ||
225 | QTimer* mRepaintTimer; | ||
226 | bool mDayChanged; | ||
222 | 227 | ||