kitchensync
syncentry.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KSYNC_SYNCENTRY_H
00023 #define KSYNC_SYNCENTRY_H
00024
00025 #include <qstring.h>
00026 #include <qptrlist.h>
00027 #include <kdepimmacros.h>
00028
00029 namespace KPIM {
00030 class DiffAlgo;
00031 }
00032
00033 namespace KSync {
00034 class Merger;
00035 class Syncee;
00036
00049 class KDE_EXPORT SyncEntry
00050 {
00051 public:
00052 typedef QPtrList<SyncEntry> PtrList;
00053
00054 enum Equalness { Different = -1, Equal = 0, EqualButModifiedThis = 1,
00055 EqualButModifiedOther = 2, EqualButModifiedBoth = 3 };
00056
00057 enum Status { Undefined = -1, Added = 0, Modified=1, Removed = 2 };
00058
00063 SyncEntry( Syncee *parent );
00064 SyncEntry( const SyncEntry & );
00065 virtual ~SyncEntry();
00066
00070 QString type() const;
00071
00076 virtual QString name() = 0;
00077
00084 virtual QString id() = 0;
00085
00086
00091 virtual void setId( const QString& id );
00092
00104 virtual QString timestamp() = 0;
00105
00111 virtual bool equals( SyncEntry * ) = 0;
00112
00121 virtual int match( SyncEntry *entry );
00122
00131 virtual int compareTo( SyncEntry *entry );
00132
00137 virtual int state() const;
00138
00139
00140 void setSyncState(int);
00141 int syncState()const;
00142
00146 virtual bool wasAdded() const;
00147
00152 virtual bool wasModified() const;
00153
00157 virtual bool wasRemoved() const;
00158
00162 virtual void setState( int state = Undefined );
00163
00164
00172 virtual SyncEntry *clone() = 0;
00173
00177 void setSyncee( Syncee * );
00178
00182 Syncee *syncee()const;
00183
00187 void setDontSync( bool );
00188
00189 bool dontSync() const;
00190
00191 bool mergeWith(SyncEntry *other);
00192
00197 virtual KPIM::DiffAlgo* diffAlgo( SyncEntry*, SyncEntry* );
00198
00199 protected:
00200 void setType(const QString&);
00201
00202 protected:
00203 Merger* merger()const;
00204
00205 private:
00206 int mState;
00207 int mSyncState;
00208 Syncee *mSyncee;
00209 bool mDontSync : 1;
00210 QString mType;
00211
00212 class SyncEntryPrivate;
00213 SyncEntryPrivate *d;
00214 };
00215
00216 }
00217
00218 #endif
|