kpilot
vcal-conduitbase.hGo to the documentation of this file.00001 #ifndef _KPILOT_VCAL_CONDUITBASE_H
00002 #define _KPILOT_VCAL_CONDUITBASE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <qstring.h>
00034
00035 #include <libkcal/calendarlocal.h>
00036
00037 #include <plugin.h>
00038 #include <pilotRecord.h>
00039
00040 namespace KCal
00041 {
00042 class Calendar;
00043 class Incidence;
00044 }
00045
00046 class PilotSerialDatabase;
00047 class PilotLocalDatabase;
00048 class VCalConduitSettings;
00049
00050 class ConduitState;
00051
00052 class VCalConduitPrivateBase
00053 {
00054 protected:
00055 bool reading;
00056 KCal::Calendar *fCalendar;
00057 public:
00058 VCalConduitPrivateBase(KCal::Calendar *buddy) : fCalendar(buddy)
00059 {
00060 reading = false;
00061 };
00062
00063 virtual ~VCalConduitPrivateBase() { } ;
00064
00065 virtual int updateIncidences() = 0;
00066 virtual void addIncidence(KCal::Incidence*) = 0;
00067 virtual void removeIncidence(KCal::Incidence*) = 0;
00068 virtual KCal::Incidence *findIncidence(recordid_t) = 0;
00069 virtual KCal::Incidence *findIncidence(PilotRecordBase *tosearch) = 0;
00070 virtual KCal::Incidence *getNextIncidence() = 0;
00071 virtual KCal::Incidence *getNextModifiedIncidence() = 0;
00072 virtual int count()=0;
00073 } ;
00074
00075 class VCalConduitBase : public ConduitAction
00076 {
00077 Q_OBJECT
00078 public:
00079 VCalConduitBase(KPilotLink *,
00080 const char *name = 0L,
00081 const QStringList &args = QStringList());
00082 virtual ~VCalConduitBase();
00083
00084
00085
00086
00087 protected:
00088 KCal::Calendar *fCalendar;
00089 QString fCalendarFile;
00090 VCalConduitPrivateBase *fP;
00091 ConduitState *fState;
00092 bool hasNextRecord;
00093
00094 virtual const QString dbname() = 0;
00095 virtual const QString getTitle(PilotRecordBase *de) = 0;
00096 virtual void readConfig();
00097
00098 virtual bool exec();
00099
00100 protected slots:
00107 void slotProcess();
00108
00109 public:
00114 void setHasNextRecord( bool b )
00115 {
00116 hasNextRecord = b;
00117 }
00118
00124 void setState( ConduitState *s );
00125
00129 VCalConduitPrivateBase *privateBase() const
00130 {
00131 return fP;
00132 }
00133
00138 PilotRecord *readRecordByIndex( int index );
00139
00144 KCal::Incidence *incidenceFromRecord( PilotRecord *r );
00145
00146 virtual void preIncidence( KCal::Incidence* ) {};
00147
00148
00149 KCal::Calendar *calendar() const { return fCalendar; };
00150 QString calendarFile() const { return fCalendarFile; };
00151
00152 virtual VCalConduitSettings *config() = 0;
00153 virtual PilotDatabase *database() const { return fDatabase; };
00154 virtual PilotDatabase *localDatabase() const { return fLocalDatabase; };
00155
00156
00157 virtual void addPalmRecord( KCal::Incidence *e );
00158 virtual void changePalmRecord( KCal::Incidence *e, PilotRecord *s );
00159 virtual void deletePalmRecord( KCal::Incidence *e, PilotRecord *s );
00160
00161
00162 virtual KCal::Incidence* changeRecord( PilotRecord*, PilotRecord* );
00163 virtual KCal::Incidence* deleteRecord( PilotRecord*, PilotRecord* );
00164 virtual KCal::Incidence* addRecord( PilotRecord * );
00165
00166
00167
00168
00169 virtual void preSync();
00170 virtual void postSync();
00171 virtual void preRecord(PilotRecord*) {};
00172
00173 protected:
00174 virtual void updateIncidenceOnPalm(KCal::Incidence *e, PilotRecordBase *de);
00175
00176
00177
00178
00179
00180 virtual PilotRecord *recordFromIncidence(PilotRecordBase *de,
00181 const KCal::Incidence *e) = 0;
00182 virtual PilotRecordBase *newPilotEntry(PilotRecord *r) = 0;
00183
00184 virtual KCal::Incidence *newIncidence() = 0;
00185 virtual KCal::Incidence *incidenceFromRecord(KCal::Incidence *e,
00186 const PilotRecordBase *de) = 0;
00187
00188
00189
00190
00197 virtual int resolveConflict(KCal::Incidence *e, PilotRecordBase *de);
00198 virtual bool openCalendar();
00199 virtual VCalConduitPrivateBase *createPrivateCalendarData(KCal::Calendar *fCalendar) = 0;
00200 } ;
00201
00202 #endif
|