• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.8.3 API Reference
  • KDE Home
  • Contact Us
 

KCalCore Library

recurrence.h
00001 /*
00002   This file is part of the kcalcore library.
00003 
00004   Copyright (c) 1998 Preston Brown <pbrown@kde.org>
00005   Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
00006   Copyright (c) 2002,2006 David Jarvie <software@astrojar.org.uk>
00007   Copyright (C) 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
00008 
00009   This library is free software; you can redistribute it and/or
00010   modify it under the terms of the GNU Library General Public
00011   License as published by the Free Software Foundation; either
00012   version 2 of the License, or (at your option) any later version.
00013 
00014   This library is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017   Library General Public License for more details.
00018 
00019   You should have received a copy of the GNU Library General Public License
00020   along with this library; see the file COPYING.LIB.  If not, write to
00021   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00022   Boston, MA 02110-1301, USA.
00023 */
00024 #ifndef KCALCORE_RECURRENCE_H
00025 #define KCALCORE_RECURRENCE_H
00026 
00027 #include "kcalcore_export.h"
00028 #include "recurrencerule.h"
00029 
00030 class QBitArray;
00031 
00032 namespace KCalCore {
00033 
00034 class RecurrenceRule;
00035 
00087 class KCALCORE_EXPORT Recurrence : public RecurrenceRule::RuleObserver
00088 {
00089   public:
00090     class RecurrenceObserver
00091     {
00092       public:
00093         virtual ~RecurrenceObserver();
00095         virtual void recurrenceUpdated( Recurrence *r ) = 0;
00096     };
00097 
00099     enum {
00100       rNone = 0,
00101       rMinutely = 0x001,
00102       rHourly = 0x0002,
00103       rDaily = 0x0003,
00104       rWeekly = 0x0004,
00105       rMonthlyPos = 0x0005,
00106       rMonthlyDay = 0x0006,
00107       rYearlyMonth = 0x0007,
00108       rYearlyDay = 0x0008,
00109       rYearlyPos = 0x0009,
00110       rOther = 0x000A,
00111       rMax=0x00FF
00112     };
00113 
00117     Recurrence();
00118 
00123     Recurrence( const Recurrence &r );
00124 
00128     ~Recurrence();
00129 
00135     bool operator==( const Recurrence &r ) const;
00136 
00142     bool operator!=( const Recurrence &r ) const  { return !operator==(r); }
00143 
00148     Recurrence &operator=( const Recurrence &r );
00149 
00152     KDateTime startDateTime() const;
00154     QDate startDate() const;
00160     void setStartDateTime( const KDateTime &start );
00161 
00168     bool allDay() const;
00172     void setAllDay( bool allDay );
00173 
00175     void setRecurReadOnly( bool readOnly );
00176 
00178     bool recurReadOnly() const;
00179 
00181     bool recurs() const;
00182 
00185     ushort recurrenceType() const;
00186 
00192     static ushort recurrenceType( const RecurrenceRule *rrule );
00193 
00200     bool recursOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
00201 
00209     bool recursAt( const KDateTime &dt ) const;
00210 
00215     void unsetRecurs();
00216 
00220     void clear();
00221 
00228     TimeList recurTimesOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
00229 
00242     DateTimeList timesInInterval( const KDateTime &start, const KDateTime &end ) const;
00243 
00250     KDateTime getNextDateTime( const KDateTime &preDateTime ) const;
00251 
00260     KDateTime getPreviousDateTime( const KDateTime &afterDateTime ) const;
00261 
00263     int frequency() const;
00264 
00266     void setFrequency( int freq );
00267 
00272     int duration() const;
00273 
00276     void setDuration( int duration );
00277 
00281     int durationTo( const KDateTime &dt ) const;
00282 
00286     int durationTo( const QDate &date ) const;
00287 
00291     KDateTime endDateTime() const;
00292 
00296     QDate endDate() const;
00297 
00301     void setEndDate( const QDate &endDate );
00302 
00305     void setEndDateTime( const KDateTime &endDateTime );
00306 
00321     void shiftTimes( const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec );
00322 
00333     void setMinutely( int freq );
00334 
00348     void setHourly( int freq );
00349 
00363     void setDaily( int freq );
00364 
00376     void setWeekly( int freq, int weekStart = 1 );
00389     void setWeekly( int freq, const QBitArray &days, int weekStart = 1 );
00390 
00394     void addWeeklyDays( const QBitArray &days );
00400     int weekStart() const;
00401 
00403     QBitArray days() const; // Emulate the old behavior
00404 
00419     void setMonthly( int freq );
00420 
00428     void addMonthlyPos( short pos, const QBitArray &days );
00429     void addMonthlyPos( short pos, ushort day );
00430 
00435     void addMonthlyDate( short day );
00436 
00438     QList<RecurrenceRule::WDayPos> monthPositions() const;
00439 
00441     // Emulate old behavior
00442     QList<int> monthDays() const;
00443 
00466     void setYearly( int freq );
00467 
00474     void addYearlyDay( int day );
00475 
00484     void addYearlyDate( int date );
00485 
00491     void addYearlyMonth( short _rNum );
00492 
00509     void addYearlyPos( short pos, const QBitArray &days );
00510 
00516     QList<int> yearDays() const;
00517 
00525     QList<int> yearDates() const;
00526 
00535     QList<int> yearMonths() const;
00536 
00546     QList<RecurrenceRule::WDayPos> yearPositions() const;
00547 
00549     static const QDate MAX_DATE;
00550 
00554     void dump() const;
00555 
00556     // RRULE
00557     RecurrenceRule::List rRules() const;
00562     void addRRule( RecurrenceRule *rrule );
00563 
00570     void removeRRule( RecurrenceRule *rrule );
00571 
00576     void deleteRRule( RecurrenceRule *rrule );
00577 
00578     // EXRULE
00579     RecurrenceRule::List exRules() const;
00580 
00585     void addExRule( RecurrenceRule *exrule );
00586 
00593     void removeExRule( RecurrenceRule *exrule );
00594 
00599     void deleteExRule( RecurrenceRule *exrule );
00600 
00601     // RDATE
00602     DateTimeList rDateTimes() const;
00603     DateList rDates() const;
00604     void setRDateTimes( const DateTimeList &rdates );
00605     void setRDates( const DateList &rdates );
00606     void addRDateTime( const KDateTime &rdate );
00607     void addRDate( const QDate &rdate );
00608 
00609     // ExDATE
00610     DateTimeList exDateTimes() const;
00611     DateList exDates() const;
00612     void setExDateTimes( const DateTimeList &exdates );
00613     void setExDates( const DateList &exdates );
00614     void addExDateTime( const KDateTime &exdate );
00615     void addExDate( const QDate &exdate );
00616 
00617     RecurrenceRule *defaultRRule( bool create = false ) const;
00618     RecurrenceRule *defaultRRuleConst() const;
00619     void updated();
00620 
00628     void addObserver( RecurrenceObserver *observer );
00635     void removeObserver( RecurrenceObserver *observer );
00636 
00637     void recurrenceChanged( RecurrenceRule * );
00638 
00639   protected:
00640     RecurrenceRule *setNewRecurrenceType( RecurrenceRule::PeriodType type, int freq );
00641 
00642   private:
00643     //@cond PRIVATE
00644     class Private;
00645     Private *const d;
00646     //@endcond
00647 };
00648 
00649 }
00650 
00651 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 7 2012 23:54:01 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCalCore Library

Skip menu "KCalCore Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepimlibs-4.8.3 API Reference

Skip menu "kdepimlibs-4.8.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal