[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-29 14:35:04
Message-ID: 1122647704.104867.9557.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 440003 by djarvie:

Add clear() method to clear all recurrence and exception rules & dates.
Add setWeekly(freq, weekstart) and addWeeklyDays() to allow weekly recurrences to be
    set up in the same manner as other recurrence periods.


 M  +26 -11    recurrence.cpp  
 M  +18 -1     recurrence.h  


--- branches/KDE/3.5/kdepim/libkcal/recurrence.cpp #440002:440003
@@ -413,6 +413,19 @@
   mRRules.clear();
 }
 
+void Recurrence::clear()
+{
+  if ( mRecurReadOnly ) return;
+  mRRules.clear();
+  mExRules.clear();
+  mRDates.clear();
+  mRDateTimes.clear();
+  mExDates.clear();
+  mExDateTimes.clear();
+  mCachedType = rMax;
+  updated();
+}
+
 void Recurrence::setStartDateTime( const QDateTime &start )
 {
   if ( mRecurReadOnly ) return;
@@ -558,23 +571,25 @@
     updated();
 }
 
-void Recurrence::setWeekly( int freq, const QBitArray &days, int _rWeekStart )
+void Recurrence::setWeekly( int freq, int weekStart )
 {
   RecurrenceRule *rrule = setNewRecurrenceType( RecurrenceRule::rWeekly, freq );
   if ( !rrule ) return;
-
-  QValueList<RecurrenceRule::WDayPos> bydays;
-  for ( int i = 0; i < 7; ++i ) {
-    if ( days.testBit(i) ) {
-      RecurrenceRule::WDayPos p( 0, i + 1 );
-      bydays.append( p );
-    }
-  }
-  rrule->setByDays( bydays );
-  rrule->setWeekStart( _rWeekStart );
+  rrule->setWeekStart( weekStart );
   updated();
 }
 
+void Recurrence::setWeekly( int freq, const QBitArray &days, int weekStart )
+{
+  setWeekly( freq, weekStart );
+  addMonthlyPos( 0, days );
+}
+
+void Recurrence::addWeeklyDays( const QBitArray &days )
+{
+  addMonthlyPos( 0, days );
+}
+
 void Recurrence::setMonthly( int freq )
 {
   if ( setNewRecurrenceType( RecurrenceRule::rMonthly, freq ) )
--- branches/KDE/3.5/kdepim/libkcal/recurrence.h #440002:440003
@@ -153,6 +153,8 @@
     /** Removes all recurrence rules. Recurrence dates and exceptions are
         not removed. */
     void unsetRecurs();
+    /** Removes all recurrence and exception rules and dates. */
+    void clear();
 
     /** Returns a list of the times on the specified date at which the
      * recurrence will occur.
@@ -261,11 +263,26 @@
         date/times, exception date/times and exception rules) are not
         modified.
      * @param freq the frequency to recur, e.g. every other week etc.
+     * @param weekStart the first day of the week (Monday=1 .. Sunday=7, default is Monday).
+     */
+    void setWeekly( int freq, int weekStart = 1 );
+    /** Sets an event to recur weekly. By default infinite recurrence is used.
+        To set an end date use the method setEndDate and to set the number
+        of occurrences use setDuration.
+
+        This method clears all recurrence rules and adds one rule with a
+        weekly recurrence. All other recurrence components (recurrence
+        date/times, exception date/times and exception rules) are not
+        modified.
+     * @param freq the frequency to recur, e.g. every other week etc.
      * @param days a 7 bit array indicating which days on which to recur (bit 0 = Monday).
      * @param weekStart the first day of the week (Monday=1 .. Sunday=7, default is Monday).
      */
     void setWeekly( int freq, const QBitArray &days, int weekStart = 1 );
-
+    /** Adds days to the weekly day recurrence list.
+     * @param days a 7 bit array indicating which days on which to recur (bit 0 = Monday).
+     */
+    void addWeeklyDays( const QBitArray &days );
     /** Returns the first day of the week.  Uses only the
      * first RRULE if present (i.e. a second RRULE as well as all EXRULES are
      * ignored!
[prev in list] [next in list] [prev in thread] [next in thread] 

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