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

List:       kde-commits
Subject:    branches/KDE/3.5/kdepim/libkcal
From:       David Jarvie <software () astrojar ! org ! uk>
Date:       2005-07-27 18:05:22
Message-ID: 1122487522.605723.31456.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 439315 by djarvie:

Add a variant on recurrenceType() to allow RecurrenceRule types to be
    obtained in the same way as the default RRULE.
Actually cache the recurrence type (it was never saved before).
Prevent duplicate searches of EXDATES.


 M  +16 -7     recurrence.cpp  
 M  +3 -0      recurrence.h  


--- branches/KDE/3.5/kdepim/libkcal/recurrence.cpp #439314:439315
@@ -173,9 +173,14 @@
 
 ushort Recurrence::recurrenceType() const
 {
-  if ( mCachedType != rMax ) return mCachedType;
+  if ( mCachedType == rMax ) {
+    mCachedType = recurrenceType( defaultRRuleConst() );
+  }
+  return mCachedType;
+}
 
-  RecurrenceRule *rrule = defaultRRuleConst();
+ushort Recurrence::recurrenceType( const RecurrenceRule *rrule )
+{
   if ( !rrule ) return rNone;
   RecurrenceRule::PeriodType type = rrule->recurrenceType();
 
@@ -209,7 +214,7 @@
       return rOther;
   }
 
-  switch ( rrule->recurrenceType() ) {
+  switch ( type ) {
     case RecurrenceRule::rNone:     return rNone;
     case RecurrenceRule::rMinutely: return rMinutely;
     case RecurrenceRule::rHourly:   return rHourly;
@@ -289,8 +294,10 @@
       break;
     }
   }
-  for ( RecurrenceRule::List::ConstIterator rr = mExRules.begin(); rr != mExRules.end(); ++rr ) {
-    exon = exon || (*rr)->recursOn( qd );
+  if ( !doesFloat() ) {     // we have already checked floating times above
+    for ( RecurrenceRule::List::ConstIterator rr = mExRules.begin(); rr != mExRules.end(); ++rr ) {
+      exon = exon || (*rr)->recursOn( qd );
+    }
   }
 
   if ( !exon ) {
@@ -717,8 +724,10 @@
       foundDate = true;
     } else if (foundDate) break;
   }
-  for ( RecurrenceRule::List::ConstIterator rr = mExRules.begin(); rr != mExRules.end(); ++rr ) {
-    extimes += (*rr)->recurTimesOn( date );
+  if ( !doesFloat() ) {     // we have already checked floating times above
+    for ( RecurrenceRule::List::ConstIterator rr = mExRules.begin(); rr != mExRules.end(); ++rr ) {
+      extimes += (*rr)->recurTimesOn( date );
+    }
   }
   qHeapSort( extimes );
 
--- branches/KDE/3.5/kdepim/libkcal/recurrence.h #439314:439315
@@ -141,6 +141,9 @@
     /** Returns the event's recurrence status.  See the enumeration at the top
      * of this file for possible values. */
     ushort recurrenceType() const;
+    /** Returns the recurrence status for a recurrence rule.
+     * See the enumeration at the top of this file for possible values. */
+    static ushort recurrenceType( const RecurrenceRule *rrule );
     /** Returns true if the date specified is one on which the event will
      * recur. */
     bool recursOn( const QDate &qd ) const;
[prev in list] [next in list] [prev in thread] [next in thread] 

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