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

KAlarm Library

  • sources
  • kde-4.12
  • kdepimlibs
  • kalarmcal
karecurrence.h
1 /*
2  * karecurrence.h - recurrence with special yearly February 29th handling
3  * This file is part of kalarmcal library, which provides access to KAlarm
4  * calendar data.
5  * Copyright © 2005-2012 by David Jarvie <djarvie@kde.org>
6  *
7  * This library is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Library General Public License as published
9  * by the Free Software Foundation; either version 2 of the License, or (at
10  * your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB. If not, write to the
19  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  * MA 02110-1301, USA.
21  */
22 
23 #ifndef KALARM_KARECURRENCE_H
24 #define KALARM_KARECURRENCE_H
25 
26 #include "kalarmcal_export.h"
27 
28 #ifndef KALARMCAL_USE_KRESOURCES
29 #include <kcalcore/recurrencerule.h>
30 #include <kcalcore/duration.h>
31 namespace KCalCore { class Recurrence; }
32 #else
33 #include <kcal/recurrencerule.h>
34 #include <kcal/duration.h>
35 namespace KCal { class Recurrence; }
36 #endif
37 
38 #include <QtCore/QBitArray>
39 
40 namespace KAlarmCal
41 {
42 
61 class KALARMCAL_EXPORT KARecurrence
62 {
63  public:
67  enum Type
68  {
69  NO_RECUR,
70  MINUTELY,
71  DAILY,
72  WEEKLY,
73  MONTHLY_POS,
74  MONTHLY_DAY,
75  ANNUAL_DATE,
76  ANNUAL_POS
77  };
79  enum Feb29Type
80  {
81  Feb29_Feb28,
82  Feb29_Mar1,
83  Feb29_None
84  };
85 
86  KARecurrence();
87 #ifndef KALARMCAL_USE_KRESOURCES
88  KARecurrence(const KCalCore::Recurrence& r);
89 #else
90  KARecurrence(const KCal::Recurrence& r);
91 #endif
92  KARecurrence(const KARecurrence& r);
93  ~KARecurrence();
98  KARecurrence& operator=(const KARecurrence& r);
99 
105  bool operator==(const KARecurrence& r) const;
106 
112  bool operator!=(const KARecurrence& r) const { return !operator==(r); }
113 
117  bool set(const QString& icalRRULE);
118 
127  bool set(Type t, int freq, int count, const KDateTime& start, const KDateTime& end);
128 
134  bool set(Type t, int freq, int count, const KDateTime& start, const KDateTime& end, Feb29Type f29);
135 
143 #ifndef KALARMCAL_USE_KRESOURCES
144  bool init(KCalCore::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end);
145 #else
146  bool init(KCal::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end);
147 #endif
148 
155 #ifndef KALARMCAL_USE_KRESOURCES
156  bool init(KCalCore::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end, Feb29Type f29);
157 #else
158  bool init(KCal::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end, Feb29Type f29);
159 #endif
160 
162  void clear();
163 
167 #ifndef KALARMCAL_USE_KRESOURCES
168  void writeRecurrence(KCalCore::Recurrence&) const;
169 #else
170  void writeRecurrence(KCal::Recurrence&) const;
171 #endif
172 
181  void fix();
182 
186  KDateTime startDateTime() const;
188  QDate startDate() const;
189 
194  void setStartDateTime(const KDateTime& dt, bool dateOnly);
195 
197  KDateTime endDateTime() const;
198 
200  QDate endDate() const;
201 
206  void setEndDate(const QDate& endDate);
207 
211  void setEndDateTime(const KDateTime& endDateTime);
212 
220  bool allDay() const;
221 
223  void setRecurReadOnly(bool readOnly);
224 
226  bool recurReadOnly() const;
227 
229  bool recurs() const;
230 
232  QBitArray days() const; // Emulate the old behavior
233 
235 #ifndef KALARMCAL_USE_KRESOURCES
236  QList<KCalCore::RecurrenceRule::WDayPos> monthPositions() const;
237 #else
238  QList<KCal::RecurrenceRule::WDayPos> monthPositions() const;
239 #endif
240 
242  // Emulate old behavior
243  QList<int> monthDays() const;
244 
250  QList<int> yearDays() const;
251 
259  QList<int> yearDates() const;
260 
269  QList<int> yearMonths() const;
270 
279 #ifndef KALARMCAL_USE_KRESOURCES
280  QList<KCalCore::RecurrenceRule::WDayPos> yearPositions() const;
281 #else
282  QList<KCal::RecurrenceRule::WDayPos> yearPositions() const;
283 #endif
284 
288  void addWeeklyDays(const QBitArray& days);
289 
296  void addYearlyDay(int day);
297 
306  void addYearlyDate(int date);
307 
313  void addYearlyMonth(short month);
314 
331  void addYearlyPos(short pos, const QBitArray& days);
332 
340  void addMonthlyPos(short pos, const QBitArray& days);
341  void addMonthlyPos(short pos, ushort day);
342 
347  void addMonthlyDate(short day);
348 
350  KDateTime getNextDateTime(const KDateTime& preDateTime) const;
351 
353  KDateTime getPreviousDateTime(const KDateTime& afterDateTime) const;
354 
357  bool recursOn(const QDate&, const KDateTime::Spec&) const;
358 
365  bool recursAt(const KDateTime& dt) const;
366 
373 #ifndef KALARMCAL_USE_KRESOURCES
374  KCalCore::TimeList recurTimesOn(const QDate& date, const KDateTime::Spec& timeSpec) const;
375 #else
376  KCal::TimeList recurTimesOn(const QDate& date, const KDateTime::Spec& timeSpec) const;
377 #endif
378 
391 #ifndef KALARMCAL_USE_KRESOURCES
392  KCalCore::DateTimeList timesInInterval(const KDateTime& start, const KDateTime& end) const;
393 #else
394  KCal::DateTimeList timesInInterval(const KDateTime& start, const KDateTime& end) const;
395 #endif
396 
398  int frequency() const;
399 
401  void setFrequency(int freq);
402 
407  int duration() const;
408 
412  void setDuration(int duration);
413 
417  int durationTo(const KDateTime& dt) const;
418 
422  int durationTo(const QDate& date) const;
423 
427 #ifndef KALARMCAL_USE_KRESOURCES
428  KCalCore::Duration longestInterval() const;
429 #else
430  KCal::Duration longestInterval() const;
431 #endif
432 
437 #ifndef KALARMCAL_USE_KRESOURCES
438  KCalCore::Duration regularInterval() const;
439 #else
440  KCal::Duration regularInterval() const;
441 #endif
442 #ifndef KALARMCAL_USE_KRESOURCES
443  KCalCore::DateTimeList exDateTimes() const;
444  KCalCore::DateList exDates() const;
445  void setExDateTimes(const KCalCore::DateTimeList& exdates);
446  void setExDates(const KCalCore::DateList& exdates);
447 #else
448  KCal::DateTimeList exDateTimes() const;
449  KCal::DateList exDates() const;
450  void setExDateTimes(const KCal::DateTimeList& exdates);
451  void setExDates(const KCal::DateList& exdates);
452 #endif
453  void addExDateTime(const KDateTime& exdate);
454  void addExDate(const QDate& exdate);
455 
470  void shiftTimes(const KDateTime::Spec& oldSpec, const KDateTime::Spec& newSpec);
471 
472 #ifndef KALARMCAL_USE_KRESOURCES
473  KCalCore::RecurrenceRule* defaultRRuleConst() const;
474 #else
475  KCal::RecurrenceRule* defaultRRuleConst() const;
476 #endif
477 
478  Type type() const;
479 
481 #ifndef KALARMCAL_USE_KRESOURCES
482  static Type type(const KCalCore::RecurrenceRule*);
483 #else
484  static Type type(const KCal::RecurrenceRule*);
485 #endif
486 
488 #ifndef KALARMCAL_USE_KRESOURCES
489  static bool dailyType(const KCalCore::RecurrenceRule*);
490 #else
491  static bool dailyType(const KCal::RecurrenceRule*);
492 #endif
493 
495  Feb29Type feb29Type() const;
496 
501  static Feb29Type defaultFeb29Type();
502 
507  static void setDefaultFeb29Type(Feb29Type t);
508 
509  private:
510  //@cond PRIVATE
511  class Private;
512  Private* const d;
513  //@endcond
514 };
515 
516 } // namespace KAlarmCal
517 
518 #endif // KALARM_KARECURRENCE_H
519 
520 // vim: et sw=4:
KAlarmCal::KARecurrence::ANNUAL_DATE
yearly, on a specified date in each of the specified months
Definition: karecurrence.h:75
KAlarmCal::KARecurrence::WEEKLY
weekly, on specified weekdays
Definition: karecurrence.h:72
KAlarmCal::KARecurrence::Type
Type
The recurrence's period type.
Definition: karecurrence.h:67
KCalCore::Duration
KAlarmCal::KARecurrence::DAILY
daily
Definition: karecurrence.h:71
KAlarmCal::KARecurrence::Feb29Type
Feb29Type
When annual February 29th recurrences should occur in non-leap years.
Definition: karecurrence.h:79
KAlarmCal::KARecurrence::NO_RECUR
does not recur
Definition: karecurrence.h:69
KAlarmCal::KARecurrence::Feb29_Mar1
occurs on 1 March in non-leap years
Definition: karecurrence.h:82
KAlarmCal::KARecurrence
Represents recurrences for KAlarm.
Definition: karecurrence.h:61
KAlarmCal::KARecurrence::operator!=
bool operator!=(const KARecurrence &r) const
Comparison operator for inequality.
Definition: karecurrence.h:112
KCalCore::Recurrence
KCalCore::SortableList
KCalCore::RecurrenceRule::PeriodType
PeriodType
duration.h
KAlarmCal::KARecurrence::MONTHLY_POS
monthly, on specified weekdays in a specified week of the month
Definition: karecurrence.h:73
KAlarmCal::KARecurrence::MINUTELY
at an hours/minutes interval
Definition: karecurrence.h:70
KAlarmCal::KARecurrence::MONTHLY_DAY
monthly, on a specified day of the month
Definition: karecurrence.h:74
KAlarmCal::KARecurrence::Feb29_Feb28
occurs on 28 February in non-leap years
Definition: karecurrence.h:81
KCalCore::RecurrenceRule
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:01:14 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KAlarm Library

Skip menu "KAlarm Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • 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