libkcal Library API Documentation

calendarlocal.h

00001 /*
00002     This file is part of libkcal.
00003     Copyright (c) 1998 Preston Brown
00004     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library 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 GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019     Boston, MA 02111-1307, USA.
00020 */
00021 #ifndef KCAL_CALENDARLOCAL_H
00022 #define KCAL_CALENDARLOCAL_H
00023 
00024 #include <qintdict.h>
00025 
00026 #include "calendar.h"
00027 
00028 #define BIGPRIME 1031 /* should allow for at least 4 appointments 365 days/yr
00029                          to be almost instantly fast. */
00030 
00031 namespace KCal {
00032 
00033 class CalFormat;
00034 
00038 class CalendarLocal : public Calendar, public IncidenceBase::Observer
00039 {
00040   public:
00042     CalendarLocal();
00044     CalendarLocal( const QString &timeZoneId );
00045     virtual ~CalendarLocal();
00046   
00053     bool load( const QString &fileName );
00060     bool save( const QString &fileName, CalFormat *format = 0 );
00061 
00063     void close();
00064   
00066     void addEvent(Event *anEvent);
00068     void deleteEvent(Event *);
00069 
00073     Event *event(const QString &UniqueStr);
00077 //    QPtrList<Event> events();
00081     QPtrList<Event> rawEvents();
00082 
00083     /*
00084       Returns a QString with the text of the holiday (if any) that falls
00085       on the specified date.
00086     */
00087     QString getHolidayForDate(const QDate &qd);
00088     
00090     int numEvents(const QDate &qd);
00091   
00095     void addTodo( Todo *todo );
00099     void deleteTodo( Todo * );
00104     Todo *todo( const QString &uid );
00108     QPtrList<Todo> rawTodos() const;
00112     QPtrList<Todo> todos( const QDate &date );
00118     QPtrList<Todo> todos() { return Calendar::todos(); }
00119 
00121     virtual void addJournal(Journal *);
00123     virtual void deleteJournal(Journal *);
00125     virtual Journal *journal(const QDate &);
00127     virtual Journal *journal(const QString &UID);
00129     QPtrList<Journal> journals();
00130 
00132     Alarm::List alarms( const QDateTime &from, const QDateTime &to );
00133 
00135     Alarm::List alarmsTo( const QDateTime &to );
00136 
00137     
00141     void update(IncidenceBase *incidence);
00142  
00147     QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
00151     QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
00156     QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
00157                                bool inclusive = false );
00158 
00159  
00160   protected:
00161  
00163     void incidenceUpdated( IncidenceBase *i ) { update( i ); }
00164   
00166     void insertEvent(const Event *anEvent);
00167   
00169     long int makeKey(const QDateTime &dt);
00171     long int makeKey(const QDate &d);
00173     QDate keyToDate(long int key);
00174 
00176     void appendAlarms( Alarm::List &alarms, Incidence *incidence,
00177                        const QDateTime &from, const QDateTime &to );
00178 
00180     void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
00181                        const QDateTime &from, const QDateTime &to );
00182 
00183   private:
00184     void init();
00185 
00186     QIntDict<QPtrList<Event> > *mCalDict;    // dictionary of lists of events.
00187     QPtrList<Event> mRecursList;             // list of repeating events.
00188 
00189     QPtrList<Todo> mTodoList;               // list of todo items.
00190 
00191     QPtrList<Journal> mJournalList;
00192   
00193     QDate *mOldestDate;
00194     QDate *mNewestDate;
00195 };  
00196 
00197 }
00198 
00199 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:27 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001