From cc29364f06178f8f6b457384f2ec37a042bd9d43 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 1 Sep 2010 00:37:02 +0000 Subject: * Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch * Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- korganizer/kodaymatrix.cpp | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) (limited to 'korganizer/kodaymatrix.cpp') diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index ff82ada9c..065e44e7c 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -228,11 +228,15 @@ void KODayMatrix::recalculateToday() updateView( mStartDate ); } +void KODayMatrix::setUpdateNeeded() +{ + mPendingChanges = true; +} + void KODayMatrix::updateView( const TQDate &actdate ) { kdDebug(5850) << "KODayMatrix::updateView() " << actdate << ", day start="< tmp) { mSelEnd = mSelInit; - if (tmp != mSelStart) { + if ( tmp != mSelStart ) { mSelStart = tmp; repaint(); } @@ -414,7 +421,7 @@ void KODayMatrix::mouseMoveEvent( TQMouseEvent *e ) mSelStart = mSelInit; //repaint only if selection has changed - if (tmp != mSelEnd) { + if ( tmp != mSelEnd ) { mSelEnd = tmp; repaint(); } @@ -669,8 +676,7 @@ void KODayMatrix::paintEvent( TQPaintEvent * ) } // draw selected days with special color - // DO NOT specially highlight holidays in selection ! - if (i >= mSelStart && i <= mSelEnd) { + if ( i >= mSelStart && i <= mSelEnd && !holiday ) { p.setPen( TQColor( "white" ) ); } @@ -678,7 +684,7 @@ void KODayMatrix::paintEvent( TQPaintEvent * ) Qt::AlignHCenter | Qt::AlignVCenter, mDayLabels[i]); // reset color to actual color - if (holiday) { + if ( holiday ) { p.setPen(actcol); } // reset bold font to plain font @@ -689,7 +695,7 @@ void KODayMatrix::paintEvent( TQPaintEvent * ) } } p.end(); - bitBlt( this, 0, 0, &pm ); + bitBlt( this, 0, 0, &pm ); } // ---------------------------------------------------------------------------- @@ -702,3 +708,22 @@ void KODayMatrix::resizeEvent( TQResizeEvent * ) mDaySize.setHeight( sz.height() * 7 / NUMDAYS ); mDaySize.setWidth( sz.width() / 7 ); } + +/* static */ +QPair KODayMatrix::matrixLimits( const TQDate &month ) +{ + const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); + TQDate d = month; + calSys->setYMD( d, calSys->year( month ), calSys->month( month ), 1 ); + + const int dayOfWeek = calSys->dayOfWeek( d ); + const int weekstart = KGlobal::locale()->weekStartDay(); + + d = d.addDays( weekstart - dayOfWeek ); + + if ( dayOfWeek == weekstart ) { + d = d.addDays( -7 ); // Start on the second line + } + + return qMakePair( d, d.addDays( NUMDAYS-1 ) ); +} -- cgit v1.2.1