kitchensync Library API Documentation

KSync::SyncEntry Class Reference

An entry of a dataset which is to be synced. More...

#include <syncentry.h>

Inheritance diagram for KSync::SyncEntry:

KSync::OpieDesktopSyncEntry KSync::UnknownSyncEntry List of all members.

Public Types

typedef QPtrList< SyncEntryPtrList
enum  Equalness {
  Different = -1, Equal = 0, EqualButModifiedThis = 1, EqualButModifiedOther = 2,
  EqualButModifiedBoth = 3
}
enum  Status { Undefined = -1, Added = 0, Modified = 1, Removed = 2 }

Public Member Functions

 SyncEntry (Syncee *parent)
 SyncEntry (const SyncEntry &)
virtual QString type () const =0
virtual QString name ()=0
virtual QString id ()=0
virtual void setId (const QString &id)
virtual QString timestamp ()=0
virtual bool equals (SyncEntry *)=0
virtual int match (SyncEntry *entry)
virtual int compareTo (SyncEntry *entry)
virtual int state () const
virtual bool wasAdded () const
virtual bool wasModified () const
virtual bool wasRemoved () const
virtual void setState (int state=Undefined)
virtual void setSyncState (int state=Undefined)
virtual int syncState () const
virtual SyncEntryclone ()=0
void setSyncee (Syncee *)
Synceesyncee ()
virtual bool mergeWith (SyncEntry *)
void setDontSync (bool)
bool dontSync () const
virtual KPIM::DiffAlgo * diffAlgo (SyncEntry *, SyncEntry *)

Detailed Description

An entry of a dataset which is to be synced.

Author:
Cornelius Schumacher
See also:
Syncee, Syncer
The SyncEntry class represents the basic unit of syncing. It provides an interface for identifying and comparing entries, which has to be implemented by concrete subclasses. This makes it possible to operate with one synchronisation algorithm on different Syncees.

SyncEntry objects are collected by a Syncee objects.

Definition at line 48 of file syncentry.h.


Constructor & Destructor Documentation

SyncEntry::SyncEntry Syncee parent  ) 
 

This is the basic constructor of a SyncEntry.

Every SyncEntry should have a parent Syncee where it belongs to.

Definition at line 29 of file syncentry.cpp.


Member Function Documentation

virtual QString KSync::SyncEntry::type  )  const [pure virtual]
 

Return a string describing the type of the entry.

Implemented in KSync::OpieDesktopSyncEntry, and KSync::UnknownSyncEntry.

virtual QString KSync::SyncEntry::name  )  [pure virtual]
 

Return a string describing this entry.

This is presented to the user as identifier for the entry, when user interaction is required.

Implemented in KSync::OpieDesktopSyncEntry, and KSync::UnknownSyncEntry.

Referenced by KSync::SyncUi::confirmDelete(), KSync::SyncUi::deconflict(), and KSync::Syncee::saveLog().

virtual QString KSync::SyncEntry::id  )  [pure virtual]
 

Return a unique id.

This is used to uniquely identify the entry. Two entries having the same id are considered to be two variants of the same entry. No two entries of the same KSyncee data set must have the same id.

Implemented in KSync::OpieDesktopSyncEntry, and KSync::UnknownSyncEntry.

Referenced by KSync::Syncee::findEntry(), KSync::Syncee::hasChanged(), KSync::SyncUi::informBothDeleted(), and KSync::Syncee::saveLog().

void SyncEntry::setId const QString id  )  [virtual]
 

Set unique id.

Definition at line 106 of file syncentry.cpp.

virtual QString KSync::SyncEntry::timestamp  )  [pure virtual]
 

Return a time stamp representing the time of the last change.

This is only used to compare, if an entry has changed or not. It is not used to define an order of changes. If an entry has been copied from one KSyncee data set to another KSyncee data set, the timestamp has to be the same on both entries. If the user has changed the entry in one data set the timestamp has to be different.

Return QString::null, if there is no timestamp available. This means that the user has to manually select which entry is the new one.

Implemented in KSync::OpieDesktopSyncEntry, and KSync::UnknownSyncEntry.

Referenced by KSync::Syncee::hasChanged(), and KSync::Syncee::saveLog().

virtual bool KSync::SyncEntry::equals SyncEntry  )  [pure virtual]
 

Return, if the two entries are equal.

Two entries are considered to be equal, if they contain exactly the same information, including the same id and timestamp.

Implemented in KSync::OpieDesktopSyncEntry, and KSync::UnknownSyncEntry.

int SyncEntry::match SyncEntry entry  )  [virtual]
 

For future versions match should try to match one SyncEntry with another.

Parameters:
entry The entry to be matched
Returns:
Return -1 if entry is from a different type than this entry or the percentage of equality. Or -2 if not implemented

Definition at line 54 of file syncentry.cpp.

int SyncEntry::compareTo SyncEntry entry  )  [virtual]
 

Compares one SyncEntry to another.

This functions differs from equals and match in some ways. it returns 0 if both are equal, -1 if not equal at all, or the state of equalnes Equal or EqualModifiedThis, EqualModifiedOther, EqualModifiedBoth -2 if not implemented

Definition at line 59 of file syncentry.cpp.

int SyncEntry::state  )  const [virtual]
 

The status of this SyncEntry either Undefined, Added, Modified or Removed.

Definition at line 64 of file syncentry.cpp.

Referenced by KSync::Syncee::modificationState().

bool SyncEntry::wasAdded  )  const [virtual]
 

Convience functions for the state of an Entry.

Definition at line 69 of file syncentry.cpp.

bool SyncEntry::wasModified  )  const [virtual]
 

Convience function for the state of an Entry modified.

Definition at line 74 of file syncentry.cpp.

bool SyncEntry::wasRemoved  )  const [virtual]
 

Convience function for the state of an Entry.

Definition at line 79 of file syncentry.cpp.

void SyncEntry::setState int  state = Undefined  )  [virtual]
 

Sets the stae of this SyncEntry.

Definition at line 84 of file syncentry.cpp.

void SyncEntry::setSyncState int  state = Undefined  )  [virtual]
 

Set sync state (e.g.

Added, Modified) of SyncEntry.

Definition at line 90 of file syncentry.cpp.

int SyncEntry::syncState  )  const [virtual]
 

Returns the sync state of this entry.

Definition at line 95 of file syncentry.cpp.

virtual SyncEntry* KSync::SyncEntry::clone  )  [pure virtual]
 

Creates an exact copy of the this SyncEntry deleting the original is save.

Implemented in KSync::OpieDesktopSyncEntry, and KSync::UnknownSyncEntry.

void SyncEntry::setSyncee Syncee  ) 
 

Set the Syncee data set, the entry belongs to.

Definition at line 49 of file syncentry.cpp.

Syncee * SyncEntry::syncee  ) 
 

Return the Syncee data set, the entry belongs to.

Definition at line 100 of file syncentry.cpp.

Referenced by KSync::SyncUi::confirmDelete().

bool SyncEntry::mergeWith SyncEntry  )  [virtual]
 

Merges two sync entries where ever one entry does not support one specific attribute.

Definition at line 110 of file syncentry.cpp.

void SyncEntry::setDontSync bool   ) 
 

Set if the entry should be synced or not.

Definition at line 115 of file syncentry.cpp.

KPIM::DiffAlgo * SyncEntry::diffAlgo SyncEntry ,
SyncEntry
[virtual]
 

Returns the diffing algorithm which is used to present the differences between the two SyncEntries when a conflict occurs.

Definition at line 125 of file syncentry.cpp.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kitchensync Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 21 19:46:33 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003