summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (show 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()
{
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. " );
@@ -2334,24 +2335,17 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
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-") )
@@ -2443,16 +2437,15 @@ 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-") )
@@ -2499,7 +2492,7 @@ 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();