• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.8.3 API Reference
  • 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-2012 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 KALARMCAL_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 #include <QBitArray>
00039 
00040 namespace KAlarmCal
00041 {
00042 
00061 class KALARMCAL_EXPORT KARecurrence
00062 {
00063     public:
00067         enum Type
00068         {
00069             NO_RECUR,      
00070             MINUTELY,      
00071             DAILY,         
00072             WEEKLY,        
00073             MONTHLY_POS,   
00074             MONTHLY_DAY,   
00075             ANNUAL_DATE,   
00076             ANNUAL_POS     
00077         };
00079         enum Feb29Type
00080         {
00081             Feb29_Feb28,   
00082             Feb29_Mar1,    
00083             Feb29_None     
00084         };
00085 
00086         KARecurrence();
00087 #ifndef KALARMCAL_USE_KRESOURCES
00088         KARecurrence(const KCalCore::Recurrence& r);
00089 #else
00090         KARecurrence(const KCal::Recurrence& r);
00091 #endif
00092         KARecurrence(const KARecurrence& r);
00093         ~KARecurrence();
00098         KARecurrence& operator=(const KARecurrence& r);
00099 
00105         bool operator==(const KARecurrence& r) const;
00106 
00112         bool operator!=(const KARecurrence& r) const  { return !operator==(r); }
00113 
00117         bool set(const QString& icalRRULE);
00118 
00127         bool set(Type t, int freq, int count, const KDateTime& start, const KDateTime& end);
00128 
00134         bool set(Type t, int freq, int count, const KDateTime& start, const KDateTime& end, Feb29Type f29);
00135 
00143 #ifndef KALARMCAL_USE_KRESOURCES
00144         bool init(KCalCore::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end);
00145 #else
00146         bool init(KCal::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end);
00147 #endif
00148 
00155 #ifndef KALARMCAL_USE_KRESOURCES
00156         bool init(KCalCore::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end, Feb29Type f29);
00157 #else
00158         bool init(KCal::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end, Feb29Type f29);
00159 #endif
00160 
00162         void clear();
00163 
00167 #ifndef KALARMCAL_USE_KRESOURCES
00168         void writeRecurrence(KCalCore::Recurrence&) const;
00169 #else
00170         void writeRecurrence(KCal::Recurrence&) const;
00171 #endif
00172 
00181         void fix();
00182 
00186         KDateTime startDateTime() const;
00188         QDate startDate() const;
00189  
00194         void        setStartDateTime(const KDateTime& dt, bool dateOnly);
00195 
00197         KDateTime   endDateTime() const;
00198 
00200         QDate       endDate() const;
00201 
00206     void setEndDate(const QDate& endDate);
00207 
00211     void setEndDateTime(const KDateTime& endDateTime);
00212 
00220     bool allDay() const;
00221 
00223     void setRecurReadOnly(bool readOnly);
00224 
00226     bool recurReadOnly() const;
00227 
00229     bool recurs() const;
00230 
00232     QBitArray days() const; // Emulate the old behavior
00233 
00235 #ifndef KALARMCAL_USE_KRESOURCES
00236     QList<KCalCore::RecurrenceRule::WDayPos> monthPositions() const;
00237 #else
00238     QList<KCal::RecurrenceRule::WDayPos> monthPositions() const;
00239 #endif
00240 
00242     // Emulate old behavior
00243     QList<int> monthDays() const;
00244 
00250     QList<int> yearDays() const;
00251 
00259     QList<int> yearDates() const;
00260 
00269     QList<int> yearMonths() const;
00270 
00279 #ifndef KALARMCAL_USE_KRESOURCES
00280     QList<KCalCore::RecurrenceRule::WDayPos> yearPositions() const;
00281 #else
00282     QList<KCal::RecurrenceRule::WDayPos> yearPositions() const;
00283 #endif
00284 
00288     void addWeeklyDays(const QBitArray& days);
00289 
00296     void addYearlyDay(int day);
00297 
00306     void addYearlyDate(int date);
00307 
00313     void addYearlyMonth(short month);
00314 
00331     void addYearlyPos(short pos, const QBitArray& days);
00332 
00340     void addMonthlyPos(short pos, const QBitArray& days);
00341     void addMonthlyPos(short pos, ushort day);
00342 
00347     void addMonthlyDate(short day);
00348 
00350         KDateTime   getNextDateTime(const KDateTime& preDateTime) const;
00351 
00353         KDateTime   getPreviousDateTime(const KDateTime& afterDateTime) const;
00354 
00357         bool        recursOn(const QDate&, const KDateTime::Spec&) const;
00358 
00365     bool recursAt(const KDateTime& dt) const;
00366 
00373 #ifndef KALARMCAL_USE_KRESOURCES
00374     KCalCore::TimeList recurTimesOn(const QDate& date, const KDateTime::Spec& timeSpec) const;
00375 #else
00376     KCal::TimeList recurTimesOn(const QDate& date, const KDateTime::Spec& timeSpec) const;
00377 #endif
00378 
00391 #ifndef KALARMCAL_USE_KRESOURCES
00392     KCalCore::DateTimeList timesInInterval(const KDateTime& start, const KDateTime& end) const;
00393 #else
00394     KCal::DateTimeList timesInInterval(const KDateTime& start, const KDateTime& end) const;
00395 #endif
00396 
00398     int frequency() const;
00399 
00401     void setFrequency(int freq);
00402 
00407     int duration() const;
00408 
00412     void setDuration(int duration);
00413 
00417     int durationTo(const KDateTime& dt) const;
00418 
00422     int durationTo(const QDate& date) const;
00423 
00427 #ifndef KALARMCAL_USE_KRESOURCES
00428         KCalCore::Duration longestInterval() const;
00429 #else
00430         KCal::Duration longestInterval() const;
00431 #endif
00432 
00437 #ifndef KALARMCAL_USE_KRESOURCES
00438         KCalCore::Duration regularInterval() const;
00439 #else
00440         KCal::Duration regularInterval() const;
00441 #endif
00442 #ifndef KALARMCAL_USE_KRESOURCES
00443     KCalCore::DateTimeList exDateTimes() const;
00444     KCalCore::DateList exDates() const;
00445     void setExDateTimes(const KCalCore::DateTimeList& exdates);
00446     void setExDates(const KCalCore::DateList& exdates);
00447 #else
00448     KCal::DateTimeList exDateTimes() const;
00449     KCal::DateList exDates() const;
00450     void setExDateTimes(const KCal::DateTimeList& exdates);
00451     void setExDates(const KCal::DateList& exdates);
00452 #endif
00453     void addExDateTime(const KDateTime& exdate);
00454     void addExDate(const QDate& exdate);
00455 
00470     void shiftTimes(const KDateTime::Spec& oldSpec, const KDateTime::Spec& newSpec);
00471 
00472 #ifndef KALARMCAL_USE_KRESOURCES
00473     KCalCore::RecurrenceRule* defaultRRuleConst() const;
00474 #else
00475     KCal::RecurrenceRule* defaultRRuleConst() const;
00476 #endif
00477 
00478         Type type() const;
00479 
00481 #ifndef KALARMCAL_USE_KRESOURCES
00482         static Type type(const KCalCore::RecurrenceRule*);
00483 #else
00484         static Type type(const KCal::RecurrenceRule*);
00485 #endif
00486 
00488 #ifndef KALARMCAL_USE_KRESOURCES
00489         static bool dailyType(const KCalCore::RecurrenceRule*);
00490 #else
00491         static bool dailyType(const KCal::RecurrenceRule*);
00492 #endif
00493 
00495         Feb29Type feb29Type() const;
00496 
00501         static Feb29Type defaultFeb29Type();
00502 
00507         static void setDefaultFeb29Type(Feb29Type t);
00508 
00509     private:
00510         //@cond PRIVATE
00511         class Private;
00512         Private* const d;
00513         //@endcond
00514 };
00515 
00516 } // namespace KAlarmCal
00517 
00518 #endif // KALARM_KARECURRENCE_H
00519 
00520 // vim: et sw=4:
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 14 2012 05:13:36 by doxygen 1.7.5 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-4.8.3 API Reference

Skip menu "kdepimlibs-4.8.3 API Reference"
  • 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
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