00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
00070
00071
00072
00080
00087
00088
00090
00091
00093
bool addEvent(Event *anEvent);
00095
void deleteEvent(Event *);
00096
00100 Event *
event(
const QString &UniqueStr);
00104
00109 Event::List
rawEvents();
00110
00111
00112
00113
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
00206
00208
00209
00210
00212
00213
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;
00232 QIntDict<EventInfo> mWatchDict;
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