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

List:       kde-pim
Subject:    [Kde-pim] [PATCH] libkcal 3.5 branch
From:       David Jarvie <lists () astrojar ! org ! uk>
Date:       2006-05-28 22:53:18
Message-ID: 200605282353.19106.lists () astrojar ! org ! uk
[Download RAW message or body]

I've noticed that for a recurring event, the CalendarLocal::alarmsTo() method 
returns alarms starting in the year 1900, regardless of the start date of the 
event. This is due to a bug in the appendRecurringAlarms() method. I attach a 
patch to fix this - the patch applies equally to 3.5 branch and to trunk. OK 
to commit?

-- 
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/linux/kalarm.html

["cl.diff" (text/x-diff)]

Index: calendarlocal.cpp
===================================================================
--- calendarlocal.cpp	(revision 546062)
+++ calendarlocal.cpp	(working copy)
@@ -309,8 +309,14 @@
           offset = alarm->endOffset().asSeconds() + endOffset;
         }
 
-        // Adjust the 'from' date/time and find the next recurrence at or \
                after it
-        qdt = incidence->recurrence()->getNextDateTime( \
from.addSecs(-offset - 1) ); +        // Find the incidence's earliest \
alarm +        QDateTime fromStart = incidence->dtStart().addSecs( offset \
); +        if ( fromStart > to )
+          continue;
+        if ( from > fromStart )
+          fromStart = from;   // don't look earlier than the earliest \
alarm +        // Adjust the 'fromStart' date/time and find the next \
recurrence at or after it +        qdt = \
incidence->recurrence()->getNextDateTime( fromStart.addSecs(-offset - 1) ); \
                if ( !qdt.isValid()
         ||   (qdt = qdt.addSecs( offset )) > to )    // remove the \
adjustment to get the alarm time  {
@@ -320,13 +326,13 @@
           // The alarm has repetitions, so check whether repetitions of \
previous  // recurrences fall within the time period.
           bool found = false;
-          qdt = from.addSecs( -offset );
+          qdt = fromStart.addSecs( -offset );
           while ( (qdt = incidence->recurrence()->getPreviousDateTime( qdt \
                )).isValid() ) {
-            int toFrom = qdt.secsTo( from ) - offset;
+            int toFrom = qdt.secsTo( fromStart ) - offset;
             if ( toFrom > alarm->duration() )
               break;     // this recurrence's last repetition is too \
                early, so give up
-            // The last repetition of this recurrence is at or after \
                'from' time.
-            // Check if a repetition occurs between 'from' and 'to'.
+            // The last repetition of this recurrence is at or after \
'fromStart' time. +            // Check if a repetition occurs between \
'fromStart' and 'to'.  int snooze = alarm->snoozeTime() * 60;   // in \
seconds  if ( period >= snooze
             ||   toFrom % snooze == 0



_______________________________________________
kde-pim mailing list
kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/

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

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