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

KCalCore Library

recurrencerule.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,2007 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_RECURRENCERULE_H
00025 #define KCALCORE_RECURRENCERULE_H
00026 
00027 #include "kcalcore_export.h"
00028 #include "sortablelist.h"
00029 
00030 #include <KDE/KDateTime>
00031 
00032 namespace KCalCore {
00033 
00034 // These two are duplicates wrt. incidencebase.h
00035 typedef SortableList<KDateTime> DateTimeList;
00036 typedef SortableList<QDate> DateList;
00037 /* List of times */
00038 typedef SortableList<QTime> TimeList;
00039 
00043 class KCALCORE_EXPORT RecurrenceRule
00044 {
00045   public:
00046     class RuleObserver
00047     {
00048       public:
00049         virtual ~RuleObserver();
00051         virtual void recurrenceChanged( RecurrenceRule * ) = 0;
00052     };
00053     typedef QList<RecurrenceRule*> List;
00054 
00056     enum PeriodType {
00057       rNone = 0,
00058       rSecondly,
00059       rMinutely,
00060       rHourly,
00061       rDaily,
00062       rWeekly,
00063       rMonthly,
00064       rYearly
00065     };
00066 
00068     class KCALCORE_EXPORT WDayPos //krazy:exclude=dpointer
00069     {
00070       public:
00071         explicit WDayPos( int ps = 0, short dy = 0 );
00072         void setDay( short dy );
00073         short day() const;
00074         void setPos( int ps );
00075         int pos() const;
00076 
00077         bool operator==( const RecurrenceRule::WDayPos &pos2 ) const;
00078         bool operator!=( const RecurrenceRule::WDayPos &pos2 ) const;
00079 
00080       protected:
00081         short mDay; // Weekday, 1=monday, 7=sunday
00082         int mPos;   // week of the day (-1 for last, 1 for first, 0 for all weeks)
00083                     // Bounded by -366 and +366, 0 means all weeks in that period
00084     };
00085 
00086     RecurrenceRule();
00087     RecurrenceRule( const RecurrenceRule &r );
00088     ~RecurrenceRule();
00089 
00090     bool operator==( const RecurrenceRule &r ) const;
00091     bool operator!=( const RecurrenceRule &r ) const  { return !operator==(r); }
00092     RecurrenceRule &operator=( const RecurrenceRule &r );
00093 
00095     void setReadOnly( bool readOnly );
00096 
00100     bool isReadOnly() const;
00101 
00106     bool recurs() const;
00107     void setRecurrenceType( PeriodType period );
00108     PeriodType recurrenceType() const;
00109 
00111     void clear();
00112 
00116     uint frequency() const;
00117 
00121     void setFrequency( int freq );
00122 
00128     KDateTime startDt() const;
00129 
00141     void setStartDt( const KDateTime &start );
00142 
00145     bool allDay() const;
00146 
00151     void setAllDay( bool allDay );
00152 
00158     KDateTime endDt( bool *result = 0 ) const;
00159 
00162     void setEndDt( const KDateTime &endDateTime );
00163 
00168     int duration() const;
00169 
00172     void setDuration( int duration );
00173 
00175     int durationTo( const KDateTime &dt ) const;
00176 
00178     int durationTo( const QDate &date ) const;
00179 
00194     void shiftTimes( const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec );
00195 
00202     bool recursOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
00203 
00210     bool recursAt( const KDateTime &dt ) const;
00211 
00219     bool dateMatchesRules( const KDateTime &dt ) const;
00220 
00227     TimeList recurTimesOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
00228 
00240     DateTimeList timesInInterval( const KDateTime &start, const KDateTime &end ) const;
00241 
00247     KDateTime getNextDate( const KDateTime &preDateTime ) const;
00248 
00255     KDateTime getPreviousDate( const KDateTime &afterDateTime ) const;
00256 
00257     void setBySeconds( const QList<int> &bySeconds );
00258     void setByMinutes( const QList<int> &byMinutes );
00259     void setByHours( const QList<int> &byHours );
00260 
00261     void setByDays( const QList<WDayPos> &byDays );
00262     void setByMonthDays( const QList<int> &byMonthDays );
00263     void setByYearDays( const QList<int> &byYearDays );
00264     void setByWeekNumbers( const QList<int> &byWeekNumbers );
00265     void setByMonths( const QList<int> &byMonths );
00266     void setBySetPos( const QList<int> &bySetPos );
00267     void setWeekStart( short weekStart );
00268 
00269     const QList<int> &bySeconds() const;
00270     const QList<int> &byMinutes() const;
00271     const QList<int> &byHours() const;
00272 
00273     const QList<WDayPos> &byDays() const;
00274     const QList<int> &byMonthDays() const;
00275     const QList<int> &byYearDays() const;
00276     const QList<int> &byWeekNumbers() const;
00277     const QList<int> &byMonths() const;
00278     const QList<int> &bySetPos() const;
00279     short weekStart() const;
00280 
00288     void setRRule( const QString &rrule );
00289     QString rrule() const;
00290 
00291     void setDirty();
00299     void addObserver( RuleObserver *observer );
00300 
00307     void removeObserver( RuleObserver *observer );
00308 
00312     void dump() const;
00313 
00314   private:
00315     //@cond PRIVATE
00316     class Private;
00317     Private *const d;
00318     //@endcond
00319 };
00320 
00321 }
00322 
00323 #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