[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 42899] incorrect event recurrance when even spans multiple days
From:       Reinhold Kainhofer <reinhold () kainhofer ! com>
Date:       2005-07-30 13:47:53
Message-ID: 20050730134753.10867.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=42899         




------- Additional Comments From reinhold kainhofer com  2005-07-30 15:47 -------
SVN commit 440434 by kainhofe:

Use the new methods in the Incidence class to obtain the list of start times for all \
occurrences that overlap with the given day. This makes printing multi-day recurring \
events possible. They are not yet correctly shown in the Agenda, though.

CCBUG: 42899


 M  +16 -27    calprinthelper.cpp  


--- branches/KDE/3.5/kdepim/korganizer/printing/calprinthelper.cpp #440433:440434
 @ -64,8 +64,8  @
 class PrintCellItem : public KOrg::CellItem
 {
   public:
-    PrintCellItem( Event *event, const QDate &day )
-      : mEvent( event ), mDay( day )
+    PrintCellItem( Event *event, const QDateTime &start, const QDateTime &end )
+      : mEvent( event ), mStart( start), mEnd( end )
     {
     }
 
 @ -73,25 +73,15  @
 
     QString label() const { return mEvent->summary(); }
 
+    QDateTime start() const { return mStart; }
+    QDateTime end() const { return mEnd; }
+
+    /** Calculate the start and end date/time of the recurrence that
+        happens on the given day */
     bool overlaps( KOrg::CellItem *o ) const
     {
       PrintCellItem *other = static_cast<PrintCellItem *>( o );
 
-      QDateTime start = event()->dtStart();
-      QDateTime end = event()->dtEnd();
-// FIXME: This breaks with recurring multi-day events!
-      if ( event()->doesRecur() ) {
-        start.setDate( mDay );
-        end.setDate( mDay );
-      }
-      QDateTime otherStart = other->event()->dtStart();
-      QDateTime otherEnd = other->event()->dtEnd();
-// FIXME: This breaks with recurring multi-day events!
-      if ( other->event()->doesRecur() ) {
-        otherStart.setDate( mDay );
-        otherEnd.setDate( mDay );
-      }
-
 #if 0
       kdDebug(5850) << "PrintCellItem::overlaps() " << event()->summary()
                     << " <-> " << other->event()->summary() << endl;
 @ -101,12 +91,12  @
       kdDebug(5850) << "  otherEnd  : " << otherEnd.toString() << endl;
 #endif
 
-      return !( otherStart >= end || otherEnd <= start );
+      return !( other->start() >= end() || other->end() <= start() );
     }
 
   private:
     Event *mEvent;
-    QDate mDay;
+    QDateTime mStart, mEnd;
 };
 
 CalPrintHelper::CalPrintHelper( KPrinter *pr, Calendar *cal, KConfig *cfg,
 @ -480,7 +470,11  @
 
   Event::List::ConstIterator itEvents;
   for( itEvents = events.begin(); itEvents != events.end(); ++itEvents ) {
-    cells.append( new PrintCellItem( *itEvents, qd ) );
+    QValueList<QDateTime> times = (*itEvents)->startDateTimesForDate( qd );
+    for ( QValueList<QDateTime>::ConstIterator it = times.begin();
+          it != times.end(); ++it ) {
+      cells.append( new PrintCellItem( *itEvents, (*it), \
(*itEvents)->endDateForStart( *it ) ) ); +    }
   }
 
   QPtrListIterator<KOrg::CellItem> it1( cells );
 @ -525,13 +519,8  @
   if ( mUseColors ) setCategoryColors( p, event );
 
   // start/end of print area for event
-  QDateTime startTime = event->dtStart();
-  QDateTime endTime = event->dtEnd();
-// FIXME: This breaks with recurring multi-day events!
-  if ( event->doesRecur() ) {
-    startTime.setDate( qd );
-    endTime.setDate( qd );
-  }
+  QDateTime startTime = item->start();
+  QDateTime endTime = item->end();
   if ( ( startTime < endPrintDate && endTime > startPrintDate ) ||
        ( endTime > startPrintDate && startTime < endPrintDate ) ) {
     if ( startTime < startPrintDate ) startTime = startPrintDate;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic