kpilot Library API Documentation

vcal-conduitbase.h

00001 #ifndef _KPILOT_VCAL_CONDUITBASE_H
00002 #define _KPILOT_VCAL_CONDUITBASE_H
00003 /* vcal-conduit.h                       KPilot
00004 **
00005 ** Copyright (C) 2001 by Dan Pilone
00006 **
00007 ** This file defines the vcal-conduit plugin.
00008 */
00009 
00010 /*
00011 ** This program is free software; you can redistribute it and/or modify
00012 ** it under the terms of the GNU General Public License as published by
00013 ** the Free Software Foundation; either version 2 of the License, or
00014 ** (at your option) any later version.
00015 **
00016 ** This program is distributed in the hope that it will be useful,
00017 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00019 ** GNU General Public License for more details.
00020 **
00021 ** You should have received a copy of the GNU General Public License
00022 ** along with this program in a file called COPYING; if not, write to
00023 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00024 ** MA 02111-1307, USA.
00025 */
00026 
00027 /*
00028 ** Bug reports and questions can be sent to kde-pim@kde.org
00029 */
00030 
00031 #include <plugin.h>
00032 
00033 
00034 #include <options.h>
00035 //#include <unistd.h>
00036 
00037 //#include <qdatetime.h>
00038 
00039 
00040 
00041 namespace KCal
00042 {
00043 class CalendarLocal;
00044 // class Event;
00045 class Incidence;
00046 } ;
00047 
00048 class PilotRecord;
00049 class PilotSerialDatabase;
00050 class PilotLocalDatabase;
00051 //class PilotDateEntry;
00052 class PilotAppCategory;
00053 
00054 QDateTime readTm(const struct tm &t);
00055 struct tm writeTm(const QDateTime &dt);
00056 struct tm writeTm(const QDate &dt);
00057 
00058 
00059 class VCalConduitPrivateBase
00060 {
00061 protected:
00062         bool reading;
00063         KCal::CalendarLocal *fCalendar;
00064 public:
00065         VCalConduitPrivateBase(KCal::CalendarLocal *buddy):fCalendar(buddy) { reading=false;};
00066 
00067         virtual int updateIncidences()=0;
00068         virtual void addIncidence(KCal::Incidence*)=0;
00069         virtual void removeIncidence(KCal::Incidence *)=0;
00070         virtual KCal::Incidence *findIncidence(recordid_t)=0;
00071         virtual KCal::Incidence *findIncidence(PilotAppCategory*tosearch)=0;
00072         virtual KCal::Incidence *getNextIncidence()=0;
00073         virtual KCal::Incidence *getNextModifiedIncidence()=0;
00074         virtual int count()=0;
00075 } ;
00076 
00077 
00078 
00079 class VCalConduitBase : public ConduitAction
00080 {
00081 Q_OBJECT;
00082 public:
00083         VCalConduitBase(KPilotDeviceLink *,
00084                 const char *name=0L,
00085                 const QStringList &args = QStringList());
00086         virtual ~VCalConduitBase();
00087 
00088 protected:
00089         virtual bool exec();
00090 
00091 protected slots:
00095         void syncPalmRecToPC();
00099         void syncPCRecToPalm();
00100         void syncDeletedIncidence();
00101         void cleanup();
00102 
00103         
00104 protected:
00105 
00106         virtual int resolveConflict(KCal::Incidence*e, PilotAppCategory*de);
00107 
00108         // add, change or delete events from the calendar
00109         virtual KCal::Incidence* addRecord(PilotRecord *);
00110         virtual KCal::Incidence* changeRecord(PilotRecord *,PilotRecord *);
00111         virtual KCal::Incidence* deleteRecord(PilotRecord *,PilotRecord *);
00112 
00113         // add, change or delete records from the palm
00114         virtual void addPalmRecord(KCal::Incidence*e);
00115         virtual void changePalmRecord(KCal::Incidence*e, PilotRecord*s);
00116         virtual void deletePalmRecord(KCal::Incidence*e, PilotRecord*s);
00117 
00118         virtual void updateIncidenceOnPalm(KCal::Incidence*e, PilotAppCategory*de);
00119         
00120         virtual void readConfig();
00121         virtual bool openCalendar();
00122 
00123         // THESE NEED TO BE IMPLEMENTED BY CHILD CLASSES!!!!
00124         
00125         // create events from Palm records or vice versa
00126         virtual PilotRecord*recordFromIncidence(PilotAppCategory*de, const KCal::Incidence*e)=0;
00127         virtual KCal::Incidence *incidenceFromRecord(KCal::Incidence *e, const PilotAppCategory *de)=0;
00128         
00129         virtual PilotAppCategory*newPilotEntry(PilotRecord*r)=0;
00130         virtual KCal::Incidence*newIncidence()=0;
00131 
00132 
00133         // general settings, implemented by child classes for the conduits
00134         virtual const QString configGroup()=0;
00135         virtual const QString dbname()=0;
00136         
00137         virtual const QString getTitle(PilotAppCategory*de)=0;
00138 
00139         // THESE *CAN* BE IMPLEMTED BY CHILD CLASSES
00140         // execute something at the beginning or end of the sync.
00141         virtual void preSync(){};
00142         virtual void postSync();
00143         virtual void preRecord(PilotRecord*){};
00144         virtual void preIncidence(KCal::Incidence *){};
00145 
00146         virtual void doTest() {};
00147 
00148 protected:
00149         KCal::CalendarLocal *fCalendar;
00150 
00151         QString fCalendarFile;
00152         int syncAction, nextSyncAction, conflictResolution;
00153         bool archive;
00154         bool fFirstTime, fFullSync;
00155         int pilotindex;
00156 
00157 protected:
00158 //      class VCalPrivateBase;
00159         VCalConduitPrivateBase *fP;
00160    virtual VCalConduitPrivateBase* newVCalPrivate(KCal::CalendarLocal *fCalendar)=0;
00161 } ;
00162 
00163 #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:15 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001