From kde-pim Tue Jul 27 15:59:02 2004 From: Holger Freyther Date: Tue, 27 Jul 2004 15:59:02 +0000 To: kde-pim Subject: [Kde-pim] KitchenSync LIBKSYNC/KONNECTOR changes and updates Message-Id: <200407271759.02848.freyther () gmx ! net> X-MARC-Message: https://marc.info/?l=kde-pim&m=109094398105315 General overview: Makefile.am | 3 kitchensync/lib/Makefile.am | 2 kitchensync/lib/core.h | 7 kitchensync/lib/kitchensync.cpp | 17 kitchensync/lib/kitchensync.h | 8 kitchensync/lib/mainwindow.cpp | 1 kitchensync/lib/syncalgo.cpp | 293 --------------- kitchensync/lib/syncalgo.h | 53 -- kitchensync/splash.cpp | 2 libkonnector2/idhelper.cpp | 14 libkonnector2/konnector.cpp | 49 ++ libkonnector2/konnector.h | 28 + libkonnector2/plugins/dummy/dummykonnector.cpp | 16 libkonnector2/plugins/dummy/dummykonnector.h | 6 libkonnector2/plugins/kabc/kabckonnector.cpp | 21 - libkonnector2/plugins/kabc/kabckonnector.h | 1 libkonnector2/plugins/kcal/kcalkonnector.cpp | 14 libkonnector2/plugins/kcal/kcalkonnector.h | 3 libkonnector2/plugins/local/localkonnector.cpp | 51 +- libkonnector2/plugins/local/localkonnector.h | 14 libkonnector2/plugins/qtopia/Makefile.am | 4 libkonnector2/plugins/qtopia/addressbook.cpp | 16 libkonnector2/plugins/qtopia/addressbook.h | 2 libkonnector2/plugins/qtopia/datebook.cpp | 18 libkonnector2/plugins/qtopia/datebook.h | 3 libkonnector2/plugins/qtopia/device.cpp | 245 +++++++----- libkonnector2/plugins/qtopia/device.h | 19 - libkonnector2/plugins/qtopia/helper.cpp | 13 libkonnector2/plugins/qtopia/helper.h | 13 libkonnector2/plugins/qtopia/md5map.cpp | 95 ----- libkonnector2/plugins/qtopia/md5map.h | 69 --- libkonnector2/plugins/qtopia/md5metatemplate.h | 136 +------ libkonnector2/plugins/qtopia/metaaddressbook.cpp | 14 libkonnector2/plugins/qtopia/metaaddressbook.h | 13 libkonnector2/plugins/qtopia/metacalendar.cpp | 153 ++++++++ libkonnector2/plugins/qtopia/metacalendar.h | 49 ++ libkonnector2/plugins/qtopia/metadatebook.cpp | 106 ----- libkonnector2/plugins/qtopia/metadatebook.h | 45 -- libkonnector2/plugins/qtopia/metatodo.cpp | 60 --- libkonnector2/plugins/qtopia/metatodo.h | 41 -- libkonnector2/plugins/qtopia/qtopiakonnector.cpp | 5 libkonnector2/plugins/qtopia/socket.cpp | 148 ++++--- libkonnector2/plugins/qtopia/socket.h | 12 libkonnector2/plugins/qtopia/todo.cpp | 13 libkonnector2/plugins/qtopia/todo.h | 3 libkonnector2/plugins/remote/remotekonnector.cpp | 45 +- libkonnector2/plugins/remote/remotekonnector.h | 14 libksync/Makefile.am | 7 libksync/addressbookmerger.cpp | 361 +++++++++++++++++++ libksync/addressbookmerger.h | 85 ++++ libksync/addressbooksyncee.cpp | 386 +------------------- libksync/addressbooksyncee.h | 62 --- libksync/bookmarksyncee.cpp | 46 +- libksync/bookmarksyncee.h | 26 - libksync/calendarmerger.cpp | 434 +++++++++++++++++++++++ libksync/calendarmerger.h | 95 +++++ libksync/calendarsyncee.cpp | 57 ++- libksync/calendarsyncee.h | 33 - libksync/conflictdialog.cpp | 8 libksync/eventsyncee.cpp | 95 ----- libksync/eventsyncee.h | 80 ---- libksync/incidencetemplate.h | 230 ------------ libksync/kontainer.cpp | 40 -- libksync/kontainer.h | 15 libksync/merger.cpp | 53 ++ libksync/merger.h | 110 +++++ libksync/metahelper.cpp | 174 +++++++++ libksync/metahelper.h | 283 ++++++++++++++ libksync/opiedesktopsyncee.cpp | 58 --- libksync/opiedesktopsyncee.h | 12 libksync/standardsync.cpp | 237 ++++++++---- libksync/standardsync.h | 13 libksync/syncee.cpp | 151 ++------ libksync/syncee.h | 160 +++----- libksync/synceelist.cpp | 28 - libksync/synceelist.h | 6 libksync/syncentry.cpp | 56 ++ libksync/syncentry.h | 57 +-- libksync/syncer.cpp | 20 - libksync/syncui.cpp | 2 libksync/syncuikde.cpp | 10 libksync/tests/synctest1.cpp | 12 libksync/tests/synctest2.cpp | 12 libksync/tests/synctest3.cpp | 12 libksync/tests/synctest4.cpp | 12 libksync/tests/synctest5.cpp | 8 libksync/tests/synctesthelper.cpp | 66 ++- libksync/tests/synctesthelper.h | 5 libksync/todosyncee.cpp | 188 --------- libksync/todosyncee.h | 92 ---- libksync/unknownsyncee.cpp | 58 --- libksync/unknownsyncee.h | 14 92 files changed, 2996 insertions(+), 2930 deletions(-) Fixup installation of the Splashscreen that is there for over three years now and it intended to be a joke. Hopefully you remember the time :) Affected files: Makefile.am kitchensync/splash.cpp Remove EventSyncee/TodoSyncee and the IncidenceTemplate as they're superseed by the CalendarSyncee Affected files: eventsyncee.[h,cpp] todosyncee.[h,cpp] Qtopia Konnector files that used and worked on these syncees Remove the QBitArray for the supported fields of a Konnector for a Syncee with the Merger Interface. If no Merger Interface is set that means all Attributes are supported. Moved the implementation to new files AddressBookMerger, CalendarMerger TODO: More fine grained field support and adjust to new fields present Affected Files: QtopiaKonnector for setting the Merger, Syncees Syncee changes: -Replace Merger C'tor with the new one -type() is non virtual and there is setType to be called from the c'tor -Redefine Ownership for the SyncEntry. if you addEntry you transfer the ownership to the Syncee. Remove removes the SyncEntry from the internal list but does not delete as ownership is retrasnfered. replaceEntry calls removeEntry, addEntry and then deletes the old data. Konnectors and Syncees are adjusted to follow policy. -Removed saveLog,loadLog, logBaseName, hasChanged functions. Now the complete 'Changes' is done via state() and setState(). MetaHelper ( new name is on the way ) will fill the gap and extend the power. The discussion is below. -Now syncing is only done with Added,Modified,Removed sync attribute of the SyncEntry. This highly improves the syncing algorithm and would allow incremental updates. The Konnector is repsonsible for setting this SyncInformation/History and the MetaHelper is there to help with it -Have a default Implementation for added(),removed(), modified() (tokoe I'll make it QValueList ) -As deleted records are not present anymore we add dummy records with the OLD UID and set the Attribute as removed. Again the MetaHelper helps here a lot. Demands: the attribute must be saved. Our Syncees follow that policy (with the patch) Todo: Discuss what ever you want :) General naming is next on my todo, as I'll see where to apply verbs to the action to public and private API, then I'll also use QValueList for a better iterator. Missing: in saving backup do not save removedEntries. More discussion on the standardsync changes on that. SyncEntry changes: -setId re added. This is needed for devices with weak UIDs that need to get a new KDE wide UID during sync. With adding "Konnector-" in front of 'your' ID you will receive a new UID on syncing. In Konnector API there is a ID Helper to make the mapping the IDS easier. You will replace the ID when the records come from the device and resubstitute when they come back (before writing). This will also be used for Deleted Records -syncState? The state during sync? Discuss or remove -clone() keeps all attributes and create an exact copy of the SyncEntry. the syncParen will be set by the Syncees on addEntry. -mergeWith added StandardSync: -As there is only the state() we will sync using them -Before replacing an Entry we will merge them not to lose attributes -Konnectors shouldn't write Removed Entries back. They get deleted by not beeing written back to the device. As they may only be a dummy record with a UID they may not even be worth while to be readded MetaHelper: This class helps you to apply SyncHistory for the state of the SyncEntry but also saves the information. The default implementation uses the timestamp() method of the SyncEntry and saves it to a KConfig file. The QtopiaKonnector extends it to use MD5 sums instead of timestamp() and one can also extend it easily to use different storage. A record is added when there was no prior record information, modified if the timestamp is different and it was deleted if there is a history but currently no record available. In this case a new Dummy entry is added, the ID is set and the state to removed. Demands: A SyncEntry c'tor with the Parent only and setId implementation. Issues: If you sync KDE<->KDE where no UID replacement happens, then you delete the Sync Information and resync on both sides the attribute will be 'Added' but they won't be synced as the ID is present in the other Syncee. Standardsync needs to be able to handle this case and deconflict if not override is enabled. Discussion: The question is if the sync information and history is an attribute of the Syncee or is the duty of the Konnector to apply it. It is specialisation by inherting the Syncee/SyncEntry to make it right for the Konnector or to provide a Template Based helper which can be extended to the right ways to allow the right behaviour. I think applying the Attributes is the Job of the Konnector as it is the only one knowing what has changed and what is important to determine what was changed and what is needed to be saved somehow. For me the Syncee is a container used to sync and we've a fixed set of standard containers that are final (end of inheritance tree) but allow adding new Container specialisation for new types at runtime. I think by forcing a Konnector author to inherit and specialise the default 'types' we make it more error prone. Is he forced to call (setType()), can dynamic_cast still be used, he may overwrite virtual functions with something not sane. I think by forcing to specialise the Container we make it more hard and error prone to write Konnectors. I recognize it is a border case between inheriting and having a composer to do the job. Measuring how easy it is to use the (yet to be renamed) MetaHelper and how much it can do I'm very much in favor to have it available for the Konnectors and use it in the Konnector implementation to save and apply the SyncHistory. We might want to move this class to the Konnector API then. Records are removed by not saving them back. In Konnector a static was added to strip removed records from the Syncee, this might be needed for Backup as well and I may need to move this method to Syncee. Konnector Changes: -Add the purgeRemovedEntries to remove the marked as removed records. -As a Konnector can be used in multiple Profiles it should use storagePath() + "/" and then store its data, or by supplying this path to the MetaHelper -As two instances of the Konnector could be used in the same profile with different files we can use generateMD5Sum to generate a unique id for the syncees synchistory files/dir. Conclusion: Changed Konnectors to use MetaHelper, follow the owning policies -Result it syncs (and valgrind doesn't bitch) and recognize deletions -It can merge attributes TODO: Fix name of MetaHelper, apply verbs to internal functions, probably also change {} placing, use QValueList instead of QPtrList, improve Merger attributes (more fine grained), Fix backup kind regards holger PS: patch is at: http://handhelds.org/~zecke/kitchensync_ksync_rework.patch.gz -- _____________________________________________ Holger 'zecke' Freyther Project OPIE- the Open Palmtop Integrated Environment http://opie.handhelds.org Sponsor me! Donate Hardware! http://handhelds.org/~zecke _______________________________________________ kde-pim mailing list kde-pim@mail.kde.org https://mail.kde.org/mailman/listinfo/kde-pim kde-pim home page at http://pim.kde.org/