author | zautrix <zautrix> | 2005-01-30 14:15:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-30 14:15:42 (UTC) |
commit | 8d543aa1d1d1ed20001c8b18352d1d29c2979e48 (patch) (side-by-side diff) | |
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 @@ -225,7 +225,7 @@ void KDateNavigator::updateDates() void KDateNavigator::updateDayMatrix() { daymatrix->updateView(); - daymatrix->repaint(); + //daymatrix->repaint(); } @@ -262,7 +262,7 @@ void KDateNavigator::updateView() setUpdatesEnabled( true ); // kdDebug() << "updateView() -> repaint()" << endl; repaint(); - daymatrix->repaint(); + // daymatrix->repaint(); } void KDateNavigator::updateConfig() diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 39355b4..ee9f39a 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -469,13 +469,12 @@ void KOAgendaItem::computeText() mDisplayedText = mIncidence->summary(); if ( (mIncidence->type() == "Todo") ) { + if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; else if ( !(mIncidence->doesFloat())) mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; - - - + } } else { if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index fc00828..060b4c4 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -108,7 +108,13 @@ KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const setAcceptDrops(true); //setFont( QFont("Arial", 10) ); - updateView(date); + + mUpdateTimer = new QTimer( this ); + connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); + mRepaintTimer = new QTimer( this ); + connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); + mDayChanged = false; + updateView(); } QColor KODayMatrix::getShadedColor(QColor color) @@ -202,39 +208,24 @@ void KODayMatrix::updateView() { updateView(startdate); } - -void KODayMatrix::updateView(QDate actdate) +void KODayMatrix::repaintViewTimed() { - -// kdDebug() << "KODayMatrix::updateView() " << actdate.toString() << endl; - - //flag to indicate if the starting day of the matrix has changed by this call - bool daychanged = false; - // if a new startdate is to be set then apply Cornelius's calculation - // of the first day to be shown - if (actdate != startdate) { - // reset index of selection according to shift of starting date from startdate to actdate - if (mSelStart != NOSELECTION) { - int tmp = actdate.daysTo(startdate); - //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; - // shift selection if new one would be visible at least partly ! - - if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { - // nested if is required for next X display pushed from a different month - correction required - // otherwise, for month forward and backward, it must be avoided - if( mSelStart > NUMDAYS || mSelStart < 0 ) - mSelStart = mSelStart + tmp; - if( mSelEnd > NUMDAYS || mSelEnd < 0 ) - mSelEnd = mSelEnd + tmp; - } + qDebug("KODayMatrix::repaintViewTimed "); + mRepaintTimer->stop(); + repaint(false); } +void KODayMatrix::updateViewTimed() +{ - startdate = actdate; - daychanged = true; - } + mUpdateTimer->stop(); + //QDate actdate = mPendingNewDate; + + static int iii = 0; + qDebug("KODayMatrix::updateView(QDate actdate) %d", ++iii ); - if (daychanged) { + if (mDayChanged) { recalculateToday(); + mDayChanged = false; } for(int i = 0; i < NUMDAYS; i++) { @@ -269,12 +260,59 @@ void KODayMatrix::updateView(QDate actdate) mHolidays[i] = QString::null; } } + repaint(false); + } +void KODayMatrix::updateView(QDate actdate) +{ + + //flag to indicate if the starting day of the matrix has changed by this call + //mDayChanged = false; + // if a new startdate is to be set then apply Cornelius's calculation + // of the first day to be shown + if (actdate != startdate) { + // reset index of selection according to shift of starting date from startdate to actdate + if (mSelStart != NOSELECTION) { + int tmp = actdate.daysTo(startdate); + //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; + // shift selection if new one would be visible at least partly ! + + if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { + // nested if is required for next X display pushed from a different month - correction required + // otherwise, for month forward and backward, it must be avoided + if( mSelStart > NUMDAYS || mSelStart < 0 ) + mSelStart = mSelStart + tmp; + if( mSelEnd > NUMDAYS || mSelEnd < 0 ) + mSelEnd = mSelEnd + tmp; + } + } + + startdate = actdate; + mDayChanged = true; + } + qDebug("restart Timer %d", mDayChanged ); + static int iii = 0; + if ( iii < 5 ) { + ++iii; + updateViewTimed(); + } else { + if ( !isVisible() ) { + mUpdateTimer->start( 2000 ); + } else { + if ( mDayChanged ) { + mUpdateTimer->start( 250 ); + } else { + mRepaintTimer->start( 250 ); + mUpdateTimer->start( 2000 ); + } + } + } + } const QDate& KODayMatrix::getDate(int offset) { if (offset < 0 || offset > NUMDAYS-1) { - kdDebug() << "Wrong offset (" << offset << ") in KODayMatrix::getDate(int)" << endl; + qDebug("Wrong offset2 "); return days[0]; } return days[offset]; @@ -283,7 +321,7 @@ const QDate& KODayMatrix::getDate(int offset) QString KODayMatrix::getHolidayLabel(int offset) { if (offset < 0 || offset > NUMDAYS-1) { - kdDebug() << "Wrong offset (" << offset << ") in KODayMatrix::getHolidayLabel(int)" << endl; + qDebug("Wrong offset1 "); return 0; } return mHolidays[offset]; diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index b4eb2a8..0e9640a 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h @@ -172,6 +172,8 @@ public slots: * on a day (Actually calls above method with the actual startdate). */ void updateView(); + void updateViewTimed(); + void repaintViewTimed(); /** * Calculate which square in the matrix should be @@ -219,6 +221,9 @@ protected: void resizeEvent(QResizeEvent *); private: + QTimer* mUpdateTimer; + QTimer* mRepaintTimer; + bool mDayChanged; /** returns the index of the day located at the matrix's widget (x,y) position. * |