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

KCalCore Library

  • sources
  • kde-4.12
  • kdepimlibs
  • 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  friend KCALCORE_EXPORT QDataStream& operator<<(QDataStream &out, const KCalCore::RecurrenceRule::WDayPos &);
86  friend KCALCORE_EXPORT QDataStream& operator>>(QDataStream &in, KCalCore::RecurrenceRule::WDayPos &);
87  };
88 
89  RecurrenceRule();
90  RecurrenceRule(const RecurrenceRule &r);
91  ~RecurrenceRule();
92 
93  bool operator==(const RecurrenceRule &r) const;
94  bool operator!=(const RecurrenceRule &r) const {
95  return !operator==(r);
96  }
97  RecurrenceRule &operator=(const RecurrenceRule &r);
98 
100  void setReadOnly(bool readOnly);
101 
105  bool isReadOnly() const;
106 
111  bool recurs() const;
112  void setRecurrenceType(PeriodType period);
113  PeriodType recurrenceType() const;
114 
116  void clear();
117 
121  uint frequency() const;
122 
126  void setFrequency(int freq);
127 
133  KDateTime startDt() const;
134 
147  void setStartDt(const KDateTime &start);
148 
151  bool allDay() const;
152 
157  void setAllDay(bool allDay);
158 
164  KDateTime endDt(bool *result = 0) const;
165 
168  void setEndDt(const KDateTime &endDateTime);
169 
174  int duration() const;
175 
178  void setDuration(int duration);
179 
181  int durationTo(const KDateTime &dt) const;
182 
184  int durationTo(const QDate &date) const;
185 
200  void shiftTimes(const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec);
201 
208  bool recursOn(const QDate &date, const KDateTime::Spec &timeSpec) const;
209 
216  bool recursAt(const KDateTime &dt) const;
217 
225  bool dateMatchesRules(const KDateTime &dt) const;
226 
233  TimeList recurTimesOn(const QDate &date, const KDateTime::Spec &timeSpec) const;
234 
246  DateTimeList timesInInterval(const KDateTime &start, const KDateTime &end) const;
247 
253  KDateTime getNextDate(const KDateTime &preDateTime) const;
254 
261  KDateTime getPreviousDate(const KDateTime &afterDateTime) const;
262 
263  void setBySeconds(const QList<int> &bySeconds);
264  void setByMinutes(const QList<int> &byMinutes);
265  void setByHours(const QList<int> &byHours);
266 
267  void setByDays(const QList<WDayPos> &byDays);
268  void setByMonthDays(const QList<int> &byMonthDays);
269  void setByYearDays(const QList<int> &byYearDays);
270  void setByWeekNumbers(const QList<int> &byWeekNumbers);
271  void setByMonths(const QList<int> &byMonths);
272  void setBySetPos(const QList<int> &bySetPos);
273  void setWeekStart(short weekStart);
274 
275  const QList<int> &bySeconds() const;
276  const QList<int> &byMinutes() const;
277  const QList<int> &byHours() const;
278 
279  const QList<WDayPos> &byDays() const;
280  const QList<int> &byMonthDays() const;
281  const QList<int> &byYearDays() const;
282  const QList<int> &byWeekNumbers() const;
283  const QList<int> &byMonths() const;
284  const QList<int> &bySetPos() const;
285  short weekStart() const;
286 
294  void setRRule(const QString &rrule);
295  QString rrule() const;
296 
297  void setDirty();
305  void addObserver(RuleObserver *observer);
306 
313  void removeObserver(RuleObserver *observer);
314 
318  void dump() const;
319 
320 private:
321  //@cond PRIVATE
322  class Private;
323  Private *const d;
324  //@endcond
325 
326  friend KCALCORE_EXPORT QDataStream& operator<<(QDataStream &out, const KCalCore::RecurrenceRule *);
327  friend KCALCORE_EXPORT QDataStream& operator>>(QDataStream &in, const KCalCore::RecurrenceRule *);
328 };
329 
334 KCALCORE_EXPORT QDataStream& operator<<(QDataStream &out, const KCalCore::RecurrenceRule *);
335 KCALCORE_EXPORT QDataStream& operator>>(QDataStream &in, const KCalCore::RecurrenceRule *);
336 
341 KCALCORE_EXPORT QDataStream& operator<<(QDataStream &out, const KCalCore::RecurrenceRule::WDayPos &);
342 KCALCORE_EXPORT QDataStream& operator>>(QDataStream &in, KCalCore::RecurrenceRule::WDayPos &);
343 
344 }
345 
346 #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:76
KCalCore::SortableList
A QList which can be sorted.
Definition: sortablelist.h:86
KCalCore::operator>>
KCALCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalCore::Alarm::Ptr &)
Alarm deserializer.
Definition: alarm.cpp:863
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:79
KCalCore::operator<<
KCALCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalCore::Alarm::Ptr &)
Alarm serializer.
Definition: alarm.cpp:853
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-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:59:57 by doxygen 1.8.7 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 API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



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