summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp32
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
@@ -2344,35 +2344,45 @@ void KABCore::manageCategories( )
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}
2352void KABCore::removeVoice() 2352void 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
2369void KABCore::setFormattedName() 2379void 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();
@@ -3122,55 +3132,55 @@ 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();