libkpimexchange Library API Documentation

resourceexchange.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 <qdict.h>
00025 #include <qintdict.h>
00026 
00027 #include <libkcal/calendar.h>
00028 #include <libkcal/calendarlocal.h>
00029 #include <libkcal/resourcecalendar.h>
00030 
00031 #include "exchangemonitor.h"
00032 
00033 class DateSet;
00034 
00035 namespace KPIM {
00036 class ExchangeAccount;
00037 class ExchangeClient;
00038 }
00039 
00040 namespace KCal {
00041 class Event;
00042 class CalFormat;
00043 
00047 class ResourceExchange : public ResourceCalendar, public IncidenceBase::Observer
00048 {
00049   Q_OBJECT
00050 
00051   public:
00052     ResourceExchange( const KConfig * );
00053     virtual ~ResourceExchange();
00054 
00055     virtual void writeConfig( KConfig* config );
00056 
00057     virtual bool load();
00058 
00063     virtual bool save();
00064 
00065     KABC::Lock *lock();
00066 
00068 //    ExchangeCalendar( KPIM::ExchangeAccount* account );
00070 //    ExchangeCalendar( KPIM::ExchangeAccount* account, const QString &timeZoneId );
00071 //    virtual ~ExchangeCalendar();
00072   
00080 //    bool load( const QString &fileName );
00087 //    bool save( const QString &fileName, CalFormat *format = 0 );
00088 
00090 //    void close();
00091   
00093     bool addEvent(Event *anEvent);
00095     void deleteEvent(Event *);
00096 
00100     Event *event(const QString &UniqueStr);
00104 //    Event::List events();
00109     Event::List rawEvents();
00110 
00111     /*
00112       Returns a QString with the text of the holiday (if any) that falls
00113       on the specified date.
00114     */
00115     QString getHolidayForDate(const QDate &qd);
00116     
00117     virtual void subscribeEvents( const QDate& start, const QDate& end );
00118 
00126     virtual void unsubscribeEvents( const QDate& start, const QDate& end );
00127 
00131     bool addTodo( Todo *todo );
00135     void deleteTodo( Todo * );
00140     Todo *todo( const QString &uid );
00144     Todo::List rawTodos();
00148     Todo::List todos( const QDate &date );
00149 
00151     virtual bool addJournal(Journal *);
00153     virtual void deleteJournal(Journal *);
00155     virtual Journal *journal(const QDate &);
00157     virtual Journal *journal(const QString &UID);
00159     Journal::List journals();
00160 
00162     Alarm::List alarms( const QDateTime &from, const QDateTime &to );
00163 
00165     Alarm::List alarmsTo( const QDateTime &to );
00166 
00167     friend class ResourceExchangeConfig;
00168 
00169   protected:
00175     virtual bool doOpen();
00176 
00178     virtual void doClose();
00179 
00184     Event::List rawEventsForDate( const QDate &date, bool sorted = false );
00188     Event::List rawEventsForDate( const QDateTime &qdt );
00193     Event::List rawEvents( const QDate &start, const QDate &end,
00194                                bool inclusive = false );
00195 
00199     void update(IncidenceBase *incidence);
00200   
00202     void incidenceUpdated( IncidenceBase *i ) { mCache->update( i ); update( i ); }
00203   
00205 //    void insertEvent(const Event *anEvent);
00206   
00208 //    void appendAlarms( Alarm::List &alarms, Incidence *incidence,
00209 //                       const QDateTime &from, const QDateTime &to );
00210 
00212 //    void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
00213 //                       const QDateTime &from, const QDateTime &to );
00214 
00215     void uploadEvent( Event* event );
00216         
00217         void setTimeZoneId( const QString &tzid );
00218 
00219   protected slots:
00220     void slotMonitorNotify( const QValueList<long>& IDs, const QValueList<KURL>& urls);
00221     void slotMonitorError( int errorCode, const QString& moreInfo );
00222     void slotDownloadFinished( int result, const QString& moreinfo );
00223     void downloadedEvent( KCal::Event*, const KURL& );
00224 
00225   private:
00226     class EventInfo;
00227     KPIM::ExchangeAccount* mAccount;
00228     KPIM::ExchangeClient* mClient;
00229     KPIM::ExchangeMonitor* mMonitor;
00230     CalendarLocal* mCache;
00231     QDict<EventInfo> mEventDict; // maps UIDS to EventInfo records
00232     QIntDict<EventInfo> mWatchDict; // maps Watch IDs to EventInfo records 
00233     DateSet* mDates;
00234     QMap<Event, QDateTime>* mEventDates;
00235     QMap<QDate, QDateTime>* mCacheDates;
00236     int mCachedSeconds;
00237     bool mAutoMailbox;
00238     QString mTimeZoneId;
00239 
00240     KABC::Lock *mLock;
00241 };
00242 
00243 }
00244 
00245 #endif
KDE Logo
This file is part of the documentation for libkpimexchange Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:10 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003