• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

KCal Library

recurrence.h

00001 /*
00002   This file is part of the kcal 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 KCAL_RECURRENCE_H
00025 #define KCAL_RECURRENCE_H
00026 
00027 #include "kcal_export.h"
00028 #include "recurrencerule.h"
00029 
00030 #include <kdatetime.h>
00031 
00032 #include <QtCore/QString>
00033 #include <QtCore/QBitArray>
00034 #include <QtCore/QList>
00035 
00036 namespace KCal {
00037 
00038 class RecurrenceRule;
00039 
00091 class KCAL_EXPORT Recurrence : public RecurrenceRule::RuleObserver
00092 {
00093   public:
00094     class RecurrenceObserver
00095     {
00096       public:
00097         virtual ~RecurrenceObserver() {}
00099         virtual void recurrenceUpdated( Recurrence *r ) = 0;
00100     };
00101 
00103     enum {
00104       rNone = 0,
00105       rMinutely = 0x001,
00106       rHourly = 0x0002,
00107       rDaily = 0x0003,
00108       rWeekly = 0x0004,
00109       rMonthlyPos = 0x0005,
00110       rMonthlyDay = 0x0006,
00111       rYearlyMonth = 0x0007,
00112       rYearlyDay = 0x0008,
00113       rYearlyPos = 0x0009,
00114       rOther = 0x000A,
00115       rMax=0x00FF
00116     };
00117 
00121     Recurrence();
00127     Recurrence( const Recurrence &r );
00131     virtual ~Recurrence();
00132 
00139     bool operator==( const Recurrence &r ) const;
00146     bool operator!=( const Recurrence &r ) const  { return !operator==(r); }
00147 
00150     KDateTime startDateTime() const;
00152     QDate startDate() const;
00158     void setStartDateTime( const KDateTime &start );
00159 
00166     bool allDay() const;
00170     void setAllDay( bool allDay );
00171 
00173     void setRecurReadOnly( bool readOnly );
00174 
00176     bool recurReadOnly() const;
00177 
00179     bool recurs() const;
00180 
00183     ushort recurrenceType() const;
00184 
00190     static ushort recurrenceType( const RecurrenceRule *rrule );
00191 
00198     bool recursOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
00199 
00207     bool recursAt( const KDateTime &dt ) const;
00208 
00213     void unsetRecurs();
00214 
00218     void clear();
00219 
00226     TimeList recurTimesOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
00227 
00240     DateTimeList timesInInterval( const KDateTime &start, const KDateTime &end ) const;
00241 
00248     KDateTime getNextDateTime( const KDateTime &preDateTime ) const;
00249 
00258     KDateTime getPreviousDateTime( const KDateTime &afterDateTime ) const;
00259 
00261     int frequency() const;
00262 
00264     void setFrequency( int freq );
00265 
00270     int duration() const;
00271 
00274     void setDuration( int duration );
00275 
00279     int durationTo( const KDateTime &dt ) const;
00280 
00284     int durationTo( const QDate &date ) const;
00285 
00289     KDateTime endDateTime() const;
00290 
00294     QDate endDate() const;
00295 
00299     void setEndDate( const QDate &endDate );
00300 
00303     void setEndDateTime( const KDateTime &endDateTime );
00304 
00319     void shiftTimes( const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec );
00320 
00331     void setMinutely( int freq );
00332 
00346     void setHourly( int freq );
00347 
00361     void setDaily( int freq );
00362 
00374     void setWeekly( int freq, int weekStart = 1 );
00387     void setWeekly( int freq, const QBitArray &days, int weekStart = 1 );
00388 
00392     void addWeeklyDays( const QBitArray &days );
00398     int weekStart() const;
00399 
00401     QBitArray days() const; // Emulate the old behavior
00402 
00417     void setMonthly( int freq );
00418 
00426     void addMonthlyPos( short pos, const QBitArray &days );
00427     void addMonthlyPos( short pos, ushort day );
00428 
00433     void addMonthlyDate( short day );
00434 
00436     QList<RecurrenceRule::WDayPos> monthPositions() const;
00437 
00439     // Emulate old behavior
00440     QList<int> monthDays() const;
00441 
00464     void setYearly( int freq );
00465 
00472     void addYearlyDay( int day );
00473 
00482     void addYearlyDate( int date );
00483 
00489     void addYearlyMonth( short _rNum );
00490 
00507     void addYearlyPos( short pos, const QBitArray &days );
00508 
00514     QList<int> yearDays() const;
00515 
00523     QList<int> yearDates() const;
00524 
00533     QList<int> yearMonths() const;
00534 
00544     QList<RecurrenceRule::WDayPos> yearPositions() const;
00545 
00547     static const QDate MAX_DATE;
00548 
00552     void dump() const;
00553 
00554     // RRULE
00555     RecurrenceRule::List rRules() const;
00560     void addRRule( RecurrenceRule *rrule );
00561 
00568     void removeRRule( RecurrenceRule *rrule );
00569 
00574     void deleteRRule( RecurrenceRule *rrule );
00575 
00576     // EXRULE
00577     RecurrenceRule::List exRules() const;
00578 
00583     void addExRule( RecurrenceRule *exrule );
00584 
00591     void removeExRule( RecurrenceRule *exrule );
00592 
00597     void deleteExRule( RecurrenceRule *exrule );
00598 
00599     // RDATE
00600     DateTimeList rDateTimes() const;
00601     DateList rDates() const;
00602     void setRDateTimes( const DateTimeList &rdates );
00603     void setRDates( const DateList &rdates );
00604     void addRDateTime( const KDateTime &rdate );
00605     void addRDate( const QDate &rdate );
00606 
00607     // ExDATE
00608     DateTimeList exDateTimes() const;
00609     DateList exDates() const;
00610     void setExDateTimes( const DateTimeList &exdates );
00611     void setExDates( const DateList &exdates );
00612     void addExDateTime( const KDateTime &exdate );
00613     void addExDate( const QDate &exdate );
00614 
00615     RecurrenceRule *defaultRRule( bool create = false ) const;
00616     RecurrenceRule *defaultRRuleConst() const;
00617     void updated();
00618 
00626     void addObserver( RecurrenceObserver *observer );
00633     void removeObserver( RecurrenceObserver *observer );
00634 
00635     void recurrenceChanged( RecurrenceRule * );
00636 
00637   protected:
00638     RecurrenceRule *setNewRecurrenceType( RecurrenceRule::PeriodType type, int freq );
00639 
00640   private:
00641     //@cond PRIVATE
00642     class Private;
00643     Private *const d;
00644     //@endcond
00645 };
00646 
00647 }
00648 
00649 #endif

KCal Library

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal