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

KCal Library

  • kcal
recurrencerule.h
1/*
2 This file is part of the kcal 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 KCAL_RECURRENCERULE_H
25#define KCAL_RECURRENCERULE_H
26
27#include "kcal_export.h"
28#include "kcal/listbase.h"
29#include "kcal/sortablelist.h"
30
31#include <kdatetime.h>
32
33#include <QtCore/QList>
34
35namespace KCal {
36
37// These two are duplicates wrt. incidencebase.h
38typedef SortableList<KDateTime> DateTimeList;
39typedef SortableList<QDate> DateList;
40/* List of times */
41typedef SortableList<QTime> TimeList;
42
46class KCAL_DEPRECATED_EXPORT RecurrenceRule
47{
48 public:
49 class RuleObserver
50 {
51 public:
52 virtual ~RuleObserver() {}
54 virtual void recurrenceChanged( RecurrenceRule * ) = 0;
55 };
56 typedef ListBase<RecurrenceRule> List;
57
59 enum PeriodType {
60 rNone = 0,
61 rSecondly,
62 rMinutely,
63 rHourly,
64 rDaily,
65 rWeekly,
66 rMonthly,
67 rYearly
68 };
69
71 class WDayPos
72 {
73 public:
74 explicit WDayPos( int ps = 0, short dy = 0 ) : mDay( dy ), mPos( ps ) {}
75 short day() const { return mDay; }
76 int pos() const { return mPos; }
77 void setDay( short dy ) { mDay = dy; }
78 void setPos( int ps ) { mPos = ps; }
79
80 bool operator==( const RecurrenceRule::WDayPos &pos2 ) const {
81 return mDay == pos2.mDay && mPos == pos2.mPos;
82 }
83
84 protected:
85 short mDay; // Weekday, 1=monday, 7=sunday
86 int mPos; // week of the day (-1 for last, 1 for first, 0 for all weeks)
87 // Bounded by -366 and +366, 0 means all weeks in that period
88 };
89
90 RecurrenceRule();
91 RecurrenceRule( const RecurrenceRule &r );
92 ~RecurrenceRule();
93
94 bool operator==( const RecurrenceRule &r ) const;
95 bool operator!=( const RecurrenceRule &r ) const { return !operator==(r); }
96 RecurrenceRule &operator=( const RecurrenceRule &r );
97
99 void setReadOnly( bool readOnly );
100
104 bool isReadOnly() const;
105
110 bool recurs() const;
111 void setRecurrenceType( PeriodType period );
112 PeriodType recurrenceType() const;
113
115 void clear();
116
120 uint frequency() const;
121
125 void setFrequency( int freq );
126
132 KDateTime startDt() const;
133
145 void setStartDt( const KDateTime &start );
146
149 bool allDay() const;
150
155 void setAllDay( bool allDay );
156
162 KDateTime endDt( bool *result = 0 ) const;
163
166 void setEndDt( const KDateTime &endDateTime );
167
172 int duration() const;
173
176 void setDuration( int duration );
177
179 int durationTo( const KDateTime &dt ) const;
180
182 int durationTo( const QDate &date ) const;
183
198 void shiftTimes( const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec );
199
206 bool recursOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
207
214 bool recursAt( const KDateTime &dt ) const;
215
223 bool dateMatchesRules( const KDateTime &dt ) const;
224
231 TimeList recurTimesOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
232
244 DateTimeList timesInInterval( const KDateTime &start, const KDateTime &end ) const;
245
251 KDateTime getNextDate( const KDateTime &preDateTime ) const;
252
259 KDateTime getPreviousDate( const KDateTime &afterDateTime ) const;
260
261 void setBySeconds( const QList<int> bySeconds );
262 void setByMinutes( const QList<int> byMinutes );
263 void setByHours( const QList<int> byHours );
264
265 void setByDays( const QList<WDayPos> byDays );
266 void setByMonthDays( const QList<int> byMonthDays );
267 void setByYearDays( const QList<int> byYearDays );
268 void setByWeekNumbers( const QList<int> byWeekNumbers );
269 void setByMonths( const QList<int> byMonths );
270 void setBySetPos( const QList<int> bySetPos );
271 void setWeekStart( short weekStart );
272
273 const QList<int> &bySeconds() const;
274 const QList<int> &byMinutes() const;
275 const QList<int> &byHours() const;
276
277 const QList<WDayPos> &byDays() const;
278 const QList<int> &byMonthDays() const;
279 const QList<int> &byYearDays() const;
280 const QList<int> &byWeekNumbers() const;
281 const QList<int> &byMonths() const;
282 const QList<int> &bySetPos() const;
283 short weekStart() const;
284
292 void setRRule( const QString &rrule );
293 QString rrule() const;
294
295 void setDirty();
303 void addObserver( RuleObserver *observer );
304
311 void removeObserver( RuleObserver *observer );
312
316 void dump() const;
317
318 private:
319 //@cond PRIVATE
320 class Private;
321 Private *d;
322 //@endcond
323};
324
325}
326
327#endif
KCal::RecurrenceRule::WDayPos
structure for describing the n-th weekday of the month/year.
Definition recurrencerule.h:72
KCal::RecurrenceRule
This class represents a recurrence rule for a calendar incidence.
Definition recurrencerule.h:47
KCal::RecurrenceRule::PeriodType
PeriodType
enum for describing the frequency how an event recurs, if at all.
Definition recurrencerule.h:59
KCal::SortableList
A QList which can be sorted.
Definition sortablelist.h:87
KCal::DateList
SortableList< QDate > DateList
List of dates.
Definition incidencebase.h:72
KCal::DateTimeList
SortableList< KDateTime > DateTimeList
List of times.
Definition incidencebase.h:74
listbase.h
This file is part of the API for handling calendar data and defines the ListBase class.
sortablelist.h
This file is part of the API for handling calendar data and defines the Sortable List class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.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
  • File Members
  • Related Pages

kdepimlibs-4.14.10 API Reference

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