summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp33
-rw-r--r--kaddressbook/kabcore.h2
2 files changed, 28 insertions, 7 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index d393660..42e147f 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1371,14 +1371,14 @@ void KABCore::save()
1371 return; 1371 return;
1372 1372
1373 syncManager->setBlockSave(true); 1373 syncManager->setBlockSave(true);
1374 QString text = i18n( "There was an error while attempting to save\n the " 1374 QString text = i18n( "There was an error while attempting to save\n the "
1375 "address book. Please check that some \nother application is " 1375 "address book. Please check that some \nother application is "
1376 "not using it. " ); 1376 "not using it. " );
1377 message(i18n("Saving ... please wait! ")); 1377 message(i18n("Saving ... please wait! "), false);
1378 qApp->processEvents(); 1378 //qApp->processEvents();
1379#ifndef KAB_EMBEDDED 1379#ifndef KAB_EMBEDDED
1380 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1380 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1381 if ( !b || !b->save() ) { 1381 if ( !b || !b->save() ) {
1382 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1382 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1383 } 1383 }
1384#else //KAB_EMBEDDED 1384#else //KAB_EMBEDDED
@@ -2294,17 +2294,21 @@ void KABCore::manageCategories( )
2294 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2294 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2295 if ( !cp->exec() ) { 2295 if ( !cp->exec() ) {
2296 delete cp; 2296 delete cp;
2297 return; 2297 return;
2298 } 2298 }
2299 int count = 0; 2299 int count = 0;
2300 int cc = 0;
2300 message( i18n("Please wait, processing categories...")); 2301 message( i18n("Please wait, processing categories..."));
2301 if ( cp->addCat() ) { 2302 if ( cp->addCat() ) {
2302 KABC::AddressBook::Iterator it; 2303 KABC::AddressBook::Iterator it;
2303 QStringList catList = KABPrefs::instance()->mCustomCategories; 2304 QStringList catList = KABPrefs::instance()->mCustomCategories;
2304 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2305 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2306 ++cc;
2307 if ( cc %10 == 0)
2308 message(i18n("Processing contact #%1").arg(cc));
2305 QStringList catIncList = (*it).categories(); 2309 QStringList catIncList = (*it).categories();
2306 int i; 2310 int i;
2307 for( i = 0; i< catIncList.count(); ++i ) { 2311 for( i = 0; i< catIncList.count(); ++i ) {
2308 if ( !catList.contains (catIncList[i])) { 2312 if ( !catList.contains (catIncList[i])) {
2309 catList.append( catIncList[i] ); 2313 catList.append( catIncList[i] );
2310 //qDebug("add cat %s ", catIncList[i].latin1()); 2314 //qDebug("add cat %s ", catIncList[i].latin1());
@@ -2319,12 +2323,15 @@ void KABCore::manageCategories( )
2319 } else { 2323 } else {
2320 QStringList catList = KABPrefs::instance()->mCustomCategories; 2324 QStringList catList = KABPrefs::instance()->mCustomCategories;
2321 QStringList catIncList; 2325 QStringList catIncList;
2322 QStringList newCatList; 2326 QStringList newCatList;
2323 KABC::AddressBook::Iterator it; 2327 KABC::AddressBook::Iterator it;
2324 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2328 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2329 ++cc;
2330 if ( cc %10 == 0)
2331 message(i18n("Processing contact #%1").arg(cc));
2325 QStringList catIncList = (*it).categories(); 2332 QStringList catIncList = (*it).categories();
2326 int i; 2333 int i;
2327 if ( catIncList.count() ) { 2334 if ( catIncList.count() ) {
2328 newCatList.clear(); 2335 newCatList.clear();
2329 for( i = 0; i< catIncList.count(); ++i ) { 2336 for( i = 0; i< catIncList.count(); ++i ) {
2330 if ( catList.contains (catIncList[i])) { 2337 if ( catList.contains (catIncList[i])) {
@@ -2371,13 +2378,15 @@ void KABCore::setFormattedName()
2371 mAddressBook->setUntagged(); 2378 mAddressBook->setUntagged();
2372 dlg.tagSelected(); 2379 dlg.tagSelected();
2373 int count = 0; 2380 int count = 0;
2374 KABC::AddressBook::Iterator it; 2381 KABC::AddressBook::Iterator it;
2375 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2382 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2376 if ( (*it).tagged() ) { 2383 if ( (*it).tagged() ) {
2377 message(i18n("Changing contact #%1").arg( ++count ) ); 2384 ++count;
2385 if ( count %10 == 0 )
2386 message(i18n("Changing contact #%1").arg( count ) );
2378 qApp->processEvents(); 2387 qApp->processEvents();
2379 QString fName; 2388 QString fName;
2380 if ( setpref.simple->isChecked() ) 2389 if ( setpref.simple->isChecked() )
2381 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2390 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2382 else if ( setpref.full->isChecked() ) 2391 else if ( setpref.full->isChecked() )
2383 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2392 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
@@ -2389,12 +2398,13 @@ void KABCore::setFormattedName()
2389 if ( fName.isEmpty() || fName =="," ) 2398 if ( fName.isEmpty() || fName =="," )
2390 fName = (*it).organization(); 2399 fName = (*it).organization();
2391 (*it).setFormattedName( fName ); 2400 (*it).setFormattedName( fName );
2392 } 2401 }
2393 } 2402 }
2394 message(i18n("Refreshing view...") ); 2403 message(i18n("Refreshing view...") );
2404 qApp->processEvents();
2395 mViewManager->refreshView( "" ); 2405 mViewManager->refreshView( "" );
2396 Addressee add; 2406 Addressee add;
2397 mDetails->setAddressee( add ); 2407 mDetails->setAddressee( add );
2398 message(i18n("Setting formatted name completed!") ); 2408 message(i18n("Setting formatted name completed!") );
2399} 2409}
2400 2410
@@ -3186,38 +3196,49 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
3186 if ( manager != syncManager ) 3196 if ( manager != syncManager )
3187 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); 3197 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager ");
3188 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3198 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3189 3199
3190 AddressBook abLocal( resource,"syncContact"); 3200 AddressBook abLocal( resource,"syncContact");
3191 bool syncOK = false; 3201 bool syncOK = false;
3202 message(i18n("Loading DTM address data..."), false);
3192 if ( abLocal.load() ) { 3203 if ( abLocal.load() ) {
3193 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3204 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
3194 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3205 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3206 message(i18n("Sync preprocessing..."),false);
3195 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 3207 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
3208 message(i18n("Synchronizing..."),false);
3196 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3209 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3197 if ( syncOK ) { 3210 if ( syncOK ) {
3198 if ( syncManager->mWriteBackFile ) { 3211 if ( syncManager->mWriteBackFile ) {
3199 abLocal.removeSyncAddressees( false ); 3212 abLocal.removeSyncAddressees( false );
3213 message(i18n("Saving DTM address data..."),false);
3200 abLocal.saveAB(); 3214 abLocal.saveAB();
3215 message(i18n("Sync postprocessing..."),false);
3201 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3216 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3202 } 3217 }
3203 } else 3218 } else
3204 message( i18n("Sync cancelled or failed.") ); 3219 message( i18n("Sync cancelled or failed.") );
3205 setModified(); 3220 setModified();
3206 } 3221 }
3207 abLocal.removeResources(); 3222 abLocal.removeResources();
3208 if ( syncOK ) 3223 if ( syncOK ) {
3209 mViewManager->refreshView(); 3224 mViewManager->refreshView();
3225 message(i18n("DTM syncing finished."));
3226 }
3210 disableBR( false ); 3227 disableBR( false );
3211 return syncOK; 3228 return syncOK;
3212 3229
3213} 3230}
3214void KABCore::message( QString m ) 3231void KABCore::message( QString m, bool startTimer)
3215{ 3232{
3216 topLevelWidget()->setCaption( m ); 3233 topLevelWidget()->setCaption( m );
3217 mMessageTimer->start( 20000, true ); 3234 qApp->processEvents();
3235 if ( startTimer )
3236 mMessageTimer->start( 15000, true );
3237 else
3238 mMessageTimer->stop();
3218} 3239}
3219bool KABCore::syncPhone() 3240bool KABCore::syncPhone()
3220{ 3241{
3221 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 3242 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
3222 QString fileName = getPhoneFile(); 3243 QString fileName = getPhoneFile();
3223 if ( !PhoneAccess::readFromPhone( fileName) ) { 3244 if ( !PhoneAccess::readFromPhone( fileName) ) {
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index ecfe6e9..786549a 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -497,13 +497,13 @@ class KABCore : public QWidget, public KSyncInterface
497 497
498 //this are the overwritten callbackmethods from the syncinterface 498 //this are the overwritten callbackmethods from the syncinterface
499 virtual bool sync(KSyncManager* manager, QString filename, int mode); 499 virtual bool sync(KSyncManager* manager, QString filename, int mode);
500 virtual bool syncExternal(KSyncManager* manager, QString resource); 500 virtual bool syncExternal(KSyncManager* manager, QString resource);
501 virtual void removeSyncInfo( QString syncProfile); 501 virtual void removeSyncInfo( QString syncProfile);
502 bool syncPhone(); 502 bool syncPhone();
503 void message( QString m ); 503 void message( QString m , bool startTimer = true);
504 504
505 // LR ******************************* 505 // LR *******************************
506 // sync stuff! 506 // sync stuff!
507 QString sentSyncFile(); 507 QString sentSyncFile();
508 QPopupMenu *syncMenu; 508 QPopupMenu *syncMenu;
509 KSyncManager* syncManager; 509 KSyncManager* syncManager;