• Skip to content
  • Skip to link menu
KDE 4.8 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

KAlarm Library

karecurrence.h
00001 /*
00002  *  karecurrence.h  -  recurrence with special yearly February 29th handling
00003  *  This file is part of kalarmcal library, which provides access to KAlarm
00004  *  calendar data.
00005  *  Copyright © 2005-2011 by David Jarvie <djarvie@kde.org>
00006  *
00007  *  This library is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU Library General Public License as published
00009  *  by the Free Software Foundation; either version 2 of the License, or (at
00010  *  your option) any later version.
00011  *
00012  *  This library is distributed in the hope that it will be useful, but WITHOUT
00013  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00015  *  License for more details.
00016  *
00017  *  You should have received a copy of the GNU Library General Public License
00018  *  along with this library; see the file COPYING.LIB.  If not, write to the
00019  *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00020  *  MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef KALARM_KARECURRENCE_H
00024 #define KALARM_KARECURRENCE_H
00025 
00026 #include "kalarmcal_export.h"
00027 
00028 #ifndef USE_KRESOURCES
00029 #include <kcalcore/recurrencerule.h>
00030 #include <kcalcore/duration.h>
00031 namespace KCalCore { class Recurrence; }
00032 #else
00033 #include <kcal/recurrencerule.h>
00034 #include <kcal/duration.h>
00035 namespace KCal { class Recurrence; }
00036 #endif
00037 
00038 namespace KAlarmCal
00039 {
00040 
00059 class KALARMCAL_EXPORT KARecurrence
00060 {
00061     public:
00065         enum Type
00066         {
00067             NO_RECUR,      
00068             MINUTELY,      
00069             DAILY,         
00070             WEEKLY,        
00071             MONTHLY_POS,   
00072             MONTHLY_DAY,   
00073             ANNUAL_DATE,   
00074             ANNUAL_POS     
00075         };
00077         enum Feb29Type
00078         {
00079             Feb29_Feb28,   
00080             Feb29_Mar1,    
00081             Feb29_None     
00082         };
00083 
00084         KARecurrence();
00085 #ifndef USE_KRESOURCES
00086         KARecurrence(const KCalCore::Recurrence& r);
00087 #else
00088         KARecurrence(const KCal::Recurrence& r);
00089 #endif
00090         KARecurrence(const KARecurrence& r);
00091         ~KARecurrence();
00096         KARecurrence& operator=(const KARecurrence& r);
00097 
00103         bool operator==(const KARecurrence& r) const;
00104 
00110         bool operator!=(const KARecurrence& r) const  { return !operator==(r); }
00111 
00115         bool set(const QString& icalRRULE);
00116 
00125         bool set(Type t, int freq, int count, const KDateTime& start, const KDateTime& end);
00126 
00132         bool set(Type t, int freq, int count, const KDateTime& start, const KDateTime& end, Feb29Type f29);
00133 
00141 #ifndef USE_KRESOURCES
00142         bool init(KCalCore::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end);
00143 #else
00144         bool init(KCal::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end);
00145 #endif
00146 
00153 #ifndef USE_KRESOURCES
00154         bool init(KCalCore::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end, Feb29Type f29);
00155 #else
00156         bool init(KCal::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end, Feb29Type f29);
00157 #endif
00158 
00160         void clear();
00161 
00165 #ifndef USE_KRESOURCES
00166         void writeRecurrence(KCalCore::Recurrence&) const;
00167 #else
00168         void writeRecurrence(KCal::Recurrence&) const;
00169 #endif
00170 
00179         void fix();
00180 
00184         KDateTime startDateTime() const;
00186         QDate startDate() const;
00187  
00192         void        setStartDateTime(const KDateTime& dt, bool dateOnly);
00193 
00195         KDateTime   endDateTime() const;
00196 
00198         QDate       endDate() const;
00199 
00204     void setEndDate(const QDate& endDate);
00205 
00209     void setEndDateTime(const KDateTime& endDateTime);
00210 
00218     bool allDay() const;
00219 
00221     void setRecurReadOnly(bool readOnly);
00222 
00224     bool recurReadOnly() const;
00225 
00227     bool recurs() const;
00228 
00230     QBitArray days() const; // Emulate the old behavior
00231 
00233 #ifndef USE_KRESOURCES
00234     QList<KCalCore::RecurrenceRule::WDayPos> monthPositions() const;
00235 #else
00236     QList<KCal::RecurrenceRule::WDayPos> monthPositions() const;
00237 #endif
00238 
00240     // Emulate old behavior
00241     QList<int> monthDays() const;
00242 
00248     QList<int> yearDays() const;
00249 
00257     QList<int> yearDates() const;
00258 
00267     QList<int> yearMonths() const;
00268 
00277 #ifndef USE_KRESOURCES
00278     QList<KCalCore::RecurrenceRule::WDayPos> yearPositions() const;
00279 #else
00280     QList<KCal::RecurrenceRule::WDayPos> yearPositions() const;
00281 #endif
00282 
00286     void addWeeklyDays(const QBitArray& days);
00287 
00294     void addYearlyDay(int day);
00295 
00304     void addYearlyDate(int date);
00305 
00311     void addYearlyMonth(short month);
00312 
00329     void addYearlyPos(short pos, const QBitArray& days);
00330 
00338     void addMonthlyPos(short pos, const QBitArray& days);
00339     void addMonthlyPos(short pos, ushort day);
00340 
00345     void addMonthlyDate(short day);
00346 
00348         KDateTime   getNextDateTime(const KDateTime& preDateTime) const;
00349 
00351         KDateTime   getPreviousDateTime(const KDateTime& afterDateTime) const;
00352 
00355         bool        recursOn(const QDate&, const KDateTime::Spec&) const;
00356 
00363     bool recursAt(const KDateTime& dt) const;
00364 
00371 #ifndef USE_KRESOURCES
00372     KCalCore::TimeList recurTimesOn(const QDate& date, const KDateTime::Spec& timeSpec) const;
00373 #else
00374     KCal::TimeList recurTimesOn(const QDate& date, const KDateTime::Spec& timeSpec) const;
00375 #endif
00376 
00389 #ifndef USE_KRESOURCES
00390     KCalCore::DateTimeList timesInInterval(const KDateTime& start, const KDateTime& end) const;
00391 #else
00392     KCal::DateTimeList timesInInterval(const KDateTime& start, const KDateTime& end) const;
00393 #endif
00394 
00396     int frequency() const;
00397 
00399     void setFrequency(int freq);
00400 
00405     int duration() const;
00406 
00410     void setDuration(int duration);
00411 
00415     int durationTo(const KDateTime& dt) const;
00416 
00420     int durationTo(const QDate& date) const;
00421 
00425 #ifndef USE_KRESOURCES
00426         KCalCore::Duration longestInterval() const;
00427 #else
00428         KCal::Duration longestInterval() const;
00429 #endif
00430 
00435 #ifndef USE_KRESOURCES
00436         KCalCore::Duration regularInterval() const;
00437 #else
00438         KCal::Duration regularInterval() const;
00439 #endif
00440 #ifndef USE_KRESOURCES
00441     KCalCore::DateTimeList exDateTimes() const;
00442     KCalCore::DateList exDates() const;
00443     void setExDateTimes(const KCalCore::DateTimeList& exdates);
00444     void setExDates(const KCalCore::DateList& exdates);
00445 #else
00446     KCal::DateTimeList exDateTimes() const;
00447     KCal::DateList exDates() const;
00448     void setExDateTimes(const KCal::DateTimeList& exdates);
00449     void setExDates(const KCal::DateList& exdates);
00450 #endif
00451     void addExDateTime(const KDateTime& exdate);
00452     void addExDate(const QDate& exdate);
00453 
00468     void shiftTimes(const KDateTime::Spec& oldSpec, const KDateTime::Spec& newSpec);
00469 
00470 #ifndef USE_KRESOURCES
00471     KCalCore::RecurrenceRule* defaultRRuleConst() const;
00472 #else
00473     KCal::RecurrenceRule* defaultRRuleConst() const;
00474 #endif
00475 
00476         Type type() const;
00477 
00479 #ifndef USE_KRESOURCES
00480         static Type type(const KCalCore::RecurrenceRule*);
00481 #else
00482         static Type type(const KCal::RecurrenceRule*);
00483 #endif
00484 
00486 #ifndef USE_KRESOURCES
00487         static bool dailyType(const KCalCore::RecurrenceRule*);
00488 #else
00489         static bool dailyType(const KCal::RecurrenceRule*);
00490 #endif
00491 
00493         Feb29Type feb29Type() const;
00494 
00499         static Feb29Type defaultFeb29Type();
00500 
00505         static void setDefaultFeb29Type(Feb29Type t);
00506 
00507     private:
00508         //@cond PRIVATE
00509         class Private;
00510         Private* const d;
00511         //@endcond
00512 };
00513 
00514 } // namespace KAlarmCal
00515 
00516 #endif // KALARM_KARECURRENCE_H
00517 
00518 // vim: et sw=4:

KAlarm Library

Skip menu "KAlarm Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal