author | ulf69 <ulf69> | 2004-10-03 23:29:56 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-03 23:29:56 (UTC) |
commit | aaea91151fe9a747e9eddfb8ba7d5896744faf30 (patch) (side-by-side diff) | |
tree | b2b064757d65bc83427e7a86692601364051b631 /kaddressbook | |
parent | a5c204da5a2dba950fc5ad2c45861dbe56849c09 (diff) | |
download | kdepimpi-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
-rw-r--r-- | kaddressbook/kabcore.cpp | 33 |
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 @@ -1075,15 +1075,16 @@ void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) } void KABCore::save() { if (syncManager->blockSave()) return; - syncManager->setBlockSave(true); if ( !mModified ) return; + + syncManager->setBlockSave(true); QString text = i18n( "There was an error while attempting to save\n the " "address book. Please check that some \nother application is " "not using it. " ); statusMessage(i18n("Saving addressbook ... ")); #ifndef KAB_EMBEDDED KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); @@ -2331,30 +2332,23 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo //qDebug("*************************** "); // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); QStringList er = remote->uidList(); Addressee inR ;//= er.first(); Addressee inL; - QProgressBar bar( er.count(),0 ); - bar.setCaption (i18n("Syncing - close to abort!") ); - - int w = 300; - if ( QApplication::desktop()->width() < 320 ) - w = 220; - int h = bar.sizeHint().height() ; - int dw = QApplication::desktop()->width(); - int dh = QApplication::desktop()->height(); - bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); - bar.show(); + + syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); + int modulo = (er.count()/10)+1; int incCounter = 0; while ( incCounter < er.count()) { - if ( ! bar.isVisible() ) + if (syncManager->isProgressBarCanceled()) return false; if ( incCounter % modulo == 0 ) - bar.setProgress( incCounter ); + syncManager->showProgressBar(incCounter); + uid = er[ incCounter ]; bool skipIncidence = false; if ( uid.left(19) == QString("last-syncAddressee-") ) skipIncidence = true; QString idS,OidS; qApp->processEvents(); @@ -2440,22 +2434,21 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo } ++incCounter; } er.clear(); QStringList el = local->uidList(); modulo = (el.count()/10)+1; - bar.setCaption (i18n("Add / remove addressees") ); - bar.setTotalSteps ( el.count() ) ; - bar.show(); + + syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); incCounter = 0; while ( incCounter < el.count()) { qApp->processEvents(); - if ( ! bar.isVisible() ) + if (syncManager->isProgressBarCanceled()) return false; if ( incCounter % modulo == 0 ) - bar.setProgress( incCounter ); + syncManager->showProgressBar(incCounter); uid = el[ incCounter ]; bool skipIncidence = false; if ( uid.left(19) == QString("last-syncAddressee-") ) skipIncidence = true; if ( !skipIncidence ) { inL = local->findByUid( uid ); @@ -2496,13 +2489,13 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo } } } ++incCounter; } el.clear(); - bar.hide(); + syncManager->hideProgressBar(); mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); // get rid of micro seconds QTime t = mLastAddressbookSync.time(); mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); addresseeLSync.setRevision( mLastAddressbookSync ); addresseeRSync.setRevision( mLastAddressbookSync ); |