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

KCal Library

  • kcal
recurrence.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 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_RECURRENCE_H
25#define KCAL_RECURRENCE_H
26
27#include "kcal_export.h"
28#include "recurrencerule.h"
29
30#include <kdatetime.h>
31
32#include <QtCore/QString>
33#include <QtCore/QBitArray>
34#include <QtCore/QList>
35
36namespace KCal {
37
38class RecurrenceRule;
39
91class KCAL_DEPRECATED_EXPORT Recurrence : public RecurrenceRule::RuleObserver
92{
93 public:
94 class RecurrenceObserver
95 {
96 public:
97 virtual ~RecurrenceObserver() {}
99 virtual void recurrenceUpdated( Recurrence *r ) = 0;
100 };
101
103 enum {
104 rNone = 0,
105 rMinutely = 0x001,
106 rHourly = 0x0002,
107 rDaily = 0x0003,
108 rWeekly = 0x0004,
109 rMonthlyPos = 0x0005,
110 rMonthlyDay = 0x0006,
111 rYearlyMonth = 0x0007,
112 rYearlyDay = 0x0008,
113 rYearlyPos = 0x0009,
114 rOther = 0x000A,
115 rMax=0x00FF
116 };
117
121 Recurrence();
127 Recurrence( const Recurrence &r );
131 virtual ~Recurrence();
132
139 bool operator==( const Recurrence &r ) const;
146 bool operator!=( const Recurrence &r ) const { return !operator==(r); }
147
154 Recurrence &operator=( const Recurrence &r );
155
158 KDateTime startDateTime() const;
160 QDate startDate() const;
166 void setStartDateTime( const KDateTime &start );
167
174 bool allDay() const;
178 void setAllDay( bool allDay );
179
181 void setRecurReadOnly( bool readOnly );
182
184 bool recurReadOnly() const;
185
187 bool recurs() const;
188
191 ushort recurrenceType() const;
192
198 static ushort recurrenceType( const RecurrenceRule *rrule );
199
206 bool recursOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
207
215 bool recursAt( const KDateTime &dt ) const;
216
221 void unsetRecurs();
222
226 void clear();
227
234 TimeList recurTimesOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
235
248 DateTimeList timesInInterval( const KDateTime &start, const KDateTime &end ) const;
249
256 KDateTime getNextDateTime( const KDateTime &preDateTime ) const;
257
266 KDateTime getPreviousDateTime( const KDateTime &afterDateTime ) const;
267
269 int frequency() const;
270
272 void setFrequency( int freq );
273
278 int duration() const;
279
282 void setDuration( int duration );
283
287 int durationTo( const KDateTime &dt ) const;
288
292 int durationTo( const QDate &date ) const;
293
297 KDateTime endDateTime() const;
298
302 QDate endDate() const;
303
307 void setEndDate( const QDate &endDate );
308
311 void setEndDateTime( const KDateTime &endDateTime );
312
327 void shiftTimes( const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec );
328
339 void setMinutely( int freq );
340
354 void setHourly( int freq );
355
369 void setDaily( int freq );
370
382 void setWeekly( int freq, int weekStart = 1 );
395 void setWeekly( int freq, const QBitArray &days, int weekStart = 1 );
396
400 void addWeeklyDays( const QBitArray &days );
406 int weekStart() const;
407
409 QBitArray days() const; // Emulate the old behavior
410
425 void setMonthly( int freq );
426
434 void addMonthlyPos( short pos, const QBitArray &days );
435 void addMonthlyPos( short pos, ushort day );
436
441 void addMonthlyDate( short day );
442
444 QList<RecurrenceRule::WDayPos> monthPositions() const;
445
447 // Emulate old behavior
448 QList<int> monthDays() const;
449
472 void setYearly( int freq );
473
480 void addYearlyDay( int day );
481
490 void addYearlyDate( int date );
491
497 void addYearlyMonth( short _rNum );
498
515 void addYearlyPos( short pos, const QBitArray &days );
516
522 QList<int> yearDays() const;
523
531 QList<int> yearDates() const;
532
541 QList<int> yearMonths() const;
542
552 QList<RecurrenceRule::WDayPos> yearPositions() const;
553
555 static const QDate MAX_DATE;
556
560 void dump() const;
561
562 // RRULE
563 RecurrenceRule::List rRules() const;
568 void addRRule( RecurrenceRule *rrule );
569
576 void removeRRule( RecurrenceRule *rrule );
577
582 void deleteRRule( RecurrenceRule *rrule );
583
584 // EXRULE
585 RecurrenceRule::List exRules() const;
586
591 void addExRule( RecurrenceRule *exrule );
592
599 void removeExRule( RecurrenceRule *exrule );
600
605 void deleteExRule( RecurrenceRule *exrule );
606
607 // RDATE
608 DateTimeList rDateTimes() const;
609 DateList rDates() const;
610 void setRDateTimes( const DateTimeList &rdates );
611 void setRDates( const DateList &rdates );
612 void addRDateTime( const KDateTime &rdate );
613 void addRDate( const QDate &rdate );
614
615 // ExDATE
616 DateTimeList exDateTimes() const;
617 DateList exDates() const;
618 void setExDateTimes( const DateTimeList &exdates );
619 void setExDates( const DateList &exdates );
620 void addExDateTime( const KDateTime &exdate );
621 void addExDate( const QDate &exdate );
622
623 RecurrenceRule *defaultRRule( bool create = false ) const;
624 RecurrenceRule *defaultRRuleConst() const;
625 void updated();
626
634 void addObserver( RecurrenceObserver *observer );
641 void removeObserver( RecurrenceObserver *observer );
642
643 void recurrenceChanged( RecurrenceRule * );
644
645 protected:
646 RecurrenceRule *setNewRecurrenceType( RecurrenceRule::PeriodType type, int freq );
647
648 private:
649 //@cond PRIVATE
650 class Private;
651 Private *const d;
652 //@endcond
653};
654
655}
656
657#endif
KCal::ListBase
This class provides a template for lists of pointers.
Definition: listbase.h:45
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::Recurrence
This class represents a recurrence rule for a calendar incidence.
Definition: recurrence.h:92
KCal::Recurrence::operator!=
bool operator!=(const Recurrence &r) const
Comparison operator for inequality.
Definition: recurrence.h:146
KCal::Recurrence::MAX_DATE
static const QDate MAX_DATE
Upper date limit for recurrences.
Definition: recurrence.h:555
KCal::SortableList
A QList which can be sorted.
Definition: sortablelist.h:87
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 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