libkpimexchange Library API Documentation

exchangecalendar.h

00001 /*
00002     This file is part of libkpimexchange.
00003     Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
00004 
00005     This library is free software; you can redistribute it and/or modify it
00006     under the terms of the GNU Library General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or (at your
00008     option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful, but WITHOUT
00011     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013     License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to the
00017     Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00018     02111-1307, USA.
00019 */
00020 #ifndef KPIM_EXCHANGECALENDAR_H
00021 #define KPIM_EXCHANGECALENDAR_H
00022 
00023 #include <qmap.h>
00024 #include <libkcal/calendar.h>
00025 #include <libkcal/calendarlocal.h>
00026 
00027 class DateSet;
00028 
00029 namespace KPIM {
00030 class ExchangeAccount;
00031 class ExchangeClient;
00032 }
00033 
00034 namespace KCal {
00035 class Event;
00036 }
00037 
00038 namespace KCal {
00039 
00040 class CalFormat;
00041 
00045 class ExchangeCalendar : public Calendar, public IncidenceBase::Observer
00046 {
00047   public:
00049     ExchangeCalendar( KPIM::ExchangeAccount* account );
00051     ExchangeCalendar( KPIM::ExchangeAccount* account, const QString &timeZoneId );
00052     virtual ~ExchangeCalendar();
00053   
00061     bool load( const QString &fileName );
00068     bool save( const QString &fileName, CalFormat *format = 0 );
00069 
00071     void close();
00072   
00074     void addEvent(Event *anEvent);
00076     void deleteEvent(Event *);
00077 
00081     Event *event(const QString &UniqueStr);
00085 //    QPtrList<Event> events();
00090     QPtrList<Event> rawEvents();
00091 
00092     /*
00093       Returns a QString with the text of the holiday (if any) that falls
00094       on the specified date.
00095     */
00096     QString getHolidayForDate(const QDate &qd);
00097     
00099     int numEvents(const QDate &qd);
00100   
00104     void addTodo( Todo *todo );
00108     void deleteTodo( Todo * );
00113     Todo *todo( const QString &uid );
00117     QPtrList<Todo> rawTodos() const;
00121     QPtrList<Todo> todos( const QDate &date );
00127     QPtrList<Todo> todos() { return Calendar::todos(); }
00128 
00130     virtual void addJournal(Journal *);
00132     virtual Journal *journal(const QDate &);
00134     virtual Journal *journal(const QString &UID);
00136     QPtrList<Journal> journals();
00137 
00139     Alarm::List alarms( const QDateTime &from, const QDateTime &to );
00140 
00142     Alarm::List alarmsTo( const QDateTime &to );
00143 
00144   protected:
00149     QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
00153     QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
00158     QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
00159                                bool inclusive = false );
00160 
00164     void update(IncidenceBase *incidence);
00165   
00167     void incidenceUpdated( IncidenceBase *i ) { mCache->update( i ); update( i ); }
00168   
00170     void insertEvent(const Event *anEvent);
00171   
00173 //    void appendAlarms( Alarm::List &alarms, Incidence *incidence,
00174 //                       const QDateTime &from, const QDateTime &to );
00175 
00177 //    void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
00178 //                       const QDateTime &from, const QDateTime &to );
00179 
00180   private:
00181     void init( KPIM::ExchangeAccount* account );
00182 
00183     KPIM::ExchangeAccount* mAccount;
00184     KPIM::ExchangeClient* mClient;
00185     CalendarLocal* mCache;
00186     DateSet* mDates;
00187     QMap<Event, QDateTime>* mEventDates;
00188     QMap<QDate, QDateTime>* mCacheDates;
00189     int mCachedSeconds;
00190 };  
00191 
00192 }
00193 
00194 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:24 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001