-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 @@ -1077,11 +1077,12 @@ 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 ... ")); @@ -2333,26 +2334,19 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo // 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; @@ -2442,18 +2436,17 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo } 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; @@ -2498,9 +2491,9 @@ 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 () ) ); |