knotes-conduit.h
00001
00002
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 #ifndef _KPILOT_KNOTES_CONDUIT_H
00031 #define _KPILOT_KNOTES_CONDUIT_H
00032
00033 #ifndef _KPILOT_BASECONDUIT_H
00034 #include "baseConduit.h"
00035 #endif
00036
00037
00038 class PilotRecord;
00039 class PilotMemo;
00040
00041 #ifndef QSTRING_H
00042 #include <qstring.h>
00043 #endif
00044
00045 #ifndef QMAP_H
00046 #include <qmap.h>
00047 #endif
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 class NotesSettings
00060 {
00061 public:
00062
00063
00064
00065 NotesSettings() {} ;
00066 NotesSettings(const QString& name,
00067 const QString& configPath,
00068 const QString& dataPath,
00069 unsigned long pilotID) :
00070 nN(name),
00071 cP(configPath),dP(dataPath),id(pilotID),
00072 checksum(0L),csValid(false) {} ;
00073
00074 NotesSettings(const QString &configPath,
00075 const QString ¬esdir,
00076 KConfig& c);
00077
00078 const QString& name() const { return nN; } ;
00079 const QString& configPath() const { return cP; } ;
00080 const QString& dataPath() const { return dP; } ;
00081 unsigned long pilotID() const { return id; } ;
00082
00083 bool isNew() const { return id == 0L ; } ;
00084 void setId(unsigned long i) { id=i; } ;
00085
00086 QString checkSum() const { return checksum; } ;
00087 bool isCheckSumValid() const { return csValid; } ;
00094 bool isChanged() const
00095 {
00096 QString newCS = computeCheckSum();
00097 return !csValid || (newCS != checksum) ;
00098 }
00099
00100 QString updateCheckSum()
00101 {
00102 checksum=computeCheckSum();
00103 csValid = !checksum.isNull();
00104 return checksum;
00105 } ;
00106 QString computeCheckSum() const;
00107
00114 int readNotesData(char *text);
00115
00116 private:
00117 QString nN,cP,dP;
00118 unsigned long id;
00127 QString checksum;
00128 bool csValid;
00129 } ;
00130
00131 typedef QMap<QString,NotesSettings> NotesMap;
00132
00133 class KNotesConduit : public BaseConduit
00134 {
00135 public:
00136 KNotesConduit(eConduitMode mode);
00137 virtual ~KNotesConduit();
00138
00139 virtual void doSync();
00140 virtual QWidget* aboutAndSetup();
00141
00142 virtual const char* dbInfo() ;
00143 virtual void doTest();
00144
00145 protected:
00146 int notesToPilot(NotesMap&);
00147 int pilotToNotes(NotesMap&);
00148
00153 bool addNewNote(NotesSettings&);
00154 bool changeNote(NotesSettings&);
00155
00156 bool changeMemo(NotesMap&,NotesMap::Iterator,PilotMemo *);
00157 bool newMemo(NotesMap&,unsigned long id,PilotMemo *);
00164 bool deleteNote(NotesMap&,NotesMap::Iterator *,unsigned long);
00165
00166 private:
00172 void readConfig();
00173
00180 bool fDeleteNoteForMemo;
00181 };
00182
00183 #endif
This file is part of the documentation for kdelibs Version 3.1.4.