Qtopia Home - Classes - Hierachy - Annotated - Functions - Qt Embedded

Qtopia Desktop Synchronization

Introduction

Synchronization Architecture and Algorithms

Qtopia Desktop contains the algorithms for synchronization for any plugin.

Qtopia Desktop handles synchronizing multiple plugins working on the same application data. So there can be multiple plugins that synchronize Contacts data such as Qtopia's Contacts and My Desktop PIM Application's address book.

The sync algorithm remembers the last state of each plugin when it was last synced. It then uses that information to determine what changes have occured in each plugin. A master document is created by merging those changes. Each plugin is then given a list of changes that it should apply so that its contents will be same as the master document.

The diffs are performed at a field level, so a conflict is created if the user modifies the same field of the same record in multiple plugins or interfaces. The algorithm used for conflict resolution of two records depends on what the user has selected in the Settings->Sync dialog (currently, the user can choose from duplicating records, or letting the pda or the desktop win).

This algorirthm requires two main methods for each plugin:

Currently, the only architecture supported is synchronizing that data that needs to be merged together. Future versions will support plugins that simply wish to transfer a set of files and possibly do manual operations on those files.

Data Conversion during Synchronization

Qtopia Desktop requires each plugin to convert it's data between the plugin's internal representation of its data and a generic way to define any data. Qtopia Desktop uses MergeML::Record as a generic storage class for anyone's data. MergeML::Record stores its data in an QMap<int, QString>, where the key refers to the type of field in the map.

For the core pims (Contacts, Tasks and Calendar), the integer values used in the QMap<int, QString> have been defined in their PIM library classes. There are individual record classes for these data sets, which are Contact, Task and Event, respectively. These classes provide convenience methods which convert to and from a QMap<int,QString> . Each class has a toMap() method and a constructor that takes the QMap<int,QString> in their constructor.

There are static templated methods provided in mergeml.h that help the developer convert between a lists of QMap<int,QString> and a list of these PIM classes. They are MergeML::convertToML() and MergeML::convertFromML(). These templated methods will be helpfull for the developer when implementing SyncAppInterface::load() and SyncAppInterface::save().


Copyright © 2001-2005 Trolltech Trademarks
Qtopia version 2.1.1