00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#ifndef KCAL_RESOURCEIMAP_H
00023
#define KCAL_RESOURCEIMAP_H
00024
00025
#include <qptrlist.h>
00026
#include <qstring.h>
00027
#include <qdatetime.h>
00028
00029
#include <dcopobject.h>
00030
#include <kconfig.h>
00031
00032
#include <libkcal/incidence.h>
00033
#include <libkcal/icalformat.h>
00034
#include <libkcal/calendarlocal.h>
00035
00036
#include "resourcecalendar.h"
00037
00038
class DCOPClient;
00039
class KMailICalIface_stub;
00040
00041
namespace KCal {
00042
00046 class ResourceIMAP :
public ResourceCalendar,
public IncidenceBase::Observer,
00047
virtual public DCOPObject
00048 {
00049 Q_OBJECT
00050 K_DCOP
00051
00052 k_dcop:
00053
virtual bool addIncidence(
const QString& type,
const QString& ical );
00054
virtual void deleteIncidence(
const QString& type,
const QString& uid );
00055
virtual void slotRefresh(
const QString& type );
00056
00057
public:
00058
ResourceIMAP(
const KConfig * );
00059
virtual ~
ResourceIMAP();
00060
00061
virtual void writeConfig( KConfig* config );
00062
00063
bool load();
00064
00065
bool save();
00066
00067 KABC::Lock *
lock();
00068
00070
bool addEvent(
Event *anEvent);
00072
void deleteEvent(
Event *);
00073
00077
Event *
event(
const QString &UniqueStr);
00081
00085
Event::List rawEvents();
00090
Event::List rawEventsForDate(
const QDate &date,
bool sorted =
false );
00094
Event::List rawEventsForDate(
const QDateTime &qdt );
00099
Event::List rawEvents(
const QDate &start,
const QDate &end,
00100
bool inclusive =
false );
00101
00102
00103
00104
00105
00106
00107
00111
bool addTodo(
Todo *
todo );
00115
void deleteTodo(
Todo * );
00120
Todo *todo(
const QString &uid );
00124
Todo::List rawTodos();
00128
Todo::List todos(
const QDate &date );
00130
virtual bool addJournal(
Journal *);
00134
void deleteJournal(
Journal * );
00136
virtual Journal *
journal(
const QDate &);
00138
virtual Journal *journal(
const QString &UID);
00140
Journal::List journals();
00141
00143
Alarm::List alarms(
const QDateTime &from,
const QDateTime &to );
00144
00146
Alarm::List alarmsTo(
const QDateTime &to );
00147
00148
00152
void update(
IncidenceBase *incidence);
00153
00154
friend class ResourceIMAPConfig;
00155
00156
00157
bool doOpen();
00158
00159
00160
void setTimeZoneId(
const QString& tzid );
00161
00162
protected:
00164 virtual void incidenceUpdated(
IncidenceBase *i ) { update( i ); }
00167
protected slots:
00168
void unregisteredFromDCOP(
const QCString& );
00169
00170
private:
00171
void init();
00172
bool getIncidenceList( QStringList& lst,
const QString& type );
00173
bool connectKMailSignal(
const QCString&,
const QCString& ) const;
00174
00175
bool loadAllEvents();
00176
bool loadAllTasks();
00177
bool loadAllJournals();
00178
00179
bool connectToKMail() const;
00180
00181 KCal::
Incidence* parseIncidence( const QString& str );
00182
00183 QString mServer;
00184
ICalFormat mFormat;
00185
CalendarLocal mCalendar;
00186 DCOPClient* mDCOPClient;
00187
bool mSilent;
00188 QString mCurrentUID;
00189
00190 mutable KMailICalIface_stub* mKMailIcalIfaceStub;
00191 };
00192
00193 }
00194
00195 #endif