author | zautrix <zautrix> | 2004-09-19 11:32:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-19 11:32:40 (UTC) |
commit | eea0ff04703dffdbe8b67a0dc9f592597d7450c1 (patch) (unidiff) | |
tree | 874549d9c1c6239304fe1540d1b56269652954c0 /kabc | |
parent | 953277a85e6ec5630ab0d64b4d68815e4e4f9906 (diff) | |
download | kdepimpi-eea0ff04703dffdbe8b67a0dc9f592597d7450c1.zip kdepimpi-eea0ff04703dffdbe8b67a0dc9f592597d7450c1.tar.gz kdepimpi-eea0ff04703dffdbe8b67a0dc9f592597d7450c1.tar.bz2 |
more AB sync
-rw-r--r-- | kabc/address.h | 1 | ||||
-rw-r--r-- | kabc/addressbook.cpp | 28 | ||||
-rw-r--r-- | kabc/addressbook.h | 4 | ||||
-rw-r--r-- | kabc/addressee.cpp | 39 | ||||
-rw-r--r-- | kabc/addressee.h | 4 | ||||
-rw-r--r-- | kabc/plugins/qtopia/qtopiaconverter.cpp | 9 |
6 files changed, 79 insertions, 6 deletions
diff --git a/kabc/address.h b/kabc/address.h index 6b53c7e..37dd851 100644 --- a/kabc/address.h +++ b/kabc/address.h | |||
@@ -17,32 +17,33 @@ | |||
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_ADDRESS_H | 28 | #ifndef KABC_ADDRESS_H |
29 | #define KABC_ADDRESS_H | 29 | #define KABC_ADDRESS_H |
30 | 30 | ||
31 | #include <qmap.h> | 31 | #include <qmap.h> |
32 | #include <qstring.h> | 32 | #include <qstring.h> |
33 | #include <qstringlist.h> | ||
33 | #include <qvaluelist.h> | 34 | #include <qvaluelist.h> |
34 | 35 | ||
35 | // template tags for address formatting localization | 36 | // template tags for address formatting localization |
36 | #define KABC_FMTTAG_realname QString("%n") | 37 | #define KABC_FMTTAG_realname QString("%n") |
37 | #define KABC_FMTTAG_REALNAME QString("%N") | 38 | #define KABC_FMTTAG_REALNAME QString("%N") |
38 | #define KABC_FMTTAG_company QString("%cm") | 39 | #define KABC_FMTTAG_company QString("%cm") |
39 | #define KABC_FMTTAG_COMPANY QString("%CM") | 40 | #define KABC_FMTTAG_COMPANY QString("%CM") |
40 | #define KABC_FMTTAG_pobox QString("%p") | 41 | #define KABC_FMTTAG_pobox QString("%p") |
41 | #define KABC_FMTTAG_street QString("%s") | 42 | #define KABC_FMTTAG_street QString("%s") |
42 | #define KABC_FMTTAG_STREET QString("%S") | 43 | #define KABC_FMTTAG_STREET QString("%S") |
43 | #define KABC_FMTTAG_zipcode QString("%z") | 44 | #define KABC_FMTTAG_zipcode QString("%z") |
44 | #define KABC_FMTTAG_location QString("%l") | 45 | #define KABC_FMTTAG_location QString("%l") |
45 | #define KABC_FMTTAG_LOCATION QString("%L") | 46 | #define KABC_FMTTAG_LOCATION QString("%L") |
46 | #define KABC_FMTTAG_region QString("%r") | 47 | #define KABC_FMTTAG_region QString("%r") |
47 | #define KABC_FMTTAG_REGION QString("%R") | 48 | #define KABC_FMTTAG_REGION QString("%R") |
48 | #define KABC_FMTTAG_newline QString("\\n") | 49 | #define KABC_FMTTAG_newline QString("\\n") |
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 46a9cf4..64832f1 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -235,37 +235,40 @@ AddressBook::AddressBook( const QString &config, const QString &family ) | |||
235 | void AddressBook::init(const QString &config, const QString &family ) | 235 | void AddressBook::init(const QString &config, const QString &family ) |
236 | { | 236 | { |
237 | blockLSEchange = false; | 237 | blockLSEchange = false; |
238 | d = new AddressBookData; | 238 | d = new AddressBookData; |
239 | QString fami = family; | 239 | QString fami = family; |
240 | qDebug("new ab "); | 240 | qDebug("new ab "); |
241 | if (config != 0) { | 241 | if (config != 0) { |
242 | qDebug("config != 0 "); | 242 | qDebug("config != 0 "); |
243 | if ( family == "syncContact" ) { | 243 | if ( family == "syncContact" ) { |
244 | qDebug("creating sync config "); | 244 | qDebug("creating sync config "); |
245 | fami = "contact"; | 245 | fami = "contact"; |
246 | KConfig* con = new KConfig( locateLocal("config", "syncContactrc") ); | 246 | KConfig* con = new KConfig( locateLocal("config", "syncContactrc") ); |
247 | con->setGroup( "General" ); | 247 | con->setGroup( "General" ); |
248 | con->writeEntry( "ResourceKeys", QString("sync") ); | 248 | con->writeEntry( "ResourceKeys", QString("sync") ); |
249 | con->writeEntry( "Standard", QString("sync") ); | 249 | con->writeEntry( "Standard", QString("sync") ); |
250 | con->setGroup( "Resource_sync" ); | 250 | con->setGroup( "Resource_sync" ); |
251 | con->writeEntry( "FileFormat", QString("vcard") ); | ||
252 | con->writeEntry( "FileName", config ); | 251 | con->writeEntry( "FileName", config ); |
252 | con->writeEntry( "FileFormat", QString("vcard") ); | ||
253 | con->writeEntry( "ResourceIdentifier", QString("sync") ); | 253 | con->writeEntry( "ResourceIdentifier", QString("sync") ); |
254 | con->writeEntry( "ResourceName", QString("sync_res") ); | 254 | con->writeEntry( "ResourceName", QString("sync_res") ); |
255 | con->writeEntry( "ResourceType", QString("file") ); | 255 | if ( config.right(4) == ".xml" ) |
256 | con->writeEntry( "ResourceType", QString("qtopia") ); | ||
257 | else | ||
258 | con->writeEntry( "ResourceType", QString("file") ); | ||
256 | //con->sync(); | 259 | //con->sync(); |
257 | d->mConfig = con; | 260 | d->mConfig = con; |
258 | } | 261 | } |
259 | else | 262 | else |
260 | d->mConfig = new KConfig( locateLocal("config", config) ); | 263 | d->mConfig = new KConfig( locateLocal("config", config) ); |
261 | // qDebug("AddressBook::init 1 config=%s",config.latin1() ); | 264 | // qDebug("AddressBook::init 1 config=%s",config.latin1() ); |
262 | } | 265 | } |
263 | else { | 266 | else { |
264 | d->mConfig = 0; | 267 | d->mConfig = 0; |
265 | // qDebug("AddressBook::init 1 config=0"); | 268 | // qDebug("AddressBook::init 1 config=0"); |
266 | } | 269 | } |
267 | 270 | ||
268 | //US d->mErrorHandler = 0; | 271 | //US d->mErrorHandler = 0; |
269 | d->mManager = new KRES::Manager<Resource>( fami, false ); | 272 | d->mManager = new KRES::Manager<Resource>( fami, false ); |
270 | d->mManager->readConfig( d->mConfig ); | 273 | d->mManager->readConfig( d->mConfig ); |
271 | if ( family == "syncContact" ) { | 274 | if ( family == "syncContact" ) { |
@@ -586,32 +589,53 @@ AddressBook::Iterator AddressBook::find( const Addressee &a ) | |||
586 | return it; | 589 | return it; |
587 | } | 590 | } |
588 | } | 591 | } |
589 | return end(); | 592 | return end(); |
590 | } | 593 | } |
591 | 594 | ||
592 | Addressee AddressBook::findByUid( const QString &uid ) | 595 | Addressee AddressBook::findByUid( const QString &uid ) |
593 | { | 596 | { |
594 | Iterator it; | 597 | Iterator it; |
595 | for ( it = begin(); it != end(); ++it ) { | 598 | for ( it = begin(); it != end(); ++it ) { |
596 | if ( uid == (*it).uid() ) { | 599 | if ( uid == (*it).uid() ) { |
597 | return *it; | 600 | return *it; |
598 | } | 601 | } |
599 | } | 602 | } |
600 | return Addressee(); | 603 | return Addressee(); |
601 | } | 604 | } |
605 | Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) | ||
606 | { | ||
607 | Iterator it; | ||
608 | for ( it = begin(); it != end(); ++it ) { | ||
609 | if ( uid == (*it).getID( profile ) ) | ||
610 | return (*it); | ||
611 | } | ||
612 | return Addressee(); | ||
613 | } | ||
614 | void AddressBook::mergeAB( AddressBook *aBook, const QString& profile ) | ||
615 | { | ||
616 | Iterator it; | ||
617 | Addressee ad; | ||
618 | for ( it = begin(); it != end(); ++it ) { | ||
619 | ad = aBook->findByExternUid( (*it).externalUID(), profile ); | ||
620 | if ( !ad.isEmpty() ) { | ||
621 | (*it).mergeContact( ad ); | ||
622 | } | ||
623 | } | ||
624 | } | ||
625 | |||
602 | #if 0 | 626 | #if 0 |
603 | Addressee::List AddressBook::getExternLastSyncAddressees() | 627 | Addressee::List AddressBook::getExternLastSyncAddressees() |
604 | { | 628 | { |
605 | Addressee::List results; | 629 | Addressee::List results; |
606 | 630 | ||
607 | Iterator it; | 631 | Iterator it; |
608 | for ( it = begin(); it != end(); ++it ) { | 632 | for ( it = begin(); it != end(); ++it ) { |
609 | if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { | 633 | if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { |
610 | if ( (*it).familyName().left(4) == "!E: " ) | 634 | if ( (*it).familyName().left(4) == "!E: " ) |
611 | results.append( *it ); | 635 | results.append( *it ); |
612 | } | 636 | } |
613 | } | 637 | } |
614 | 638 | ||
615 | return results; | 639 | return results; |
616 | } | 640 | } |
617 | #endif | 641 | #endif |
diff --git a/kabc/addressbook.h b/kabc/addressbook.h index 2f2678b..f40e015 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h | |||
@@ -280,34 +280,34 @@ class AddressBook : public QObject | |||
280 | 280 | ||
281 | /** | 281 | /** |
282 | Shows gui independend error messages. | 282 | Shows gui independend error messages. |
283 | */ | 283 | */ |
284 | void error( const QString& ); | 284 | void error( const QString& ); |
285 | 285 | ||
286 | /** | 286 | /** |
287 | Query all resources to clean up their lock files | 287 | Query all resources to clean up their lock files |
288 | */ | 288 | */ |
289 | void cleanUp(); | 289 | void cleanUp(); |
290 | 290 | ||
291 | // sync stuff | 291 | // sync stuff |
292 | //Addressee::List getExternLastSyncAddressees(); | 292 | //Addressee::List getExternLastSyncAddressees(); |
293 | void resetTempSyncStat(); | 293 | void resetTempSyncStat(); |
294 | QStringList uidList(); | 294 | QStringList uidList(); |
295 | void removeDeletedAddressees(); | 295 | void removeDeletedAddressees(); |
296 | 296 | void mergeAB( AddressBook *aBook, const QString& profile ); | |
297 | 297 | Addressee findByExternUid( const QString& uid , const QString& profile ); | |
298 | signals: | 298 | signals: |
299 | /** | 299 | /** |
300 | Emitted, when the address book has changed on disk. | 300 | Emitted, when the address book has changed on disk. |
301 | */ | 301 | */ |
302 | void addressBookChanged( AddressBook * ); | 302 | void addressBookChanged( AddressBook * ); |
303 | 303 | ||
304 | /** | 304 | /** |
305 | Emitted, when the address book has been locked for writing. | 305 | Emitted, when the address book has been locked for writing. |
306 | */ | 306 | */ |
307 | void addressBookLocked( AddressBook * ); | 307 | void addressBookLocked( AddressBook * ); |
308 | 308 | ||
309 | /** | 309 | /** |
310 | Emitted, when the address book has been unlocked. | 310 | Emitted, when the address book has been unlocked. |
311 | */ | 311 | */ |
312 | void addressBookUnlocked( AddressBook * ); | 312 | void addressBookUnlocked( AddressBook * ); |
313 | 313 | ||
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index c34f671..711c261 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -53,32 +53,33 @@ struct Addressee::AddresseeData : public KShared | |||
53 | QString givenName; | 53 | QString givenName; |
54 | QString additionalName; | 54 | QString additionalName; |
55 | QString prefix; | 55 | QString prefix; |
56 | QString suffix; | 56 | QString suffix; |
57 | QString nickName; | 57 | QString nickName; |
58 | QDateTime birthday; | 58 | QDateTime birthday; |
59 | QString mailer; | 59 | QString mailer; |
60 | TimeZone timeZone; | 60 | TimeZone timeZone; |
61 | Geo geo; | 61 | Geo geo; |
62 | QString title; | 62 | QString title; |
63 | QString role; | 63 | QString role; |
64 | QString organization; | 64 | QString organization; |
65 | QString note; | 65 | QString note; |
66 | QString productId; | 66 | QString productId; |
67 | QDateTime revision; | 67 | QDateTime revision; |
68 | QString sortString; | 68 | QString sortString; |
69 | QString externalUID; | ||
69 | KURL url; | 70 | KURL url; |
70 | Secrecy secrecy; | 71 | Secrecy secrecy; |
71 | Picture logo; | 72 | Picture logo; |
72 | Picture photo; | 73 | Picture photo; |
73 | Sound sound; | 74 | Sound sound; |
74 | Agent agent; | 75 | Agent agent; |
75 | QString mExternalId; | 76 | QString mExternalId; |
76 | PhoneNumber::List phoneNumbers; | 77 | PhoneNumber::List phoneNumbers; |
77 | Address::List addresses; | 78 | Address::List addresses; |
78 | Key::List keys; | 79 | Key::List keys; |
79 | QStringList emails; | 80 | QStringList emails; |
80 | QStringList categories; | 81 | QStringList categories; |
81 | QStringList custom; | 82 | QStringList custom; |
82 | int mTempSyncStat; | 83 | int mTempSyncStat; |
83 | Resource *resource; | 84 | Resource *resource; |
84 | 85 | ||
@@ -258,32 +259,58 @@ void Addressee::computeCsum(const QString &dev) | |||
258 | t = mData->custom; | 259 | t = mData->custom; |
259 | t.sort(); | 260 | t.sort(); |
260 | for ( iii = 0; iii < t.count(); ++iii) | 261 | for ( iii = 0; iii < t.count(); ++iii) |
261 | l.append( t[iii] ); | 262 | l.append( t[iii] ); |
262 | KABC::Address::List::Iterator addressIter; | 263 | KABC::Address::List::Iterator addressIter; |
263 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 264 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
264 | ++addressIter ) { | 265 | ++addressIter ) { |
265 | t = (*addressIter).asList(); | 266 | t = (*addressIter).asList(); |
266 | t.sort(); | 267 | t.sort(); |
267 | for ( iii = 0; iii < t.count(); ++iii) | 268 | for ( iii = 0; iii < t.count(); ++iii) |
268 | l.append( t[iii] ); | 269 | l.append( t[iii] ); |
269 | } | 270 | } |
270 | uint cs = getCsum4List(l); | 271 | uint cs = getCsum4List(l); |
271 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 272 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
272 | setCsum( dev, QString::number (cs )); | 273 | setCsum( dev, QString::number (cs )); |
273 | } | 274 | } |
275 | |||
276 | void Addressee::mergeContact( Addressee ad ) | ||
277 | { | ||
278 | #if 0 | ||
279 | if ( !mData->name.isEmpty() ) l.append(mData->name); | ||
280 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | ||
281 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | ||
282 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | ||
283 | if ( !mData->additionalName ) l.append( mData->additionalName ); | ||
284 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | ||
285 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | ||
286 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | ||
287 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | ||
288 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | ||
289 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | ||
290 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | ||
291 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | ||
292 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | ||
293 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | ||
294 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | ||
295 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | ||
296 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | ||
297 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | ||
298 | #endif | ||
299 | } | ||
300 | |||
274 | void Addressee::removeID(const QString &prof) | 301 | void Addressee::removeID(const QString &prof) |
275 | { | 302 | { |
276 | detach(); | 303 | detach(); |
277 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 304 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
278 | 305 | ||
279 | } | 306 | } |
280 | void Addressee::setID( const QString & prof , const QString & id ) | 307 | void Addressee::setID( const QString & prof , const QString & id ) |
281 | { | 308 | { |
282 | detach(); | 309 | detach(); |
283 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 310 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
284 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 311 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
285 | } | 312 | } |
286 | void Addressee::setTempSyncStat( int id ) | 313 | void Addressee::setTempSyncStat( int id ) |
287 | { | 314 | { |
288 | if ( mData->mTempSyncStat == id ) return; | 315 | if ( mData->mTempSyncStat == id ) return; |
289 | detach(); | 316 | detach(); |
@@ -310,32 +337,44 @@ void Addressee::setCsum( const QString & prof , const QString & id ) | |||
310 | QString Addressee::getCsum( const QString & prof) | 337 | QString Addressee::getCsum( const QString & prof) |
311 | { | 338 | { |
312 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 339 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
313 | } | 340 | } |
314 | 341 | ||
315 | void Addressee::setIDStr( const QString & s ) | 342 | void Addressee::setIDStr( const QString & s ) |
316 | { | 343 | { |
317 | detach(); | 344 | detach(); |
318 | mData->mExternalId = s; | 345 | mData->mExternalId = s; |
319 | } | 346 | } |
320 | 347 | ||
321 | QString Addressee::IDStr() const | 348 | QString Addressee::IDStr() const |
322 | { | 349 | { |
323 | return mData->mExternalId; | 350 | return mData->mExternalId; |
324 | } | 351 | } |
325 | 352 | ||
353 | void Addressee::setExternalUID( const QString &id ) | ||
354 | { | ||
355 | if ( id == mData->externalUID ) return; | ||
356 | detach(); | ||
357 | mData->empty = false; | ||
358 | mData->externalUID = id; | ||
359 | } | ||
360 | |||
361 | QString Addressee::externalUID() const | ||
362 | { | ||
363 | return mData->externalUID; | ||
364 | } | ||
326 | 365 | ||
327 | void Addressee::setUid( const QString &id ) | 366 | void Addressee::setUid( const QString &id ) |
328 | { | 367 | { |
329 | if ( id == mData->uid ) return; | 368 | if ( id == mData->uid ) return; |
330 | detach(); | 369 | detach(); |
331 | mData->empty = false; | 370 | mData->empty = false; |
332 | mData->uid = id; | 371 | mData->uid = id; |
333 | } | 372 | } |
334 | 373 | ||
335 | QString Addressee::uid() const | 374 | QString Addressee::uid() const |
336 | { | 375 | { |
337 | if ( mData->uid.isEmpty() ) | 376 | if ( mData->uid.isEmpty() ) |
338 | mData->uid = KApplication::randomString( 10 ); | 377 | mData->uid = KApplication::randomString( 10 ); |
339 | 378 | ||
340 | return mData->uid; | 379 | return mData->uid; |
341 | } | 380 | } |
diff --git a/kabc/addressee.h b/kabc/addressee.h index bfb0840..59fcbd8 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h | |||
@@ -99,33 +99,35 @@ class Addressee | |||
99 | // sync stuff | 99 | // sync stuff |
100 | void setTempSyncStat(int id); | 100 | void setTempSyncStat(int id); |
101 | int tempSyncStat() const; | 101 | int tempSyncStat() const; |
102 | void setIDStr( const QString & ); | 102 | void setIDStr( const QString & ); |
103 | QString IDStr() const; | 103 | QString IDStr() const; |
104 | void setID( const QString &, const QString & ); | 104 | void setID( const QString &, const QString & ); |
105 | QString getID( const QString & ); | 105 | QString getID( const QString & ); |
106 | void setCsum( const QString &, const QString & ); | 106 | void setCsum( const QString &, const QString & ); |
107 | QString getCsum( const QString & ); | 107 | QString getCsum( const QString & ); |
108 | void removeID(const QString &); | 108 | void removeID(const QString &); |
109 | void computeCsum(const QString &dev); | 109 | void computeCsum(const QString &dev); |
110 | ulong getCsum4List( const QStringList & attList); | 110 | ulong getCsum4List( const QStringList & attList); |
111 | /** | 111 | /** |
112 | Return, if the address book entry is empty. | 112 | Return, if the address book entry is empty. |
113 | */ | 113 | */ |
114 | bool isEmpty() const; | 114 | bool isEmpty() const; |
115 | 115 | void setExternalUID( const QString &id ); | |
116 | QString externalUID() const; | ||
117 | void mergeContact( Addressee ad ); | ||
116 | /** | 118 | /** |
117 | Set unique identifier. | 119 | Set unique identifier. |
118 | */ | 120 | */ |
119 | void setUid( const QString &uid ); | 121 | void setUid( const QString &uid ); |
120 | /** | 122 | /** |
121 | Return unique identifier. | 123 | Return unique identifier. |
122 | */ | 124 | */ |
123 | QString uid() const; | 125 | QString uid() const; |
124 | /** | 126 | /** |
125 | Return translated label for uid field. | 127 | Return translated label for uid field. |
126 | */ | 128 | */ |
127 | static QString uidLabel(); | 129 | static QString uidLabel(); |
128 | 130 | ||
129 | /** | 131 | /** |
130 | Set name. | 132 | Set name. |
131 | */ | 133 | */ |
diff --git a/kabc/plugins/qtopia/qtopiaconverter.cpp b/kabc/plugins/qtopia/qtopiaconverter.cpp index ac513b6..7d00a3f 100644 --- a/kabc/plugins/qtopia/qtopiaconverter.cpp +++ b/kabc/plugins/qtopia/qtopiaconverter.cpp | |||
@@ -62,33 +62,40 @@ void QtopiaConverter::deinit() | |||
62 | if (catDB) | 62 | if (catDB) |
63 | { | 63 | { |
64 | delete catDB; | 64 | delete catDB; |
65 | catDB = 0; | 65 | catDB = 0; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr ) | 69 | bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &addr ) |
70 | { | 70 | { |
71 | // name | 71 | // name |
72 | addr.setFormattedName(contact.fileAs()); | 72 | addr.setFormattedName(contact.fileAs()); |
73 | addr.setFamilyName( contact.lastName() ); | 73 | addr.setFamilyName( contact.lastName() ); |
74 | addr.setGivenName( contact.firstName() ); | 74 | addr.setGivenName( contact.firstName() ); |
75 | addr.setAdditionalName( contact.middleName() ); | 75 | addr.setAdditionalName( contact.middleName() ); |
76 | addr.setPrefix( contact.nameTitle() ); | 76 | addr.setPrefix( contact.nameTitle() ); |
77 | addr.setSuffix( contact.suffix() ); | 77 | addr.setSuffix( contact.suffix() ); |
78 | 78 | QString exuid = contact.uid().toString(); | |
79 | int ente = exuid.find( "-0000"); | ||
80 | if ( exuid.left(1) == "{" ) | ||
81 | exuid = exuid.mid(1); | ||
82 | if ( ente > -1 ) | ||
83 | exuid = exuid.left( ente-1 ); | ||
84 | addr.setExternalUID( exuid ); | ||
85 | //qDebug("QtopiaConverter:set uid %s ",addr.externalUID().latin1() ); | ||
79 | 86 | ||
80 | 87 | ||
81 | QStringList emails = contact.emailList(); | 88 | QStringList emails = contact.emailList(); |
82 | for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { | 89 | for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { |
83 | addr.insertEmail( *it, ((*it) == contact.defaultEmail()) ); | 90 | addr.insertEmail( *it, ((*it) == contact.defaultEmail()) ); |
84 | } | 91 | } |
85 | 92 | ||
86 | if (!contact.defaultEmail().isEmpty()) | 93 | if (!contact.defaultEmail().isEmpty()) |
87 | addr.insertEmail(contact.defaultEmail(), true); | 94 | addr.insertEmail(contact.defaultEmail(), true); |
88 | 95 | ||
89 | // home | 96 | // home |
90 | if ((!contact.homeStreet().isEmpty()) || | 97 | if ((!contact.homeStreet().isEmpty()) || |
91 | (!contact.homeCity().isEmpty()) || | 98 | (!contact.homeCity().isEmpty()) || |
92 | (!contact.homeState().isEmpty()) || | 99 | (!contact.homeState().isEmpty()) || |
93 | (!contact.homeZip().isEmpty()) || | 100 | (!contact.homeZip().isEmpty()) || |
94 | (!contact.homeCountry().isEmpty())) | 101 | (!contact.homeCountry().isEmpty())) |