kpilot
doc-conduit.hGo to the documentation of this file.00001 #ifndef _doc_CONDUIT_H
00002 #define _doc_CONDUIT_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 #include <plugin.h>
00032
00033 class docSyncInfo;
00034 typedef QValueList<docSyncInfo> syncInfoList;
00035
00036 typedef enum eSyncDirectionEnum {
00037 eSyncNone,
00038
00039 eSyncPDAToPC,
00040 eSyncPCToPDA,
00041 eSyncDelete,
00042 eSyncConflict
00043 };
00044 typedef enum eTextStatus {
00045 eStatNone=0,
00046 eStatNew=1,
00047 eStatChanged=2,
00048 eStatBookmarksChanged=4,
00049 eStatDeleted=8,
00050 eStatDoesntExist=16
00051 };
00052
00053
00054 QString dirToString(eSyncDirectionEnum dir);
00055
00056 class DOCConduit:public ConduitAction {
00057 Q_OBJECT
00058 public:
00059 eSyncDirectionEnum eSyncDirection;
00060
00061 public:
00062 DOCConduit(KPilotLink * o,
00063 const char *n = 0L, const QStringList & a = QStringList());
00064 virtual ~ DOCConduit();
00065
00066 bool encode(QStringList fileName, PilotDatabase * db);
00067 bool decode(PilotDatabase * db, QString fileName);
00068 virtual bool exec();
00069 protected:
00070 virtual bool isCorrectDBTypeCreator(DBInfo dbinfo);
00071 virtual const unsigned long dbtype();
00072 virtual const unsigned long dbcreator();
00073
00074 public slots:
00077 void syncNextDB();
00078 void syncNextTXT();
00079 void checkPDBFiles();
00080 void checkDeletedDocs();
00081 void resolve();
00082 void syncDatabases();
00083 void cleanup();
00084
00085 private:
00090 void readConfig();
00091
00095 bool needsSync(docSyncInfo &sinfo);
00100 PilotDatabase *preSyncAction(docSyncInfo &sinfo) const;
00101
00102 bool doSync(docSyncInfo &sinfo);
00107 bool postSyncAction(PilotDatabase * dbinfo, docSyncInfo &sinfo, bool res = true);
00108
00109 bool pcTextChanged(QString txtfn);
00110 bool hhTextChanged(PilotDatabase*docdb);
00111
00115 PilotDatabase *openDOCDatabase(const QString &dbname);
00116
00117 QString constructPDBFileName(QString name);
00118 QString constructTXTFileName(QString name);
00119
00120 eSyncDirectionEnum eConflictResolution;
00121 int fTXTBookmarks, fPDBBookmarks;
00122 QStringList fDBListSynced;
00123 QStringList fDBNames;
00124 syncInfoList fSyncInfoList;
00125 syncInfoList::Iterator fSyncInfoListIterator;
00126 long int dbnr;
00127
00128 QStringList docnames;
00129 QStringList::Iterator dociterator;
00130 };
00131
00132 class docSyncInfo
00133 {
00134 public:
00135 docSyncInfo(QString hhDB=QString(), QString txtfn=QString(), QString pdbfn=QString(), eSyncDirectionEnum dir=eSyncNone)
00136 {
00137 handheldDB=hhDB;
00138 txtfilename=txtfn;
00139 pdbfilename=pdbfn;
00140 direction=dir;
00141 fPCStatus=eStatNone;
00142 fPalmStatus=eStatNone;
00143 };
00144 ~docSyncInfo(){};
00145 QString handheldDB, txtfilename, pdbfilename;
00146 DBInfo dbinfo;
00147 eSyncDirectionEnum direction;
00148 eTextStatus fPCStatus, fPalmStatus;
00149 };
00150
00151
00152 #endif
|