KDE PIM / Developers / API Docs / kpilot / lib

RecordConduit Class Reference

This is a base class for record-based conduits. More...

#include <recordConduit.h>

Inherits ConduitAction.

List of all members.

Public Member Functions

Protected Types

Protected Slots

Protected Member Functions

Static Protected Member Functions

Protected Attributes

Static Protected Attributes

Classes


Detailed Description

This is a base class for record-based conduits.

The data on the PC is represented by an object derived from the RecordConduit::PCData class, and each entry on the PC by an object derived from RecordConduit::PCEntry. Only very few methods of this class need to be implemented, mostly just the functions to copy a PC entry to a handheld entry and vice versa. All the sync logic is already present in this class and does not need to be implemented by child classes.


Member Enumeration Documentation

enum RecordConduit::eqFlags [protected]
 

Flags for the _equal() method, that specify which parts of the record need to be checked.

Flags and category are pre-defined, but each conduit can define its own flags and reimplement findFlags().


Member Function Documentation

virtual PCData* RecordConduit::initializePCData  )  [protected, pure virtual]
 

Initialize the PC Data object, must be a child class of RecordConduit::PCData.

virtual QString RecordConduit::dbName  )  const [protected, pure virtual]
 

return the name of the databases synced by this conduit

virtual PilotAppCategory* RecordConduit::createPalmEntry PilotRecord *  rec  )  [protected, pure virtual]
 

Create a Palm entry from the raw palm record.

virtual void RecordConduit::readConfig  )  [protected, pure virtual]
 

Read the config.

You need to call at least setArchiveDeleted(bool) and setConflictResolution(SyncAction::ConflictResolution)

virtual unsigned char* RecordConduit::doPackAppInfo int *   )  [inline, protected, virtual]
 

Create a buffer for the appInfo and pack it inside.

Also, remember to set appLen to the size of the buffer! By default, nothing is done, and the return value will be 0 (appinfo not supported by default, you need to implement this in your child class!).

Parameters:
appLen Receives the length of the allocated buffer

virtual bool RecordConduit::doUnpackAppInfo unsigned char *  ,
int 
[inline, protected, virtual]
 

Read the appInfo from the buffer provided to this method.

By default, nothing is done, and the return value will be false (appinfo not supported by default, you need to implement this in your child class!).

Parameters:
buffer Buffer containing the appInfo in packed format
appLen specifies the length of buffer

virtual QString RecordConduit::category int   )  const [inline, protected, virtual]
 

Return the n-th category on the handheld.

By default a null string will be returned. If you want your conduit to support categories, reimplement this method in your childclass!

Parameters:
n # of the desired category name

virtual bool RecordConduit::_equal const PilotAppCategory *  palmEntry,
const PCEntry pcEntry,
int  flag = eqFlagsAll
const [protected, pure virtual]
 

Check if the entry from the Handheld matches the entry from the PC (but check only those fields of the records that are specified by the flag argument.

By default, all fields should be checked, but in some cases (like finding an approximately equal entry, reimplement findFlags() to use different flags in that case) only some parts should be checked.

Parameters:
palmEntry The entry from the handheld
pcEntry The entry on the PC side
flag Flags that specify which fields need to be checked.
Returns:
Returns wheter the two entries match in all fields specified by flag.

virtual bool RecordConduit::_copy PilotAppCategory *  toPalmEntry,
const PCEntry fromPCEntry
[protected, pure virtual]
 

Copy all fields from the PC entry to the handheld entry.

Parameters:
toPalmEntry Entry on the handheld that will receive the values.
fromPCEntry Entry on the PC that should be copied to the handheld entry.
Returns:
wheter copying was successful (ie. both pointers are valid, and copying went fine.

virtual bool RecordConduit::_copy PCEntry toPCEntry,
const PilotAppCategory *  fromPalmEntry
[protected, pure virtual]
 

Copy all fields from the handheld entry to the PC entry.

Parameters:
toPCEntry Entry on the handheld that should be copied to the PC entry.
fromPalmEntry Entry on the PC that will receive the values from the handheld entry.
Returns:
wheter copying was successful (ie. both pointers are valid, and copying went fine.

virtual bool RecordConduit::smartMergeEntry PCEntry pcEntry,
PilotAppCategory *  backupEntry,
PilotAppCategory *  palmEntry
[protected, pure virtual]
 

The entry on the pc and on the handheld were both changed, and an automatic conflict resolution is not possible, so do a suitable resolution (ask the user or apply some pre-defined method (e.g.

one side always overrides etc).

virtual bool RecordConduit::doPrepare  )  [inline, protected, virtual]
 

Do the preperations before the sync algorithm starts.

const QStringList RecordConduit::categories  )  const [protected, virtual]
 

Return the list of category names on the handheld.

The default implementation is slow, because it just calls category(n) for 0<n<16. This method should be reimplemented by child classes when a faster algorithm is available. For conduits that don't support categories at all, this might also reimplemented to automatically return an empty list.

int RecordConduit::findFlags  )  const [protected, virtual]
 

Specifies which parts of the record shall be checked when searching for matches of the handheld data in the PC data.

By default, everything except flags and categories are checked. Child classes that desire other comparisons (i.e. compare just an enty date if only one entry per date is allowed, like for diaries, etc) should reimplement this method.

virtual void RecordConduit::doPostSync  )  [inline, protected, virtual]
 

Do some cleanup after the sync, e.g.

write sync time to the config, write some version to the config, whatever you like in your conduit.

QString RecordConduit::getCatForHH const QStringList  cats,
const QString  curr
const [protected]
 

_getCat returns the id of the category from the given categories list.

If the address has no categories on the PC, QString::null is returned. If the current category exists in the list of cats, it is returned Otherwise the first cat in the list that exists on the HH is returned If none of the categories exists on the palm, QString::null is returned


Member Data Documentation

QMap< recordid_t, QString > RecordConduit::mEntryMap [protected]
 

mEntryMap maps record ids to IDs of Es.

This is used to speed up searching the local addressbook


The documentation for this class was generated from the following files: