![]() Qtopia Home - Classes - Hierachy - Annotated - Functions - Licenses - Reference |
![]() |
Qtopia Desktop contains the algorithms for synchronization for any plug-in.
Qtopia Desktop handles synchronizing multiple plug-ins working on the same application data. So there can be multiple plug-ins 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 plug-in when it was last synced. It then uses that information to determine what changes have occurred in each plug-in. A master document is created by merging those changes. Each plug-in 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 plug-ins 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 algorithm requires two main methods for each plug-in:
Currently, the only architecture supported is synchronizing that data that needs to be merged together. Future versions will support plug-ins that simply wish to transfer a set of files and possibly do manual operations on those files.
Qtopia Desktop requires each plug-in to convert data between the plug-in internal representation of 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 © 2005 Trolltech | Trademarks | Qtopia version 2.2.0
|