Summary: | Copied addresses in kaddressbook won't sync into Palm | ||
---|---|---|---|
Product: | [Applications] kpilot | Reporter: | Michel Bouissou <michel> |
Component: | Contacts Conduit | Assignee: | groot |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Mandrake RPMs | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Michel Bouissou
2004-06-21 18:33:56 UTC
KAddressBook gives the pasted entry a new uid, I don't know whether KPilot does some magic there... Yes, kpilot also stores the record ID together with the addressee, so although the addressee has a new uid, there will still be two entries with the same record ID (i.e. the same palm entry assigned to it). This is a problem similar to the one of bug #75372 for the calendar. Cheers, Reinhold I believe I've just fixed this little guy. I'm going to mark it as fixed. Michel, if possible, I'd greatly appreciate you helping me make sure this bug is fixed. You'll need to update to the latest svn source from the 3.4 branch. From the commit comments.... - copy/paste in kaddressbook resulted in X-KPILOT-RecordID being carried over to the new (pasted) contact/addressee. this means that only one got synced to the pilot, looking a whole lot like data loss to the user. - we now check for duplicate X-KPILOT-RecordID's as part of our loading process, and if we find one, we wipe out this custom field in the addressee, which causes a new pilot id to be assigned to it when it's synced to the pilot later. the diff.... Index: conduits/abbrowserconduit/abbrowser-conduit.h =================================================================== --- conduits/abbrowserconduit/abbrowser-conduit.h (revision 413979) +++ conduits/abbrowserconduit/abbrowser-conduit.h (working copy) @@ -99,7 +99,7 @@ /* Given a list of contacts, creates the pilot id to contact key map * and a list of new contacts in O(n) time (single pass) */ - void _mapContactsToPilot( QMap < recordid_t, QString> &idContactMap) const; + void _mapContactsToPilot( QMap < recordid_t, QString> &idContactMap); /* Do the preperations before doSync or doBackup. * Load contacts, set the pilot */ bool _prepare(); Index: conduits/abbrowserconduit/abbrowser-conduit.cc =================================================================== --- conduits/abbrowserconduit/abbrowser-conduit.cc (revision 413979) +++ conduits/abbrowserconduit/abbrowser-conduit.cc (working copy) @@ -118,7 +118,7 @@ /* Builds the map which links record ids to uid's of Addressee */ -void AbbrowserConduit::_mapContactsToPilot(QMap < recordid_t, QString > &idContactMap) const +void AbbrowserConduit::_mapContactsToPilot(QMap < recordid_t, QString > &idContactMap) { FUNCTIONSETUP; @@ -132,7 +132,26 @@ if(!recid.isEmpty()) { recordid_t id = recid.toULong(); - idContactMap.insert(id, aContact.uid()); + // safety check: make sure that we don't already have a map for this pilot id. + // if we do (this can come from a copy/paste in kaddressbook, etc.), then we need + // to reset our Addressee so that we can assign him a new pilot Id later and sync + // him properly. if we don't do this, we'll lose one of these on the pilot. + if (!idContactMap.contains(id)) + { + idContactMap.insert(id, aContact.uid()); + } + else + { +#ifdef DEBUG + DEBUGCONDUIT << fname << ": found duplicate pilot key: [" + << id << "], removing pilot id from addressee: [" + << aContact.realName() << "]" << endl; +#endif + aBook->removeAddressee(aContact); + aContact.removeCustom(appString, idString); + aBook->insertAddressee(aContact); + abChanged = true; + } } } #ifdef DEBUG |