-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,60 +2332,70 @@ void KABCore::manageCategories( ) QStringList catIncList = (*it).categories(); int i; if ( catIncList.count() ) { newCatList.clear(); for( i = 0; i< catIncList.count(); ++i ) { if ( catList.contains (catIncList[i])) { newCatList.append( catIncList[i] ); } } newCatList.sort(); (*it).setCategories( newCatList ); mAddressBook->insertAddressee( (*it) ); } } setModified( true ); mViewManager->refreshView(); message( i18n("Removing categories done!")); } delete cp; } void KABCore::removeVoice() { 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 ) return; - KABC::Addressee::List list; XXPortSelectDialog dlg( this, false, this ); - if ( dlg.exec() ) - list = dlg.contacts(); - else + if ( !dlg.exec() ) return; - KABC::Addressee::List::Iterator it; - for ( it = list.begin(); it != list.end(); ++it ) { - if ( (*it).removeVoice() ) - addrModified((*it), false ); + mAddressBook->setUntagged(); + dlg.tagSelected(); + message(i18n("Removing voice..."), false ); + KABC::AddressBook::Iterator it; + for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { + if ( (*it).tagged() ) { + (*it).removeVoice(); } } + message(i18n("Refreshing view...") ); + qApp->processEvents(); + mViewManager->refreshView( "" ); + Addressee add; + mDetails->setAddressee( add ); + message(i18n("Remove voice completed!") ); + + + +} void KABCore::setFormattedName() { KABFormatPrefs setpref; if ( !setpref.exec() ) { return; } XXPortSelectDialog dlg( this, false, this ); if ( !dlg.exec() ) return; mAddressBook->setUntagged(); dlg.tagSelected(); int count = 0; KABC::AddressBook::Iterator it; for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { if ( (*it).tagged() ) { ++count; if ( count %10 == 0 ) message(i18n("Changing contact #%1").arg( count ) ); qApp->processEvents(); QString fName; if ( setpref.simple->isChecked() ) fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); else if ( setpref.full->isChecked() ) @@ -3110,79 +3120,79 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, i18n("KA/Pi Synchronization"),i18n("Write back"))) { qDebug("cancelled "); return false; } } return syncOK; } //this is a overwritten callbackmethods from the syncinterface bool KABCore::sync(KSyncManager* manager, QString filename, int mode) { //pending prepare addresseeview for output //pending detect, if remote file has REV field. if not switch to external sync mGlobalSyncMode = SYNC_MODE_NORMAL; if ( manager != syncManager ) qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); AddressBook abLocal(filename,"syncContact"); bool syncOK = false; if ( abLocal.load() ) { - qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); + qDebug("Sync:AB loaded %s,sync mode %d",filename.latin1(), mode ); bool external = false; bool isXML = false; if ( filename.right(4) == ".xml") { mGlobalSyncMode = SYNC_MODE_EXTERNAL; isXML = true; abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); } else { external = !manager->mIsKapiFile; if ( external ) { - qDebug("Setting vcf mode to external "); + qDebug("Sync:Setting vcf mode to external "); mGlobalSyncMode = SYNC_MODE_EXTERNAL; AddressBook::Iterator it; for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { (*it).setID( mCurrentSyncDevice, (*it).uid() ); (*it).computeCsum( mCurrentSyncDevice ); } } } //AddressBook::Iterator it; //QStringList vcards; //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { // qDebug("Name %s ", (*it).familyName().latin1()); //} syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); if ( syncOK ) { if ( syncManager->mWriteBackFile ) { if ( external ) abLocal.removeSyncAddressees( !isXML); - qDebug("Saving remote AB "); + qDebug("Sync:Saving remote AB "); if ( ! abLocal.saveAB()) qDebug("Error writing back AB to file "); if ( external ) { // afterwrite processing abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); } } } setModified(); } abLocal.removeResources(); if ( syncOK ) mViewManager->refreshView(); return syncOK; } void KABCore::removeSyncInfo( QString syncProfile) { qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); mAddressBook->removeSyncInfo( syncProfile ); setModified(); } |