summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorulf69 <ulf69>2004-10-03 23:29:56 (UTC)
committer ulf69 <ulf69>2004-10-03 23:29:56 (UTC)
commitaaea91151fe9a747e9eddfb8ba7d5896744faf30 (patch) (unidiff)
treeb2b064757d65bc83427e7a86692601364051b631 /kaddressbook
parenta5c204da5a2dba950fc5ad2c45861dbe56849c09 (diff)
downloadkdepimpi-aaea91151fe9a747e9eddfb8ba7d5896744faf30.zip
kdepimpi-aaea91151fe9a747e9eddfb8ba7d5896744faf30.tar.gz
kdepimpi-aaea91151fe9a747e9eddfb8ba7d5896744faf30.tar.bz2
moved sync related progressbar management to ksyncmanager, and proceeded with
the sync implementation of pwmanager
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f222234..f8359de 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1078,9 +1078,10 @@ void KABCore::save()
1078{ 1078{
1079 if (syncManager->blockSave()) 1079 if (syncManager->blockSave())
1080 return; 1080 return;
1081 syncManager->setBlockSave(true);
1082 if ( !mModified ) 1081 if ( !mModified )
1083 return; 1082 return;
1083
1084 syncManager->setBlockSave(true);
1084 QString text = i18n( "There was an error while attempting to save\n the " 1085 QString text = i18n( "There was an error while attempting to save\n the "
1085 "address book. Please check that some \nother application is " 1086 "address book. Please check that some \nother application is "
1086 "not using it. " ); 1087 "not using it. " );
@@ -2334,24 +2335,17 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2334 QStringList er = remote->uidList(); 2335 QStringList er = remote->uidList();
2335 Addressee inR ;//= er.first(); 2336 Addressee inR ;//= er.first();
2336 Addressee inL; 2337 Addressee inL;
2337 QProgressBar bar( er.count(),0 ); 2338
2338 bar.setCaption (i18n("Syncing - close to abort!") ); 2339 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
2339 2340
2340 int w = 300;
2341 if ( QApplication::desktop()->width() < 320 )
2342 w = 220;
2343 int h = bar.sizeHint().height() ;
2344 int dw = QApplication::desktop()->width();
2345 int dh = QApplication::desktop()->height();
2346 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2347 bar.show();
2348 int modulo = (er.count()/10)+1; 2341 int modulo = (er.count()/10)+1;
2349 int incCounter = 0; 2342 int incCounter = 0;
2350 while ( incCounter < er.count()) { 2343 while ( incCounter < er.count()) {
2351 if ( ! bar.isVisible() ) 2344 if (syncManager->isProgressBarCanceled())
2352 return false; 2345 return false;
2353 if ( incCounter % modulo == 0 ) 2346 if ( incCounter % modulo == 0 )
2354 bar.setProgress( incCounter ); 2347 syncManager->showProgressBar(incCounter);
2348
2355 uid = er[ incCounter ]; 2349 uid = er[ incCounter ];
2356 bool skipIncidence = false; 2350 bool skipIncidence = false;
2357 if ( uid.left(19) == QString("last-syncAddressee-") ) 2351 if ( uid.left(19) == QString("last-syncAddressee-") )
@@ -2443,16 +2437,15 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2443 er.clear(); 2437 er.clear();
2444 QStringList el = local->uidList(); 2438 QStringList el = local->uidList();
2445 modulo = (el.count()/10)+1; 2439 modulo = (el.count()/10)+1;
2446 bar.setCaption (i18n("Add / remove addressees") ); 2440
2447 bar.setTotalSteps ( el.count() ) ; 2441 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count());
2448 bar.show();
2449 incCounter = 0; 2442 incCounter = 0;
2450 while ( incCounter < el.count()) { 2443 while ( incCounter < el.count()) {
2451 qApp->processEvents(); 2444 qApp->processEvents();
2452 if ( ! bar.isVisible() ) 2445 if (syncManager->isProgressBarCanceled())
2453 return false; 2446 return false;
2454 if ( incCounter % modulo == 0 ) 2447 if ( incCounter % modulo == 0 )
2455 bar.setProgress( incCounter ); 2448 syncManager->showProgressBar(incCounter);
2456 uid = el[ incCounter ]; 2449 uid = el[ incCounter ];
2457 bool skipIncidence = false; 2450 bool skipIncidence = false;
2458 if ( uid.left(19) == QString("last-syncAddressee-") ) 2451 if ( uid.left(19) == QString("last-syncAddressee-") )
@@ -2499,7 +2492,7 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2499 ++incCounter; 2492 ++incCounter;
2500 } 2493 }
2501 el.clear(); 2494 el.clear();
2502 bar.hide(); 2495 syncManager->hideProgressBar();
2503 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 2496 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
2504 // get rid of micro seconds 2497 // get rid of micro seconds
2505 QTime t = mLastAddressbookSync.time(); 2498 QTime t = mLastAddressbookSync.time();