-rw-r--r-- | kabc/addressee.cpp | 111 | ||||
-rw-r--r-- | kabc/plugins/sharpdtm/sharpdtmconverter.cpp | 20 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 32 |
3 files changed, 94 insertions, 69 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 3b238f5..82b4b9b 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -285,28 +285,33 @@ void Addressee::computeCsum(const QString &dev) | |||
285 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | 285 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) |
286 | { | 286 | { |
287 | // merge all standard non-outlook fields. | ||
288 | //if isSubSet (e.g. mobile phone sync) merge all fields | ||
287 | 289 | ||
288 | detach(); | 290 | detach(); |
289 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | 291 | if ( isSubSet ) { |
290 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | 292 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; |
291 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | 293 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; |
292 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; | 294 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; |
293 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | 295 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; |
294 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | 296 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; |
295 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | 297 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; |
296 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | 298 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; |
297 | if ( !mData->birthday.isValid() ) | 299 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; |
298 | if ( ad.mData->birthday.isValid()) | 300 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; |
299 | mData->birthday = ad.mData->birthday; | 301 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; |
302 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; | ||
303 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; | ||
304 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; | ||
305 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; | ||
306 | if ( !mData->birthday.isValid() ) | ||
307 | if ( ad.mData->birthday.isValid()) | ||
308 | mData->birthday = ad.mData->birthday; | ||
309 | |||
310 | } | ||
300 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | 311 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; |
301 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; | 312 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; |
302 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; | 313 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; |
303 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; | ||
304 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; | ||
305 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; | ||
306 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; | ||
307 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; | 314 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; |
308 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; | 315 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; |
309 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; | ||
310 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; | ||
311 | QStringList t; | 316 | QStringList t; |
312 | QStringList tAD; | 317 | QStringList tAD; |
@@ -314,20 +319,22 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | |||
314 | 319 | ||
315 | // ********** phone numbers | 320 | // ********** phone numbers |
316 | PhoneNumber::List phoneAD = ad.phoneNumbers(); | 321 | if ( isSubSet ) { |
317 | PhoneNumber::List::Iterator phoneItAD; | 322 | PhoneNumber::List phoneAD = ad.phoneNumbers(); |
318 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { | 323 | PhoneNumber::List::Iterator phoneItAD; |
319 | bool found = false; | 324 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { |
320 | PhoneNumber::List::Iterator it; | 325 | bool found = false; |
321 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 326 | PhoneNumber::List::Iterator it; |
322 | if ( ( *phoneItAD ).contains( (*it) ) ) { | 327 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
323 | found = true; | 328 | if ( ( *phoneItAD ).contains( (*it) ) ) { |
324 | (*it).setType( ( *phoneItAD ).type() ); | 329 | found = true; |
325 | (*it).setNumber( ( *phoneItAD ).number() ); | 330 | (*it).setType( ( *phoneItAD ).type() ); |
326 | break; | 331 | (*it).setNumber( ( *phoneItAD ).number() ); |
332 | break; | ||
333 | } | ||
327 | } | 334 | } |
335 | // if ( isSubSet && ! found ) | ||
336 | if ( ! found ) // LR try this one... | ||
337 | mData->phoneNumbers.append( *phoneItAD ); | ||
328 | } | 338 | } |
329 | // if ( isSubSet && ! found ) | ||
330 | if ( ! found ) // LR try this one... | ||
331 | mData->phoneNumbers.append( *phoneItAD ); | ||
332 | } | 339 | } |
333 | if ( isSubSet ) { | 340 | if ( isSubSet ) { |
@@ -341,9 +348,11 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | |||
341 | 348 | ||
342 | // ************* categories; | 349 | // ************* categories; |
343 | t = mData->categories; | 350 | if ( isSubSet ) { |
344 | tAD = ad.mData->categories; | 351 | t = mData->categories; |
345 | for ( iii = 0; iii < tAD.count(); ++iii) | 352 | tAD = ad.mData->categories; |
346 | if ( !t.contains(tAD[iii] ) ) | 353 | for ( iii = 0; iii < tAD.count(); ++iii) |
347 | mData->categories.append( tAD[iii] ); | 354 | if ( !t.contains(tAD[iii] ) ) |
355 | mData->categories.append( tAD[iii] ); | ||
356 | } | ||
348 | QStringList::ConstIterator it; | 357 | QStringList::ConstIterator it; |
349 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { | 358 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { |
@@ -390,19 +399,21 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | |||
390 | } | 399 | } |
391 | } | 400 | } |
392 | KABC::Address::List::Iterator addressIterA; | 401 | if ( isSubSet ) { |
393 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { | 402 | KABC::Address::List::Iterator addressIterA; |
394 | bool found = false; | 403 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { |
395 | KABC::Address::List::Iterator addressIter; | 404 | bool found = false; |
396 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 405 | KABC::Address::List::Iterator addressIter; |
397 | ++addressIter ) { | 406 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
398 | if ( (*addressIter) == (*addressIterA)) { | 407 | ++addressIter ) { |
399 | found = true; | 408 | if ( (*addressIter) == (*addressIterA)) { |
400 | (*addressIter).setType( (*addressIterA).type() ); | 409 | found = true; |
401 | break; | 410 | (*addressIter).setType( (*addressIterA).type() ); |
402 | } | 411 | break; |
412 | } | ||
403 | 413 | ||
404 | } | 414 | } |
405 | if ( isSubSet && ! found ) { | 415 | if ( isSubSet && ! found ) { |
406 | mData->addresses.append( *addressIterA ); | 416 | mData->addresses.append( *addressIterA ); |
417 | } | ||
407 | } | 418 | } |
408 | } | 419 | } |
diff --git a/kabc/plugins/sharpdtm/sharpdtmconverter.cpp b/kabc/plugins/sharpdtm/sharpdtmconverter.cpp index ae4cfbb..8165b4c 100644 --- a/kabc/plugins/sharpdtm/sharpdtmconverter.cpp +++ b/kabc/plugins/sharpdtm/sharpdtmconverter.cpp | |||
@@ -81,5 +81,6 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa | |||
81 | // name | 81 | // name |
82 | //qDebug("SharpDTMConverter::sharpToAddressee check if the fileAs transformation works!!"); | 82 | //qDebug("SharpDTMConverter::sharpToAddressee check if the fileAs transformation works!!"); |
83 | addr.setFormattedName(db->readField(ZdbAdrs::FileAs)); // needs fix | 83 | addr.setFormattedName(db->readField(ZdbAdrs::FileAs)); |
84 | addr.setName(db->readField(ZdbAdrs::FullName)); | ||
84 | 85 | ||
85 | addr.setFamilyName( db->readField(ZdbAdrs::LastName) ); | 86 | addr.setFamilyName( db->readField(ZdbAdrs::LastName) ); |
@@ -223,9 +224,10 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa | |||
223 | //qDebug("SharpDTMConverter::sharpToAddressee pleas check that gender works!! : Gender: %s", gen.latin1()); | 224 | //qDebug("SharpDTMConverter::sharpToAddressee pleas check that gender works!! : Gender: %s", gen.latin1()); |
224 | //qDebug("SharpDTMConverter::sharpToAddressee: may be int db->readUshortField(\"ZdbAdrs::Gender\") is here better suited"); | 225 | //qDebug("SharpDTMConverter::sharpToAddressee: may be int db->readUshortField(\"ZdbAdrs::Gender\") is here better suited"); |
225 | 226 | if (gen == "1") | |
226 | if (gen == "male") | ||
227 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); | 227 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); |
228 | else if (gen == "female") | 228 | else if (gen == "2") |
229 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); | 229 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); |
230 | else | ||
231 | addr.insertCustom( "KADDRESSBOOK", "X-Gender", "undef"); | ||
230 | 232 | ||
231 | 233 | ||
@@ -235,5 +237,7 @@ bool SharpDTMConverter::sharpToAddressee( const CardId &contact, const SlZDataBa | |||
235 | //qDebug("qtopiaToAddressee annyversary found:%s", dt.latin1()); | 237 | //qDebug("qtopiaToAddressee annyversary found:%s", dt.latin1()); |
236 | addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); | 238 | addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); |
237 | } | 239 | } else |
240 | addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", " "); | ||
241 | |||
238 | 242 | ||
239 | 243 | ||
@@ -299,5 +303,5 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* da | |||
299 | } | 303 | } |
300 | database->writeField(ZdbAdrs::FileAs, formattedName); | 304 | database->writeField(ZdbAdrs::FileAs, formattedName); |
301 | database->writeField(ZdbAdrs::FullName, formattedName); | 305 | database->writeField(ZdbAdrs::FullName, addr.name()); |
302 | 306 | ||
303 | 307 | ||
@@ -374,7 +378,7 @@ bool SharpDTMConverter::addresseeToSharp( const Addressee &addr, SlZDataBase* da | |||
374 | //qDebug("SharpDTMConverter::addresseeToSharp: check also the reverse functionality in sharpToAddressee"); | 378 | //qDebug("SharpDTMConverter::addresseeToSharp: check also the reverse functionality in sharpToAddressee"); |
375 | if (gt == "male") | 379 | if (gt == "male") |
376 | database->writeField(ZdbAdrs::Gender, "male"); | 380 | database->writeField(ZdbAdrs::Gender, "1"); |
377 | else if (gt == "female") | 381 | else if (gt == "female") |
378 | database->writeField(ZdbAdrs::Gender, "female"); | 382 | database->writeField(ZdbAdrs::Gender, "2"); |
379 | else | 383 | else |
380 | database->writeField(ZdbAdrs::Gender, ""); | 384 | database->writeField(ZdbAdrs::Gender, ""); |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 42e147f..d970ff1 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2354,15 +2354,25 @@ void KABCore::removeVoice() | |||
2354 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2354 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2355 | return; | 2355 | return; |
2356 | KABC::Addressee::List list; | ||
2357 | XXPortSelectDialog dlg( this, false, this ); | 2356 | XXPortSelectDialog dlg( this, false, this ); |
2358 | if ( dlg.exec() ) | 2357 | if ( !dlg.exec() ) |
2359 | list = dlg.contacts(); | ||
2360 | else | ||
2361 | return; | 2358 | return; |
2362 | KABC::Addressee::List::Iterator it; | 2359 | mAddressBook->setUntagged(); |
2363 | for ( it = list.begin(); it != list.end(); ++it ) { | 2360 | dlg.tagSelected(); |
2364 | if ( (*it).removeVoice() ) | 2361 | message(i18n("Removing voice..."), false ); |
2365 | addrModified((*it), false ); | 2362 | KABC::AddressBook::Iterator it; |
2363 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | ||
2364 | if ( (*it).tagged() ) { | ||
2365 | (*it).removeVoice(); | ||
2366 | } | ||
2366 | } | 2367 | } |
2368 | message(i18n("Refreshing view...") ); | ||
2369 | qApp->processEvents(); | ||
2370 | mViewManager->refreshView( "" ); | ||
2371 | Addressee add; | ||
2372 | mDetails->setAddressee( add ); | ||
2373 | message(i18n("Remove voice completed!") ); | ||
2374 | |||
2375 | |||
2376 | |||
2367 | } | 2377 | } |
2368 | 2378 | ||
@@ -3132,5 +3142,5 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
3132 | bool syncOK = false; | 3142 | bool syncOK = false; |
3133 | if ( abLocal.load() ) { | 3143 | if ( abLocal.load() ) { |
3134 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); | 3144 | qDebug("Sync:AB loaded %s,sync mode %d",filename.latin1(), mode ); |
3135 | bool external = false; | 3145 | bool external = false; |
3136 | bool isXML = false; | 3146 | bool isXML = false; |
@@ -3142,5 +3152,5 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
3142 | external = !manager->mIsKapiFile; | 3152 | external = !manager->mIsKapiFile; |
3143 | if ( external ) { | 3153 | if ( external ) { |
3144 | qDebug("Setting vcf mode to external "); | 3154 | qDebug("Sync:Setting vcf mode to external "); |
3145 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3155 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3146 | AddressBook::Iterator it; | 3156 | AddressBook::Iterator it; |
@@ -3162,5 +3172,5 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
3162 | if ( external ) | 3172 | if ( external ) |
3163 | abLocal.removeSyncAddressees( !isXML); | 3173 | abLocal.removeSyncAddressees( !isXML); |
3164 | qDebug("Saving remote AB "); | 3174 | qDebug("Sync:Saving remote AB "); |
3165 | if ( ! abLocal.saveAB()) | 3175 | if ( ! abLocal.saveAB()) |
3166 | qDebug("Error writing back AB to file "); | 3176 | qDebug("Error writing back AB to file "); |