• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kalarm

karecurrence.h

Go to the documentation of this file.
00001 /*
00002  *  karecurrence.h  -  recurrence with special yearly February 29th handling
00003  *  Program:  kalarm
00004  *  Copyright © 2005-2007 by David Jarvie <djarvie@kde.org>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License along
00017  *  with this program; if not, write to the Free Software Foundation, Inc.,
00018  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef KARECURRENCE_H
00022 #define KARECURRENCE_H
00023 
00024 #include <kcal/recurrence.h>
00025 #include <kcal/duration.h>
00026 
00027 #include "preferences.h"
00028 class DateTime;
00029 
00030 
00031 class KARecurrence : public KCal::Recurrence
00032 {
00033     public:
00037         enum Type {
00038             NO_RECUR,      // does not recur
00039             MINUTELY,      // at an hours/minutes interval
00040             DAILY,         // daily
00041             WEEKLY,        // weekly, on specified weekdays
00042             MONTHLY_POS,   // monthly, on specified weekdays in a specified week of the month
00043             MONTHLY_DAY,   // monthly, on a specified day of the month
00044             ANNUAL_DATE,   // yearly, on a specified date in each of the specified months
00045             ANNUAL_POS     // yearly, on specified weekdays in the specified weeks of the specified months
00046         };
00047 
00048         KARecurrence() : KCal::Recurrence(), mFeb29Type(Preferences::Feb29_None), mCachedType(-1) { }
00049         KARecurrence(const KCal::Recurrence& r) : KCal::Recurrence(r) { fix(); }
00050         KARecurrence(const KARecurrence& r) : KCal::Recurrence(r), mFeb29Type(r.mFeb29Type), mCachedType(r.mCachedType) { }
00051         bool        set(const QString& icalRRULE);
00052         bool        set(Type t, int freq, int count, const KDateTime& start, const KDateTime& end)
00053                                 { return set(t, freq, count, -1, start, end); }
00054         bool        set(Type t, int freq, int count, const KDateTime& start, const KDateTime& end, Preferences::Feb29Type f29)
00055                                 { return set(t, freq, count, f29, start, end); }
00056         bool        init(KCal::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end)
00057                                 { return init(t, freq, count, -1, start, end); }
00058         bool        init(KCal::RecurrenceRule::PeriodType t, int freq, int count, const KDateTime& start, const KDateTime& end, Preferences::Feb29Type f29)
00059                                 { return init(t, freq, count, f29, start, end); }
00060         void        fix();
00061         void        writeRecurrence(KCal::Recurrence&) const;
00062         KDateTime   endDateTime() const;
00063         QDate       endDate() const;
00064         bool        recursOn(const QDate&, const KDateTime::Spec&) const;
00065         KDateTime   getNextDateTime(const KDateTime& preDateTime) const;
00066         KDateTime   getPreviousDateTime(const KDateTime& afterDateTime) const;
00067         KCal::Duration longestInterval() const;
00068         KCal::Duration regularInterval() const;
00069         Type        type() const;
00070         static Type type(const KCal::RecurrenceRule*);
00071         static bool dailyType(const KCal::RecurrenceRule*);
00072         Preferences::Feb29Type feb29Type() const                   { return mFeb29Type; }
00073         static Preferences::Feb29Type defaultFeb29Type()           { return mDefaultFeb29; }
00074         static void setDefaultFeb29Type(Preferences::Feb29Type t)  { mDefaultFeb29 = t; }
00075 
00076     private:
00077         bool        set(Type, int freq, int count, int feb29Type, const KDateTime& start, const KDateTime& end);
00078         bool        init(KCal::RecurrenceRule::PeriodType, int freq, int count, int feb29Type, const KDateTime& start, const KDateTime& end);
00079         int         combineDurations(const KCal::RecurrenceRule*, const KCal::RecurrenceRule*, QDate& end) const;
00080         int         longestWeeklyInterval(const QBitArray& days, int frequency);
00081 
00082         static Preferences::Feb29Type mDefaultFeb29;
00083         Preferences::Feb29Type   mFeb29Type;       // yearly recurrence on Feb 29th (leap years) / Mar 1st (non-leap years)
00084         mutable int              mCachedType;
00085 };
00086 
00087 #endif // KARECURRENCE_H

kalarm

Skip menu "kalarm"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
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