I found how to write note of contacts on PDA. Now the synchronization seems to work fine but probably my patch doesn't follow the correct specification for kde develop.
--- ./syncekonnector/AddressBookHandler.cpp 2006-01-14 02:16:25.000000000 +0100 +++ /home/sources/synCE/syncekonnector/syncekonnector/AddressBookHandler.cpp 2006-01-14 02:18:47.000000000 +0100 @@ -25,6 +25,14 @@ namespace pocketPCCommunication { + +/* 13-01-2005 - ALEX START*/ +const QString beginVToDo_Tag = "BEGIN:VTODO"; +const QString uidRraId_Tag = "UID:RRA-ID-"; +const QString description_Tag = "DESCRIPTION:"; +const QString endVToDo_Tag = "END:VTODO"; +/* 13-01-2005 - ALEX END*/ + AddressBookHandler::AddressBookHandler( KSharedPtr<Rra> p_rra, QString mBaseDir, KSync::KonnectorUIDHelper *mUidHelper) : PimHandler( p_rra ) { @@ -65,6 +73,41 @@ KABC::Addressee addr = vCardConv.parseVCard ( vCard ); addr.setFormattedName(addr.formattedName().replace("\\,", ",")); +/* 13-01-2005 - ALEX START*/ +int startIdx, endIdx; + +QString xCard = m_rra->getVToDo( mTypeId, *it ); + +startIdx = xCard.find(beginVToDo_Tag, 0, TRUE); +if(startIdx == 0) +{ + startIdx = xCard.find(uidRraId_Tag, startIdx, TRUE); + if(startIdx) + { + startIdx += uidRraId_Tag.length(); + endIdx = xCard.find("\n", startIdx, TRUE); + if(endIdx) + { + endIdx--; + startIdx = xCard.find(description_Tag, endIdx, TRUE); + if(startIdx) + { + startIdx += description_Tag.length(); + endIdx = xCard.findRev(endVToDo_Tag, -1, TRUE); + if(endIdx) + { + endIdx--; + QString lineFeed; + lineFeed.sprintf("%c",0x0a); + QString vCardNote = xCard.mid(startIdx, endIdx-startIdx).replace("\\n", lineFeed, TRUE); + addr.setNote(vCardNote); + } + } + } + } +} +/* 13-01-2005 - ALEX END*/ + QString kdeId; if ((kdeId = mUidHelper->kdeId("SynCEAddressbook", addr.uid(), "---")) != "---") { @@ -214,16 +257,44 @@ KABC::VCardConverter vCardConv; QString vCard; + for (KABC::Addressee::List::Iterator it = p_addresseeList.begin(); it != p_addresseeList.end(); ++it ) { kdDebug(2120) << "Adding Contact on Device: " << (*it).uid() << endl; +/* 13-01-2005 - ALEX START */ +QString contactNote, vNoteCard; + +/* If note length is over 70 chars putVCard() signes the entire contact as fake and it doesn't appear in PDA + I copy out the note and then I reset them before to create the VCard string for putVCard() function */ +if(!(*it).note().isEmpty()) +{ + contactNote = (*it).note(); + (*it).setNote(""); +} + vCard = vCardConv.createVCard ( ( *it ) ); uint32_t newObjectId = m_rra->putVCard( vCard, mTypeId, 0 ); + +// Now I prepare the string for putVToDo() function +// 0x3f is the Euro symbol on my keyboard and 0x80 is the right Euro symbol +if(!contactNote.isEmpty()) +{ + vNoteCard = beginVToDo_Tag + "\n" + + uidRraId_Tag + QString::number(newObjectId, 16 ).rightJustify( 8, '0' ) + "\n" + + description_Tag + QString(contactNote.replace("\\", "\\\\").replace("\n", "\\n").local8Bit().replace(0x3f, 0x80)) + "\n" + + endVToDo_Tag + "\n"; + + // I send the note to PDA + m_rra->putVToDo(vNoteCard, mTypeId, newObjectId); +} +/* 13-01-2005 - ALEX STOP */ + m_rra->markIdUnchanged( mTypeId, newObjectId ); + mUidHelper->addId("SynCEAddressbook", "RRA-ID-" + QString::number ( newObjectId, 16 ).rightJustify( 8, '0' ), (*it).uid()); @@ -253,11 +324,42 @@ for ( ; it != p_addresseeList.end(); ++it ) { QString kUid = mUidHelper->konnectorId("SynCEAddressbook", (*it).uid(), "---"); +/* 13-01-2005 - ALEX START */ +QString contactNote, vNoteCard; + if (kUid != "---") { kdDebug(2120) << "Updating Contact on Device: " << "ID-Pair: KDEID: " << (*it).uid() << " DeviceId: " << kUid << endl; + +/* If note length is over 70 chars putVCard() signes the entire contact as fake and it doesn't appear in PDA + I copy out the note and then I reset them before to create the VCard string for putVCard() function */ +if(!(*it).note().isEmpty()) +{ + contactNote = (*it).note(); + (*it).setNote(""); +} + vCard = vCardConv.createVCard ( ( *it ) ); + +kdDebug(2120) << "V-CARD: " << vCard << endl; + m_rra->putVCard ( vCard, mTypeId, getOriginalId( kUid ) ); + +// Now I prepare the string for putVToDo() function +// 0x3f is the Euro symbol on my keyboard and 0x80 is the right Euro symbol +if(!contactNote.isEmpty()) +{ + vNoteCard = beginVToDo_Tag + "\n" + + uidRraId_Tag + QString::number(getOriginalId( kUid ), 16 ).rightJustify( 8, '0' ) + "\n" + + description_Tag + QString(contactNote.replace("\\", "\\\\").replace("\n", "\\n").local8Bit().replace(0x3f, 0x80)) + "\n" + + endVToDo_Tag + "\n"; + + // I send the note to PDA + m_rra->putVToDo(vNoteCard, mTypeId, getOriginalId( kUid )); +} +/* 13-01-2005 - ALEX STOP */ + + m_rra->markIdUnchanged( mTypeId, getOriginalId( kUid ) ); } > I need to synchronize a PocketPC with Windows Mobile 2003 with Kontact on > my desktop. > > Synce works but the note of contact still unsynchronized. > > Looking at AddressBoockHandler.cpp in syncekonnector folder I found that i > can get the note of contact with m_rra->getVToDo( mTypeId, *it ) ... i > don't like this workaround and now the note of contact is synchronized only > from PDA to Desktop. > How can i write in PDA ? > > cheers > > Alex -- "E' stato ieri, che la follia di oggi, ci ha preparato al silenzioso trionfo della disperazione di domani" - L'esercito delle 12 scimmie -