-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 @@ -1080,5 +1080,6 @@ void KABCore::save() return; - syncManager->setBlockSave(true); if ( !mModified ) return; + + syncManager->setBlockSave(true); QString text = i18n( "There was an error while attempting to save\n the " @@ -2336,13 +2337,5 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo 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; @@ -2350,6 +2343,7 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo 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 ]; @@ -2445,5 +2439,4 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo 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; @@ -2451,6 +2444,6 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo qApp->processEvents(); - if ( ! bar.isVisible() ) + if (syncManager->isProgressBarCanceled()) return false; if ( incCounter % modulo == 0 ) - bar.setProgress( incCounter ); + syncManager->showProgressBar(incCounter); uid = el[ incCounter ]; @@ -2501,3 +2494,3 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo el.clear(); - bar.hide(); + syncManager->hideProgressBar(); mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); |