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

List:       kde-commits
Subject:    kdepim/korganizer
From:       Till Adam <adam () kde ! org>
Date:       2005-05-01 11:38:01
Message-ID: 20050501113801.295F0669 () office ! kde ! org
[Download RAW message or body]

CVS commit by tilladam: 

Forward port of:

CVS commit by tilladam: 

Make it impossible to specify a weekly recurrence without any day set.
While the ical standard allows this, strictly speaking, it leads to an
endless loop when setting todos completed which have such a recurrence, 
since the assumption that there will be a day is pervasive.


  M +10 -1     koeditorrecurrence.cpp   1.84


--- kdepim/korganizer/koeditorrecurrence.cpp  #1.83:1.84
@@ -1339,4 +1339,5 @@ void KOEditorRecurrence::writeIncidence(
   // clear out any old settings;
   r->unsetRecurs();
+  bool invalidRecurrence = false;
 
   int duration = mRecurrenceRange->duration();
@@ -1351,7 +1352,12 @@ void KOEditorRecurrence::writeIncidence(
   } else if ( recurrenceType == RecurrenceChooser::Weekly ) {
       int freq = mWeekly->frequency();
-      QBitArray days = mWeekly->days();
+      const QBitArray &days = mWeekly->days();
+      bool valid = false; // make sure at least one day is set
+      for ( int i = 0; i<7; i++ ) valid = valid || days.testBit( i );
+      invalidRecurrence = !valid;
+      if ( !invalidRecurrence ) {
       if ( duration != 0 ) r->setWeekly( freq, days, duration );
       else r->setWeekly( freq, days, endDate );
+      }
   } else if ( recurrenceType == RecurrenceChooser::Monthly ) {
       int freq = mMonthly->frequency();
@@ -1412,4 +1418,7 @@ void KOEditorRecurrence::writeIncidence(
     } // end "Yearly"
 
+  if ( invalidRecurrence )
+    r->unsetRecurs();
+  else
     incidence->setExDates( mExceptions->dates() );
 }


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

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