author | zautrix <zautrix> | 2005-01-18 09:31:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-18 09:31:59 (UTC) |
commit | 2d6776d79732f6771885a549de5c37f9e75f7641 (patch) (unidiff) | |
tree | 5dc2abf48a99e2a35f8e1458f731b3ef9210ac7e /kaddressbook | |
parent | 522486966ecf041a6e49913b6e420d58d4284837 (diff) | |
download | kdepimpi-2d6776d79732f6771885a549de5c37f9e75f7641.zip kdepimpi-2d6776d79732f6771885a549de5c37f9e75f7641.tar.gz kdepimpi-2d6776d79732f6771885a549de5c37f9e75f7641.tar.bz2 |
fixed merging
-rw-r--r-- | kaddressbook/kabcore.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 42e147f..d970ff1 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2332,59 +2332,69 @@ void KABCore::manageCategories( ) | |||
2332 | QStringList catIncList = (*it).categories(); | 2332 | QStringList catIncList = (*it).categories(); |
2333 | int i; | 2333 | int i; |
2334 | if ( catIncList.count() ) { | 2334 | if ( catIncList.count() ) { |
2335 | newCatList.clear(); | 2335 | newCatList.clear(); |
2336 | for( i = 0; i< catIncList.count(); ++i ) { | 2336 | for( i = 0; i< catIncList.count(); ++i ) { |
2337 | if ( catList.contains (catIncList[i])) { | 2337 | if ( catList.contains (catIncList[i])) { |
2338 | newCatList.append( catIncList[i] ); | 2338 | newCatList.append( catIncList[i] ); |
2339 | } | 2339 | } |
2340 | } | 2340 | } |
2341 | newCatList.sort(); | 2341 | newCatList.sort(); |
2342 | (*it).setCategories( newCatList ); | 2342 | (*it).setCategories( newCatList ); |
2343 | mAddressBook->insertAddressee( (*it) ); | 2343 | mAddressBook->insertAddressee( (*it) ); |
2344 | } | 2344 | } |
2345 | } | 2345 | } |
2346 | setModified( true ); | 2346 | setModified( true ); |
2347 | mViewManager->refreshView(); | 2347 | mViewManager->refreshView(); |
2348 | message( i18n("Removing categories done!")); | 2348 | message( i18n("Removing categories done!")); |
2349 | } | 2349 | } |
2350 | delete cp; | 2350 | delete cp; |
2351 | } | 2351 | } |
2352 | void KABCore::removeVoice() | 2352 | void KABCore::removeVoice() |
2353 | { | 2353 | { |
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 | ||
2369 | void KABCore::setFormattedName() | 2379 | void KABCore::setFormattedName() |
2370 | { | 2380 | { |
2371 | KABFormatPrefs setpref; | 2381 | KABFormatPrefs setpref; |
2372 | if ( !setpref.exec() ) { | 2382 | if ( !setpref.exec() ) { |
2373 | return; | 2383 | return; |
2374 | } | 2384 | } |
2375 | XXPortSelectDialog dlg( this, false, this ); | 2385 | XXPortSelectDialog dlg( this, false, this ); |
2376 | if ( !dlg.exec() ) | 2386 | if ( !dlg.exec() ) |
2377 | return; | 2387 | return; |
2378 | mAddressBook->setUntagged(); | 2388 | mAddressBook->setUntagged(); |
2379 | dlg.tagSelected(); | 2389 | dlg.tagSelected(); |
2380 | int count = 0; | 2390 | int count = 0; |
2381 | KABC::AddressBook::Iterator it; | 2391 | KABC::AddressBook::Iterator it; |
2382 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2392 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2383 | if ( (*it).tagged() ) { | 2393 | if ( (*it).tagged() ) { |
2384 | ++count; | 2394 | ++count; |
2385 | if ( count %10 == 0 ) | 2395 | if ( count %10 == 0 ) |
2386 | message(i18n("Changing contact #%1").arg( count ) ); | 2396 | message(i18n("Changing contact #%1").arg( count ) ); |
2387 | qApp->processEvents(); | 2397 | qApp->processEvents(); |
2388 | QString fName; | 2398 | QString fName; |
2389 | if ( setpref.simple->isChecked() ) | 2399 | if ( setpref.simple->isChecked() ) |
2390 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | 2400 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); |
@@ -3110,79 +3120,79 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
3110 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 3120 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
3111 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { | 3121 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { |
3112 | qDebug("cancelled "); | 3122 | qDebug("cancelled "); |
3113 | return false; | 3123 | return false; |
3114 | } | 3124 | } |
3115 | } | 3125 | } |
3116 | return syncOK; | 3126 | return syncOK; |
3117 | } | 3127 | } |
3118 | 3128 | ||
3119 | 3129 | ||
3120 | //this is a overwritten callbackmethods from the syncinterface | 3130 | //this is a overwritten callbackmethods from the syncinterface |
3121 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | 3131 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) |
3122 | { | 3132 | { |
3123 | 3133 | ||
3124 | //pending prepare addresseeview for output | 3134 | //pending prepare addresseeview for output |
3125 | //pending detect, if remote file has REV field. if not switch to external sync | 3135 | //pending detect, if remote file has REV field. if not switch to external sync |
3126 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 3136 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
3127 | if ( manager != syncManager ) | 3137 | if ( manager != syncManager ) |
3128 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); | 3138 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); |
3129 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3139 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3130 | 3140 | ||
3131 | AddressBook abLocal(filename,"syncContact"); | 3141 | AddressBook abLocal(filename,"syncContact"); |
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; |
3137 | if ( filename.right(4) == ".xml") { | 3147 | if ( filename.right(4) == ".xml") { |
3138 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3148 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3139 | isXML = true; | 3149 | isXML = true; |
3140 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3150 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3141 | } else { | 3151 | } else { |
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; |
3147 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3157 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3148 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 3158 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
3149 | (*it).computeCsum( mCurrentSyncDevice ); | 3159 | (*it).computeCsum( mCurrentSyncDevice ); |
3150 | } | 3160 | } |
3151 | } | 3161 | } |
3152 | } | 3162 | } |
3153 | //AddressBook::Iterator it; | 3163 | //AddressBook::Iterator it; |
3154 | //QStringList vcards; | 3164 | //QStringList vcards; |
3155 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3165 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3156 | // qDebug("Name %s ", (*it).familyName().latin1()); | 3166 | // qDebug("Name %s ", (*it).familyName().latin1()); |
3157 | //} | 3167 | //} |
3158 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 3168 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
3159 | if ( syncOK ) { | 3169 | if ( syncOK ) { |
3160 | if ( syncManager->mWriteBackFile ) | 3170 | if ( syncManager->mWriteBackFile ) |
3161 | { | 3171 | { |
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 "); |
3167 | if ( external ) { | 3177 | if ( external ) { |
3168 | // afterwrite processing | 3178 | // afterwrite processing |
3169 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); | 3179 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); |
3170 | } | 3180 | } |
3171 | } | 3181 | } |
3172 | } | 3182 | } |
3173 | setModified(); | 3183 | setModified(); |
3174 | 3184 | ||
3175 | } | 3185 | } |
3176 | abLocal.removeResources(); | 3186 | abLocal.removeResources(); |
3177 | if ( syncOK ) | 3187 | if ( syncOK ) |
3178 | mViewManager->refreshView(); | 3188 | mViewManager->refreshView(); |
3179 | return syncOK; | 3189 | return syncOK; |
3180 | 3190 | ||
3181 | } | 3191 | } |
3182 | void KABCore::removeSyncInfo( QString syncProfile) | 3192 | void KABCore::removeSyncInfo( QString syncProfile) |
3183 | { | 3193 | { |
3184 | qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); | 3194 | qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); |
3185 | mAddressBook->removeSyncInfo( syncProfile ); | 3195 | mAddressBook->removeSyncInfo( syncProfile ); |
3186 | setModified(); | 3196 | setModified(); |
3187 | } | 3197 | } |
3188 | 3198 | ||