Organizer-conduit.h
00001 #ifndef _OrganizerCONDUIT_H 00002 #define _OrganizerCONDUIT_H 00003 00004 /* Organizer-conduit.h KPilot 00005 ** 00006 ** Copyright (C) 1998-2001 Dan Pilone 00007 ** Copyright (C) 1998-2000 Preston Brown 00008 ** Copyright (C) 1998 Herwin-Jan Steehouwer 00009 ** Copyright (C) 1998 Reinhold Kainhofer 00010 ** 00011 ** This file is part of the Organizer conduit, a conduit for KPilot that 00012 ** synchronises the Pilot's Organizer application with the outside world, 00013 ** which currently means KOrganizer. 00014 */ 00015 00016 /* 00017 ** This program is free software; you can redistribute it and/or modify 00018 ** it under the terms of the GNU General Public License as published by 00019 ** the Free Software Foundation; either version 2 of the License, or 00020 ** (at your option) any later version. 00021 ** 00022 ** This program is distributed in the hope that it will be useful, 00023 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 ** GNU General Public License for more details. 00026 ** 00027 ** You should have received a copy of the GNU General Public License 00028 ** along with this program in a file called COPYING; if not, write to 00029 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00030 ** MA 02111-1307, USA. 00031 */ 00032 00033 /* 00034 ** Bug reports and questions can be sent to groot@kde.org 00035 */ 00036 00037 #include "MultiDB-conduit.h" 00038 #ifndef _KPILOT_PILOTOrganizerENTRY_H 00039 #include "pilotOrganizerEntry.h" 00040 #endif 00041 #include <pilotSerialDatabase.h> 00042 #include <pilotLocalDatabase.h> 00043 #include <calendar.h> 00044 00045 #define MAX_HIER_LEVEL 10 00046 00047 using namespace KCal; 00048 #define FLG_SORTED 1 00049 #define FLG_NUMBERED 2 00050 00051 class OrganizerConduit : public MultiDBConduit { 00052 Q_OBJECT 00053 public: 00054 OrganizerConduit(KPilotDeviceLink *, const char *n=0L, const QStringList &l=QStringList(), SyncTypeList_t *tps=NULL); 00055 virtual ~OrganizerConduit(); 00056 virtual unsigned long flags() const { return FLG_SORTED; } 00057 00058 protected: 00059 virtual void updateLocalEntry(PilotRecord *rec, bool force=false); 00060 00061 // TODEL virtual bool GetSyncType(DBInfo dbinfo, DBSyncInfo*syncinfo); 00062 virtual PilotOrganizerEntry*createOrganizerEntry(PilotRecord *rec=NULL)=0; 00063 virtual PilotOrganizerEntry*createOrganizerEntry(KCal::Todo *todo=NULL)=0; 00064 // let child classes read and set fields from the todo to the palm entry 00065 virtual void getCustomFields(Todo*, PilotOrganizerEntry*) {} ; 00066 virtual void setCustomFields(Todo*, PilotOrganizerEntry*) {} ; 00067 00068 virtual const QString getSyncTypeEntry() { return "SyncAction";}; 00069 virtual const QString getSyncFileEntry() { return "SyncFile";}; 00070 virtual const QString settingsFileList() { return "Databases";}; 00071 // merging the databases: 00072 virtual void insertRecordToPC(int pos, PilotRecord*rec); 00073 virtual void insertRecordToPalm(int pos, KCal::Todo*todo); 00074 virtual void updateRecords(int palmpos, PilotRecord*rec, int pcpos, KCal::Todo*todo); 00075 virtual void movePCRecord(int frompos, int topos); 00076 virtual void movePalmRecord(int frompos, int topos); 00077 virtual bool preSyncAction(DBSyncInfo*dbinfo); 00078 virtual bool exec(); 00079 00080 00081 protected slots: 00082 // TODEL virtual void syncNextDB(); 00083 virtual void syncNextRecord(); 00084 virtual void cleanup(); 00085 virtual void cleanupDB(); 00086 00087 00088 protected: 00089 KCal::Calendar *fCalendar; 00090 QString fCalendarFile; 00091 // these are used to count the current position on the palm and 00092 // in the PC database when merging the two together. 00093 int PCix, Palmix; 00094 // inserted determines if any entries have been moved/inserted before the current record in the palm db 00095 bool inserted; 00096 QString timezone; 00097 00098 private: 00099 class VCalPrivate; 00100 VCalPrivate *fP; 00101 Todo* levelparent[MAX_HIER_LEVEL]; 00102 int hierlevel; 00103 unsigned long previd; 00104 }; 00105 00106 00107 // $Log: Organizer-conduit.h,v $ 00108 // Revision 1.3.4.1 2003/03/12 23:31:10 adridg 00109 // CVS_SILENT: FSF address change 00110 // 00111 // Revision 1.3 2002/08/23 22:59:29 kainhofe 00112 // Implemented Adriaan's change 'signal: void exec()' -> 'bool exec()' for "my" conduits 00113 // 00114 // Revision 1.2 2002/07/05 00:15:22 kainhofe 00115 // Added KPilotDeviceLink::tickle(), Changelog update, compile fixes 00116 // 00117 // Revision 1.1 2002/04/07 12:09:43 kainhofe 00118 // Initial checkin of the conduit. The gui works mostly, but syncing crashes KPilot... 00119 // 00120 // Revision 1.1 2002/04/07 01:03:52 reinhold 00121 // the list of possible actions is now created dynamically 00122 // 00123 // Revision 1.11 2002/04/06 00:51:08 reinhold 00124 // Finally the conduit compiles again... Still have a lot of TODOS 00125 // 00126 // Revision 1.10 2002/04/05 21:17:00 reinhold 00127 // *** empty log message *** 00128 // 00129 // Revision 1.9 2002/04/01 09:22:11 reinhold 00130 // Implemented the syncNextRecord routine 00131 // 00132 // Revision 1.8 2002/03/28 13:47:54 reinhold 00133 // Added the list of synctypes, aboutbox is now directly passed on to the setup dlg (instead of being a static var) 00134 // 00135 // Revision 1.6 2002/03/23 21:46:42 reinhold 00136 // config dlg works, but the last changes crash the plugin itself 00137 // 00138 // Revision 1.5 2002/03/23 18:21:14 reinhold 00139 // Cleaned up the structure. Works with QTimer instead of loops. 00140 // 00141 // Revision 1.4 2002/03/15 20:43:17 reinhold 00142 // Fixed the crash on loading (member function not defined)... 00143 // 00144 // Revision 1.3 2002/03/10 23:58:32 reinhold 00145 // Made the conduit compile... 00146 // 00147 // Revision 1.2 2002/03/10 16:06:43 reinhold 00148 // Cleaned up the class hierarchy, implemented some more features (should be quite finished now...) 00149 // 00150 // Revision 1.1.1.1 2002/03/09 15:38:45 reinhold 00151 // Initial checin of the project manager / List manager conduit. 00152 // 00153 // 00154 // 00155 #endif