kpilot

todo-conduit.h

Go to the documentation of this file.
00001 #ifndef _KPILOT_TODO_CONDUIT_H
00002 #define _KPILOT_TODO_CONDUIT_H
00003 /* todo-conduit.h                       KPilot
00004 **
00005 ** Copyright (C) 2002-2003 Reinhold Kainhofer
00006 ** Copyright (C) 1998-2001 Dan Pilone
00007 ** Copyright (C) 1998-2000 Preston Brown <pbrown@kde.org>
00008 ** Copyright (C) 1998 Herwin-Jan Steehouwer
00009 **
00010 ** This file is part of the todo conduit, a conduit for KPilot that
00011 ** synchronises the Pilot's todo application with the outside world,
00012 ** which currently means KOrganizer.
00013 */
00014 
00015 /*
00016 ** This program is free software; you can redistribute it and/or modify
00017 ** it under the terms of the GNU General Public License as published by
00018 ** the Free Software Foundation; either version 2 of the License, or
00019 ** (at your option) any later version.
00020 **
00021 ** This program is distributed in the hope that it will be useful,
00022 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00024 ** GNU General Public License for more details.
00025 **
00026 ** You should have received a copy of the GNU General Public License
00027 ** along with this program in a file called COPYING; if not, write to
00028 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00029 ** MA 02110-1301, USA.
00030 */
00031 
00032 /*
00033 ** Bug reports and questions can be sent to kde-pim@kde.org
00034 */
00035 
00036 #include <libkcal/todo.h>
00037 #include <pilotTodoEntry.h>
00038 #include "vcal-conduitbase.h"
00039 
00040 class PilotSerialDatabase;
00041 class PilotLocalDatabase;
00042 
00043 class TodoConduitPrivate : public VCalConduitPrivateBase
00044 {
00045 public:
00046     TodoConduitPrivate(KCal::Calendar *buddy);
00047     virtual ~TodoConduitPrivate() {};
00048 
00049     KCal::Todo::List fAllTodos;
00050     KCal::Todo::List::ConstIterator fAllTodosIterator;
00051 
00052     virtual int updateIncidences();
00053     virtual void addIncidence(KCal::Incidence*);
00054     virtual void removeIncidence(KCal::Incidence *);
00055     virtual KCal::Incidence *findIncidence(recordid_t);
00056     virtual KCal::Incidence *findIncidence(PilotRecordBase *tosearch);
00057     virtual KCal::Incidence *getNextIncidence();
00058     virtual KCal::Incidence *getNextModifiedIncidence();
00059     virtual int count() {return fAllTodos.count();};
00060 } ;
00061 
00062 
00063 
00064 class TodoConduit : public VCalConduitBase
00065 {
00066 Q_OBJECT
00067 public:
00068     TodoConduit(KPilotLink *,
00069         const char *name=0L,
00070         const QStringList &args = QStringList());
00071     virtual ~TodoConduit();
00072 
00073 protected:
00074     virtual const QString getTitle(PilotRecordBase *de);
00075 
00076     virtual const QString dbname() { return CSL1("ToDoDB"); };
00077     virtual void preSync();
00078     virtual VCalConduitPrivateBase *createPrivateCalendarData(KCal::Calendar *fCalendar)
00079     {
00080         return new TodoConduitPrivate(fCalendar);
00081     };
00082 
00083     virtual void readConfig();
00084     void _getAppInfo();
00085     void _setAppInfo();
00086     virtual void postSync();
00087 
00088     virtual PilotRecordBase *newPilotEntry(PilotRecord*r)
00089     {
00090         return new PilotTodoEntry(r);
00091     };
00092     virtual KCal::Incidence*newIncidence() { return new KCal::Todo; };
00093 
00094     virtual void preRecord(PilotRecord*r);
00095     virtual VCalConduitSettings *config();
00096 public:
00097     static VCalConduitSettings *theConfig();
00098 
00099 protected:
00100 
00101     virtual PilotRecord *recordFromIncidence(PilotRecordBase *de, const KCal::Incidence *e);
00102     virtual KCal::Incidence *incidenceFromRecord(KCal::Incidence *e, const PilotRecordBase *de);
00103 
00104     PilotToDoInfo *fTodoAppInfo;
00105     bool categoriesSynced;
00106 } ;
00107 
00108 #endif