• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.8.3 API Reference
  • KDE Home
  • 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_DEPRECATED 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 
00154     Recurrence &operator=( const Recurrence &r );
00155 
00158     KDateTime startDateTime() const;
00160     QDate startDate() const;
00166     void setStartDateTime( const KDateTime &start );
00167 
00174     bool allDay() const;
00178     void setAllDay( bool allDay );
00179 
00181     void setRecurReadOnly( bool readOnly );
00182 
00184     bool recurReadOnly() const;
00185 
00187     bool recurs() const;
00188 
00191     ushort recurrenceType() const;
00192 
00198     static ushort recurrenceType( const RecurrenceRule *rrule );
00199 
00206     bool recursOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
00207 
00215     bool recursAt( const KDateTime &dt ) const;
00216 
00221     void unsetRecurs();
00222 
00226     void clear();
00227 
00234     TimeList recurTimesOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
00235 
00248     DateTimeList timesInInterval( const KDateTime &start, const KDateTime &end ) const;
00249 
00256     KDateTime getNextDateTime( const KDateTime &preDateTime ) const;
00257 
00266     KDateTime getPreviousDateTime( const KDateTime &afterDateTime ) const;
00267 
00269     int frequency() const;
00270 
00272     void setFrequency( int freq );
00273 
00278     int duration() const;
00279 
00282     void setDuration( int duration );
00283 
00287     int durationTo( const KDateTime &dt ) const;
00288 
00292     int durationTo( const QDate &date ) const;
00293 
00297     KDateTime endDateTime() const;
00298 
00302     QDate endDate() const;
00303 
00307     void setEndDate( const QDate &endDate );
00308 
00311     void setEndDateTime( const KDateTime &endDateTime );
00312 
00327     void shiftTimes( const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec );
00328 
00339     void setMinutely( int freq );
00340 
00354     void setHourly( int freq );
00355 
00369     void setDaily( int freq );
00370 
00382     void setWeekly( int freq, int weekStart = 1 );
00395     void setWeekly( int freq, const QBitArray &days, int weekStart = 1 );
00396 
00400     void addWeeklyDays( const QBitArray &days );
00406     int weekStart() const;
00407 
00409     QBitArray days() const; // Emulate the old behavior
00410 
00425     void setMonthly( int freq );
00426 
00434     void addMonthlyPos( short pos, const QBitArray &days );
00435     void addMonthlyPos( short pos, ushort day );
00436 
00441     void addMonthlyDate( short day );
00442 
00444     QList<RecurrenceRule::WDayPos> monthPositions() const;
00445 
00447     // Emulate old behavior
00448     QList<int> monthDays() const;
00449 
00472     void setYearly( int freq );
00473 
00480     void addYearlyDay( int day );
00481 
00490     void addYearlyDate( int date );
00491 
00497     void addYearlyMonth( short _rNum );
00498 
00515     void addYearlyPos( short pos, const QBitArray &days );
00516 
00522     QList<int> yearDays() const;
00523 
00531     QList<int> yearDates() const;
00532 
00541     QList<int> yearMonths() const;
00542 
00552     QList<RecurrenceRule::WDayPos> yearPositions() const;
00553 
00555     static const QDate MAX_DATE;
00556 
00560     void dump() const;
00561 
00562     // RRULE
00563     RecurrenceRule::List rRules() const;
00568     void addRRule( RecurrenceRule *rrule );
00569 
00576     void removeRRule( RecurrenceRule *rrule );
00577 
00582     void deleteRRule( RecurrenceRule *rrule );
00583 
00584     // EXRULE
00585     RecurrenceRule::List exRules() const;
00586 
00591     void addExRule( RecurrenceRule *exrule );
00592 
00599     void removeExRule( RecurrenceRule *exrule );
00600 
00605     void deleteExRule( RecurrenceRule *exrule );
00606 
00607     // RDATE
00608     DateTimeList rDateTimes() const;
00609     DateList rDates() const;
00610     void setRDateTimes( const DateTimeList &rdates );
00611     void setRDates( const DateList &rdates );
00612     void addRDateTime( const KDateTime &rdate );
00613     void addRDate( const QDate &rdate );
00614 
00615     // ExDATE
00616     DateTimeList exDateTimes() const;
00617     DateList exDates() const;
00618     void setExDateTimes( const DateTimeList &exdates );
00619     void setExDates( const DateList &exdates );
00620     void addExDateTime( const KDateTime &exdate );
00621     void addExDate( const QDate &exdate );
00622 
00623     RecurrenceRule *defaultRRule( bool create = false ) const;
00624     RecurrenceRule *defaultRRuleConst() const;
00625     void updated();
00626 
00634     void addObserver( RecurrenceObserver *observer );
00641     void removeObserver( RecurrenceObserver *observer );
00642 
00643     void recurrenceChanged( RecurrenceRule * );
00644 
00645   protected:
00646     RecurrenceRule *setNewRecurrenceType( RecurrenceRule::PeriodType type, int freq );
00647 
00648   private:
00649     //@cond PRIVATE
00650     class Private;
00651     Private *const d;
00652     //@endcond
00653 };
00654 
00655 }
00656 
00657 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue May 8 2012 00:03:21 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCal Library

Skip menu "KCal Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • 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