author | zautrix <zautrix> | 2005-03-19 19:11:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-19 19:11:16 (UTC) |
commit | 414b033f0c39b5122fd4899408a7045a6c29d7c9 (patch) (side-by-side diff) | |
tree | 802d40e62d1b55e9b3a2daca2ba74fc47af15137 /korganizer/kodaymatrix.cpp | |
parent | 0aa5a7dce6ac1224395f7cb3fae488ba566f0e38 (diff) | |
download | kdepimpi-414b033f0c39b5122fd4899408a7045a6c29d7c9.zip kdepimpi-414b033f0c39b5122fd4899408a7045a6c29d7c9.tar.gz kdepimpi-414b033f0c39b5122fd4899408a7045a6c29d7c9.tar.bz2 |
dnc
-rw-r--r-- | korganizer/kodaymatrix.cpp | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 989f758..a886f4a 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -87,10 +87,15 @@ void DynamicTip::maybeTip( const QPoint &pos ) const int KODayMatrix::NOSELECTION = -1000; const int KODayMatrix::NUMDAYS = 42; +KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) + : QFrame( parent, name ), mCalendar( 0 ) + +#if 0 KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : QFrame(parent, name) +#endif { - mCalendar = calendar; + mPendingUpdateBeforeRepaint = false; // initialize dynamic arrays @@ -118,6 +123,14 @@ KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const mDayChanged = false; updateView(); } +void KODayMatrix::setCalendar( Calendar *cal ) +{ + mCalendar = cal; + + setAcceptDrops( mCalendar ); + + updateEvents(); +} QColor KODayMatrix::getShadedColor(QColor color) { @@ -186,6 +199,10 @@ void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) mSelStart = startdate.daysTo(start); mSelEnd = startdate.daysTo(end); } +void KODayMatrix::clearSelection() +{ + mSelEnd = mSelStart = NOSELECTION; +} void KODayMatrix::recalculateToday() @@ -217,8 +234,12 @@ void KODayMatrix::repaintViewTimed() } void KODayMatrix::updateViewTimed() { - mUpdateTimer->stop(); + if ( !mCalendar ) { + qDebug("NOT CAL "); + return; + } + //qDebug("KODayMatrix::updateViewTimed "); for(int i = 0; i < NUMDAYS; i++) { // if events are set for the day then remember to draw it bold QPtrList<Event> eventlist = mCalendar->events(days[i]); @@ -294,6 +315,28 @@ void KODayMatrix::updateView(QDate actdate) #endif } } +void KODayMatrix::updateEvents() +{ + if ( !mCalendar ) return; + + for( int i = 0; i < NUMDAYS; i++ ) { + // if events are set for the day then remember to draw it bold + QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); + int numEvents = eventlist.count(); + Event *event; + for( event = eventlist.first(); event != 0;event=eventlist.next()) { + ushort recurType = event->doesRecur(); + + if ( ( recurType == Recurrence::rDaily && + !KOPrefs::instance()->mDailyRecur ) || + ( recurType == Recurrence::rWeekly && + !KOPrefs::instance()->mWeeklyRecur ) ) { + numEvents--; + } + } + events[ i ] = numEvents; + } +} const QDate& KODayMatrix::getDate(int offset) { @@ -428,7 +471,7 @@ void KODayMatrix::dropEvent(QDropEvent *e) #ifndef KORG_NODND // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; - if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { + if (!mCalendar || !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { e->ignore(); return; } |