kitchensync Library API Documentation

KSync::Syncee Class Reference

A data set to be synced. More...

#include <syncee.h>

Inheritance diagram for KSync::Syncee:

KSync::AddressBookSyncee KSync::BookmarkSyncee KSync::CalendarSyncee List of all members.

Public Types

enum  SyncMode { MetaLess = 0, MetaMode = 2 }

Public Member Functions

 Syncee (uint supportSize=0)
virtual void reset ()
virtual SyncEntryfirstEntry ()=0
virtual SyncEntrynextEntry ()=0
virtual QString type () const
virtual SyncEntryfindEntry (const QString &id)
virtual void addEntry (SyncEntry *)=0
virtual void removeEntry (SyncEntry *)=0
void replaceEntry (SyncEntry *oldEntry, SyncEntry *newEntry)
void setIdentifier (const QString &identifier)
QString identifier ()
virtual bool isValid ()
QString statusLogName ()
bool loadLog ()
bool saveLog ()
bool hasChanged (SyncEntry *)
virtual int modificationState (SyncEntry *entry) const
virtual int syncMode () const
virtual void setSyncMode (int mode=MetaLess)
virtual void setFirstSync (bool firstSync=true)
virtual bool firstSync () const
virtual SyncEntry::PtrList added ()
virtual SyncEntry::PtrList modified ()
virtual SyncEntry::PtrList removed ()
void insertId (const QString &type, const QString &konnectorId, const QString &kdeId)
virtual QString newId () const
Kontainer::ValueList ids (const QString &type) const
QMap< QString, Kontainer::ValueListids () const
virtual void setSupports (const QBitArray &)
virtual QBitArray bitArray () const
void setSource (const QString &src)
QString source () const
bool isSupported (uint Attribute) const
virtual bool trustIdsOnFirstSync () const
virtual bool writeBackup (const QString &filename)=0
virtual bool restoreBackup (const QString &filename)=0

Detailed Description

A data set to be synced.

Author:
Cornelius Schumacher, zecke
See also:
SyncEntry, Syncer
This class represents a data set of SyncEntries. During a syncing process, two or more Syncees are synced. After syncing they are equal, that means they should contain the same set of SyncEntries. Choices by the user can lead to deviations from complete equality.

The Syncee class provides an interface, which has to be implemented by concrete subclasses.

Further a Syncee can store a BitMap on what a 'Filler' of the Syncee supports. For example Device B got a todolist but has only 3 Attributes. Attribute 1: Description Attribute 2: Completed Attribute 3: DueDate

The KDE todolist got roughly 10-15 Attributes So when syncing B with KDE, where B would replace KDE Records would lead to loss of up to 12 attributes. This will be avoided by a merge before a replaceEntry operation. This way B will take presedence on the 3 Attributes but we won't lose the additional attributes. By default the support map of a Syncee is set to supports all..

Syncer operates on Syncee objects.

Definition at line 68 of file syncee.h.


Member Function Documentation

virtual void KSync::Syncee::reset  )  [inline, virtual]
 

Reset Syncee to initial state.

This is called when the data the Syncee operates on is changed externally, i.e. without using the Syncees addEntry() removeEntry(), replaceEntry() methods.

Reimplemented in KSync::AddressBookSyncee, and KSync::CalendarSyncee.

Definition at line 83 of file syncee.h.

virtual SyncEntry* KSync::Syncee::firstEntry  )  [pure virtual]
 

Return the first SyncEntry object of the data set.

This function together with nextEntry() is used to iterate through all entries of a Syncee data set.

Implemented in KSync::AddressBookSyncee, KSync::BookmarkSyncee, and KSync::CalendarSyncee.

Referenced by findEntry(), and saveLog().

virtual SyncEntry* KSync::Syncee::nextEntry  )  [pure virtual]
 

Return the next SyncEntry object of the data set.

This function together with firstEntry() is used to iterate through all entries of a Syncee data set.

Implemented in KSync::AddressBookSyncee, KSync::BookmarkSyncee, and KSync::CalendarSyncee.

Referenced by findEntry(), and saveLog().

virtual QString KSync::Syncee::type  )  const [inline, virtual]
 

The type of the Syncee.

Reimplemented in KSync::AddressBookSyncee, KSync::BookmarkSyncee, and KSync::CalendarSyncee.

Definition at line 103 of file syncee.h.

Referenced by statusLogName().

SyncEntry * Syncee::findEntry const QString id  )  [virtual]
 

Find an entry identified by a unique id.

See SyncEntry::id().

Parameters:
id the Id to be found
Definition at line 57 of file syncee.cpp.

References firstEntry(), KSync::SyncEntry::id(), and nextEntry().

virtual void KSync::Syncee::addEntry SyncEntry  )  [pure virtual]
 

Add a SyncEntry object to this data set.

Ownership of the object remains with the caller.

Implemented in KSync::AddressBookSyncee, KSync::BookmarkSyncee, and KSync::CalendarSyncee.

Referenced by replaceEntry().

virtual void KSync::Syncee::removeEntry SyncEntry  )  [pure virtual]
 

Remove a SyncEntry.

The entry is removed from the data set, but the object is not deleted.

Implemented in KSync::AddressBookSyncee, KSync::BookmarkSyncee, and KSync::CalendarSyncee.

Referenced by replaceEntry().

void Syncee::replaceEntry SyncEntry oldEntry,
SyncEntry newEntry
 

Replace an entry of the data set by another.

Ownership of the objects is handled as with the addEntry() and removeEntry() functions. Definition at line 70 of file syncee.cpp.

References addEntry(), and removeEntry().

void Syncee::setIdentifier const QString identifier  ) 
 

Set identifier which can be used to uniquely identify the Syncee.

A Syncee with empty identifier is invalid. Without identifier the sync log can't be written. Definition at line 47 of file syncee.cpp.

QString KSync::Syncee::identifier  )  [inline]
 

Return the identifier which can be used to uniquely identify the Syncee object.

As long as the identifier is empty the Syncee doesn't have valid data. Definition at line 139 of file syncee.h.

Referenced by isValid(), statusLogName(), and KSync::Syncer::sync().

bool Syncee::isValid  )  [virtual]
 

Return if the Syncee is valid.

If a Syncee is invalid it means that it doesn't have any valid data, e.g. because the Konnector doesn't support this type of data.

By default the Syncee isn't valid if the identifier is empty. Definition at line 52 of file syncee.cpp.

References identifier().

Referenced by loadLog().

QString Syncee::statusLogName  ) 
 

Return the name of a config file, which is used to store status information about the data set.

Definition at line 121 of file syncee.cpp.

References identifier(), and type().

Referenced by loadLog().

bool Syncee::loadLog  ) 
 

Load the syncing log.

Returns:
true, if loading is successful, otherwise false.
Definition at line 88 of file syncee.cpp.

References isValid(), and statusLogName().

Referenced by KSync::Syncer::sync().

bool Syncee::saveLog  ) 
 

Save the status log file with the name statusLogName().

Returns:
true, if loading is successful, otherwise false.
Definition at line 107 of file syncee.cpp.

References firstEntry(), KSync::SyncEntry::id(), KSync::SyncEntry::name(), nextEntry(), and KSync::SyncEntry::timestamp().

Referenced by KSync::Syncer::sync(), and KSync::Syncer::syncAllToTarget().

bool Syncee::hasChanged SyncEntry  ) 
 

Return, if the given SyncEntry has changed since the last syncing.

This information is retrieved by comparing the timestamps from the log file and the freshly read data set. Definition at line 76 of file syncee.cpp.

References KSync::SyncEntry::id(), and KSync::SyncEntry::timestamp().

Referenced by KSync::AddressBookSyncee::addEntry().

int Syncee::modificationState SyncEntry entry  )  const [virtual]
 

Returns if hasChanged and the state of change Undefined, Added, Modified,Removed.

Definition at line 135 of file syncee.cpp.

References KSync::SyncEntry::state().

int Syncee::syncMode  )  const [virtual]
 

Returns the syncMode of this Syncee.

The syncMode determines the later used synchronisation algorithm for the best results. Definition at line 140 of file syncee.cpp.

void Syncee::setSyncMode int  mode = MetaLess  )  [virtual]
 

Sets the syncMode of this Syncee.

Definition at line 145 of file syncee.cpp.

void Syncee::setFirstSync bool  firstSync = true  )  [virtual]
 

Set if it's syncing for the first time.

Definition at line 155 of file syncee.cpp.

bool Syncee::firstSync  )  const [virtual]
 

If it is syncing for the first time.

Definition at line 150 of file syncee.cpp.

virtual SyncEntry::PtrList KSync::Syncee::added  )  [inline, virtual]
 

What was added?

Reimplemented in KSync::AddressBookSyncee, and KSync::CalendarSyncee.

Definition at line 215 of file syncee.h.

virtual SyncEntry::PtrList KSync::Syncee::modified  )  [inline, virtual]
 

What was modified?

Reimplemented in KSync::AddressBookSyncee, and KSync::CalendarSyncee.

Definition at line 219 of file syncee.h.

virtual SyncEntry::PtrList KSync::Syncee::removed  )  [inline, virtual]
 

What was removed?

Reimplemented in KSync::AddressBookSyncee, and KSync::CalendarSyncee.

Definition at line 223 of file syncee.h.

void Syncee::insertId const QString type,
const QString konnectorId,
const QString kdeId
 

A KSyncEntry is able to store the relative ids.

Parameters:
type The type of the id for example todo, kalendar...
konnectorId The original id of the Entry on konnector side
kdeId Is the id KDE native classes are assigning Example: type = todo konnector id = -1345678 KDE ID = KORG-234575464
Definition at line 160 of file syncee.cpp.

QString Syncee::newId  )  const [virtual]
 

When dealing with special uid Konnector- You might want a new uid to be generated.

To later find an Entry again you'll need this map

Reimplemented in KSync::AddressBookSyncee.

Definition at line 194 of file syncee.cpp.

Kontainer::ValueList Syncee::ids const QString type  )  const
 

Parameters:
type The type for the ids to returned
Returns:
the ids as QValueList
Definition at line 175 of file syncee.cpp.

QMap< QString, Kontainer::ValueList > Syncee::ids  )  const
 

Returns:
all ids
Definition at line 184 of file syncee.cpp.

void Syncee::setSupports const QBitArray  )  [virtual]
 

Set what the Syncee supports.

Definition at line 199 of file syncee.cpp.

QBitArray Syncee::bitArray  )  const [virtual]
 

Returns attributes supported by the Device.

Definition at line 206 of file syncee.cpp.

void Syncee::setSource const QString src  ) 
 

Set the source of this Syncee.

The string may be presented to the user by the conflict resolver Definition at line 217 of file syncee.cpp.

QString Syncee::source  )  const
 

Eeturns the source of this syncee or QString::null if not set.

Definition at line 222 of file syncee.cpp.

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

bool Syncee::isSupported uint  Attribute  )  const [inline]
 

Convenience function to figure if a specific attribute is supported.

Definition at line 211 of file syncee.cpp.

bool Syncee::trustIdsOnFirstSync  )  const [virtual]
 

When syncing two iCalendar the UIDs are garantuued to be global and you may not change these values at all.

But there are cases in firstSync where you would like to create a bound between one id and another Definition at line 189 of file syncee.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 Fri Aug 27 12:50:53 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003