kpilot/lib

recordConduit.h

Go to the documentation of this file.
00001 #ifndef _KPILOT_RECORDCONDUIT_H
00002 #define _KPILOT_RECORDCONDUIT_H
00003 /* record-conduit.h                           KPilot
00004 **
00005 ** Copyright (C) 2005 by Adriaan de Groot
00006 **
00007 */
00008 
00009 /*
00010 ** This program is free software; you can redistribute it and/or modify
00011 ** it under the terms of the GNU General Public License as published by
00012 ** the Free Software Foundation; either version 2 of the License, or
00013 ** (at your option) any later version.
00014 **
00015 ** This program is distributed in the hope that it will be useful,
00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00018 ** GNU General Public License for more details.
00019 **
00020 ** You should have received a copy of the GNU General Public License
00021 ** along with this program in a file called COPYING; if not, write to
00022 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00023 ** MA 02110-1301, USA.
00024 */
00025 
00026 /*
00027 ** Bug reports and questions can be sent to kde-pim@kde.org
00028 */
00029 
00030 #include <qtimer.h>
00031 #include <klocale.h>
00032 
00033 #include "plugin.h"
00034 #include "pilotAppCategory.h"
00035 #include "pilotDatabase.h"
00036 
00037 
00054 class RecordConduitBase : public ConduitAction
00055 {
00056 Q_OBJECT
00057 public:
00060     RecordConduitBase(KPilotDeviceLink *o,
00061         const char *n,
00062         const QStringList a = QStringList()) :
00063         ConduitAction(o,n,a),
00064         fTimer(0L)
00065     {
00066     } ;
00068     virtual ~RecordConduitBase()
00069     {
00070         // delete fTimer; // Timer is a child object
00071     } ;
00072 
00078     enum SyncProgress { NotDone=0, Done=1, Error=2 } ;
00079 
00081     static QString name(SyncProgress s);
00082 
00084     enum States { Initialize, PalmToPC, PCToPalm, Cleanup } ;
00085 
00086     static QString name(States s);
00087 
00088 protected:
00093     virtual SyncProgress loadPC() = 0;
00094 
00101     virtual SyncProgress palmRecToPC() = 0;
00102 
00109     virtual SyncProgress pcRecToPalm() = 0;
00110 
00117     virtual SyncProgress cleanup() = 0;
00118 
00119 protected slots:
00123     void process();
00124 
00125 protected:
00126     virtual bool exec();
00127 
00128 private:
00130     QTimer *fTimer;
00131 
00132     States fState;
00133 
00134     RecordIDList fIDList;
00135     RecordIDList::Iterator fIDListIterator;
00136 
00137     QString fDBName;
00138 } ;
00139 
00140 template <class PCEntry, class PCContainer, class HHEntry, class HHAppInfo, class Syncer>
00141 class RecordConduit : public RecordConduitBase
00142 {
00143 public:
00145     RecordConduit(
00146         KPilotDeviceLink *o ,
00147         const char *n ,
00148         const QStringList a = QStringList() ) :
00149         RecordConduitBase(o,n,a)
00150     {
00151     } ;
00152     virtual ~RecordConduit()
00153     {
00154     } ;
00155 
00156     virtual SyncProgress loadPC()
00157     {
00158         return Done;
00159     } ;
00160 
00161     virtual SyncProgress palmRecToPC()
00162     {
00163         return Done;
00164     }
00165 
00166     virtual SyncProgress pcRecToPalm()
00167     {
00168         return Done;
00169     }
00170 
00171     virtual SyncProgress cleanup()
00172     {
00173         return Done;
00174     }
00175 } ;
00176 
00177 
00178 #endif
00179 
KDE Home | KDE Accessibility Home | Description of Access Keys