• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.11.5 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 {
92  return !operator==(r);
93  }
94  RecurrenceRule &operator=(const RecurrenceRule &r);
95 
97  void setReadOnly(bool readOnly);
98 
102  bool isReadOnly() const;
103 
108  bool recurs() const;
109  void setRecurrenceType(PeriodType period);
110  PeriodType recurrenceType() const;
111 
113  void clear();
114 
118  uint frequency() const;
119 
123  void setFrequency(int freq);
124 
130  KDateTime startDt() const;
131 
144  void setStartDt(const KDateTime &start);
145 
148  bool allDay() const;
149 
154  void setAllDay(bool allDay);
155 
161  KDateTime endDt(bool *result = 0) const;
162 
165  void setEndDt(const KDateTime &endDateTime);
166 
171  int duration() const;
172 
175  void setDuration(int duration);
176 
178  int durationTo(const KDateTime &dt) const;
179 
181  int durationTo(const QDate &date) const;
182 
197  void shiftTimes(const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec);
198 
205  bool recursOn(const QDate &date, const KDateTime::Spec &timeSpec) const;
206 
213  bool recursAt(const KDateTime &dt) const;
214 
222  bool dateMatchesRules(const KDateTime &dt) const;
223 
230  TimeList recurTimesOn(const QDate &date, const KDateTime::Spec &timeSpec) const;
231 
243  DateTimeList timesInInterval(const KDateTime &start, const KDateTime &end) const;
244 
250  KDateTime getNextDate(const KDateTime &preDateTime) const;
251 
258  KDateTime getPreviousDate(const KDateTime &afterDateTime) const;
259 
260  void setBySeconds(const QList<int> &bySeconds);
261  void setByMinutes(const QList<int> &byMinutes);
262  void setByHours(const QList<int> &byHours);
263 
264  void setByDays(const QList<WDayPos> &byDays);
265  void setByMonthDays(const QList<int> &byMonthDays);
266  void setByYearDays(const QList<int> &byYearDays);
267  void setByWeekNumbers(const QList<int> &byWeekNumbers);
268  void setByMonths(const QList<int> &byMonths);
269  void setBySetPos(const QList<int> &bySetPos);
270  void setWeekStart(short weekStart);
271 
272  const QList<int> &bySeconds() const;
273  const QList<int> &byMinutes() const;
274  const QList<int> &byHours() const;
275 
276  const QList<WDayPos> &byDays() const;
277  const QList<int> &byMonthDays() const;
278  const QList<int> &byYearDays() const;
279  const QList<int> &byWeekNumbers() const;
280  const QList<int> &byMonths() const;
281  const QList<int> &bySetPos() const;
282  short weekStart() const;
283 
291  void setRRule(const QString &rrule);
292  QString rrule() const;
293 
294  void setDirty();
302  void addObserver(RuleObserver *observer);
303 
310  void removeObserver(RuleObserver *observer);
311 
315  void dump() const;
316 
317 private:
318  //@cond PRIVATE
319  class Private;
320  Private *const d;
321  //@endcond
322 };
323 
324 }
325 
326 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Thu Jan 9 2014 17:48:40 by doxygen 1.8.3.1 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.5 API Reference

Skip menu "kdepimlibs-4.11.5 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