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

KCalCore Library

  • kcalcore
recurrencerule.h
1 /*
2  This file is part of the kcalcore library.
3 
4  Copyright (c) 1998 Preston Brown <pbrown@kde.org>
5  Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
6  Copyright (c) 2002,2006,2007 David Jarvie <software@astrojar.org.uk>
7  Copyright (c) 2005, Reinhold Kainhofer <reinhold@kainhofer.com>
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Library General Public
11  License as published by the Free Software Foundation; either
12  version 2 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Library General Public License for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to
21  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  Boston, MA 02110-1301, USA.
23 */
24 #ifndef KCALCORE_RECURRENCERULE_H
25 #define KCALCORE_RECURRENCERULE_H
26 
27 #include "kcalcore_export.h"
28 #include "sortablelist.h"
29 
30 #include <KDE/KDateTime>
31 
32 namespace KCalCore {
33 
34 // These two are duplicates wrt. incidencebase.h
35 typedef SortableList<KDateTime> DateTimeList;
36 typedef SortableList<QDate> DateList;
37 /* List of times */
38 typedef SortableList<QTime> TimeList;
39 
43 class KCALCORE_EXPORT RecurrenceRule
44 {
45  public:
46  class RuleObserver
47  {
48  public:
49  virtual ~RuleObserver();
51  virtual void recurrenceChanged( RecurrenceRule * ) = 0;
52  };
53  typedef QList<RecurrenceRule*> List;
54 
56  enum PeriodType {
57  rNone = 0,
58  rSecondly,
59  rMinutely,
60  rHourly,
61  rDaily,
62  rWeekly,
63  rMonthly,
64  rYearly
65  };
66 
68  class KCALCORE_EXPORT WDayPos //krazy:exclude=dpointer
69  {
70  public:
71  explicit WDayPos( int ps = 0, short dy = 0 );
72  void setDay( short dy );
73  short day() const;
74  void setPos( int ps );
75  int pos() const;
76 
77  bool operator==( const RecurrenceRule::WDayPos &pos2 ) const;
78  bool operator!=( const RecurrenceRule::WDayPos &pos2 ) const;
79 
80  protected:
81  short mDay; // Weekday, 1=monday, 7=sunday
82  int mPos; // week of the day (-1 for last, 1 for first, 0 for all weeks)
83  // Bounded by -366 and +366, 0 means all weeks in that period
84  };
85 
86  RecurrenceRule();
87  RecurrenceRule( const RecurrenceRule &r );
88  ~RecurrenceRule();
89 
90  bool operator==( const RecurrenceRule &r ) const;
91  bool operator!=( const RecurrenceRule &r ) const { return !operator==(r); }
92  RecurrenceRule &operator=( const RecurrenceRule &r );
93 
95  void setReadOnly( bool readOnly );
96 
100  bool isReadOnly() const;
101 
106  bool recurs() const;
107  void setRecurrenceType( PeriodType period );
108  PeriodType recurrenceType() const;
109 
111  void clear();
112 
116  uint frequency() const;
117 
121  void setFrequency( int freq );
122 
128  KDateTime startDt() const;
129 
142  void setStartDt( const KDateTime &start );
143 
146  bool allDay() const;
147 
152  void setAllDay( bool allDay );
153 
159  KDateTime endDt( bool *result = 0 ) const;
160 
163  void setEndDt( const KDateTime &endDateTime );
164 
169  int duration() const;
170 
173  void setDuration( int duration );
174 
176  int durationTo( const KDateTime &dt ) const;
177 
179  int durationTo( const QDate &date ) const;
180 
195  void shiftTimes( const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec );
196 
203  bool recursOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
204 
211  bool recursAt( const KDateTime &dt ) const;
212 
220  bool dateMatchesRules( const KDateTime &dt ) const;
221 
228  TimeList recurTimesOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
229 
241  DateTimeList timesInInterval( const KDateTime &start, const KDateTime &end ) const;
242 
248  KDateTime getNextDate( const KDateTime &preDateTime ) const;
249 
256  KDateTime getPreviousDate( const KDateTime &afterDateTime ) const;
257 
258  void setBySeconds( const QList<int> &bySeconds );
259  void setByMinutes( const QList<int> &byMinutes );
260  void setByHours( const QList<int> &byHours );
261 
262  void setByDays( const QList<WDayPos> &byDays );
263  void setByMonthDays( const QList<int> &byMonthDays );
264  void setByYearDays( const QList<int> &byYearDays );
265  void setByWeekNumbers( const QList<int> &byWeekNumbers );
266  void setByMonths( const QList<int> &byMonths );
267  void setBySetPos( const QList<int> &bySetPos );
268  void setWeekStart( short weekStart );
269 
270  const QList<int> &bySeconds() const;
271  const QList<int> &byMinutes() const;
272  const QList<int> &byHours() const;
273 
274  const QList<WDayPos> &byDays() const;
275  const QList<int> &byMonthDays() const;
276  const QList<int> &byYearDays() const;
277  const QList<int> &byWeekNumbers() const;
278  const QList<int> &byMonths() const;
279  const QList<int> &bySetPos() const;
280  short weekStart() const;
281 
289  void setRRule( const QString &rrule );
290  QString rrule() const;
291 
292  void setDirty();
300  void addObserver( RuleObserver *observer );
301 
308  void removeObserver( RuleObserver *observer );
309 
313  void dump() const;
314 
315  private:
316  //@cond PRIVATE
317  class Private;
318  Private *const d;
319  //@endcond
320 };
321 
322 }
323 
324 #endif
KCalCore::RecurrenceRule::WDayPos
structure for describing the n-th weekday of the month/year.
Definition: recurrencerule.h:68
sortablelist.h
This file is part of the API for handling calendar data and defines the Sortable List class...
KCalCore::DateList
SortableList< QDate > DateList
List of dates.
Definition: incidencebase.h:74
KCalCore::SortableList
A QList which can be sorted.
Definition: sortablelist.h:86
KCalCore::RecurrenceRule::PeriodType
PeriodType
enum for describing the frequency how an event recurs, if at all.
Definition: recurrencerule.h:56
KCalCore::DateTimeList
SortableList< KDateTime > DateTimeList
List of times.
Definition: incidencebase.h:77
KCalCore::RecurrenceRule
This class represents a recurrence rule for a calendar incidence.
Definition: recurrencerule.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Nov 26 2013 09:02:04 by doxygen 1.8.5 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.11.3 API Reference

Skip menu "kdepimlibs-4.11.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • 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