[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#526135: [korganizer] Patch



Hello,

the patch attached to this e-mail works for me. The previous solution with 
setting the initial value of mFrequency led to some hidden events. With this 
patch the division by zero does not occur anymore and all events are visible.

Maybe I should add that I am using a calendar stored on an IMAP server 
(Kolab).

I hope it is all right that I reassigned this bug to kdepimlibs5, because the 
source file is part of kdepimlibs.

Kind regards,
Benjamin
Index: recurrencerule.cpp
===================================================================
--- recurrencerule.cpp	(revision 967218)
+++ recurrencerule.cpp	(working copy)
@@ -1853,7 +1853,7 @@
   case rSecondly:
     periods = static_cast<int>( start.secsTo_long( toDate ) / modifier );
     periods = qMax( 0L, periods );
-    if ( periods > 0 ) {
+    if ( periods > 0 && mFrequency != 0 ) {
       periods += ( mFrequency - 1 - ( ( periods - 1 ) % mFrequency ) );
     }
     nextValid = start.addSecs( modifier * periods );
@@ -1866,7 +1866,7 @@
   case rDaily:
     periods = start.daysTo( toDate ) / modifier;
     periods = qMax( 0L, periods );
-    if ( periods > 0 ) {
+    if ( periods > 0 && mFrequency != 0 ) {
       periods += ( mFrequency - 1 - ( ( periods - 1 ) % mFrequency ) );
     }
     nextValid = start.addDays( modifier * periods );
@@ -1876,7 +1876,7 @@
     periods = 12 * ( toDate.date().year() - start.date().year() ) +
               ( toDate.date().month() - start.date().month() );
     periods = qMax( 0L, periods );
-    if ( periods > 0 ) {
+    if ( periods > 0 && mFrequency != 0 ) {
       periods += ( mFrequency - 1 - ( ( periods - 1 ) % mFrequency ) );
     }
     // set the day to the first day of the month, so we don't have problems
@@ -1888,7 +1888,7 @@
   case rYearly:
     periods = ( toDate.date().year() - start.date().year() );
     periods = qMax( 0L, periods );
-    if ( periods > 0 ) {
+    if ( periods > 0 && mFrequency != 0 ) {
       periods += ( mFrequency - 1 - ( ( periods - 1 ) % mFrequency ) );
     }
     nextValid.setDate( start.date().addYears( periods ) );

Reply to: