-rw-r--r-- | kabc/addressbook.cpp | 4 | ||||
-rw-r--r-- | kabc/addressbook.h | 2 | ||||
-rw-r--r-- | kabc/addressee.cpp | 10 | ||||
-rw-r--r-- | kabc/addressee.h | 10 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 33 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 5 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 2 | ||||
-rw-r--r-- | microkde/kidmanager.cpp | 10 | ||||
-rw-r--r-- | microkde/kidmanager.h | 10 |
10 files changed, 55 insertions, 33 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 4de7da2..9e61261 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -959,11 +959,11 @@ bool AddressBook::containsExternalUid( const QString& uid ) return true; } return false; } -Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) +const Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) const { - Iterator it; + ConstIterator it; for ( it = begin(); it != end(); ++it ) { if ( uid == (*it).getID( profile ) ) return (*it); } diff --git a/kabc/addressbook.h b/kabc/addressbook.h index 2351add..18c03b5 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h @@ -303,9 +303,9 @@ class AddressBook : public QObject void resetTempSyncStat(); QStringList uidList(); void removeSyncAddressees( bool removeDeleted = false ); void mergeAB( AddressBook *aBook, const QString& profile, bool isSubset ); - Addressee findByExternUid( const QString& uid , const QString& profile ); + const Addressee findByExternUid( const QString& uid , const QString& profile ) const; bool containsExternalUid( const QString& uid ); void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset ); void postExternSync( AddressBook* aBook, const QString& csd , bool setID ); diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index d60cd6b..3b238f5 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -588,9 +588,9 @@ int Addressee::tempSyncStat() const { return mData->mTempSyncStat; } -QString Addressee::getID( const QString & prof) +const QString Addressee::getID( const QString & prof) const { return KIdManager::getId ( mData->mExternalId, prof ); } @@ -601,9 +601,9 @@ void Addressee::setCsum( const QString & prof , const QString & id ) mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); } -QString Addressee::getCsum( const QString & prof) +const QString Addressee::getCsum( const QString & prof) const { return KIdManager::getCsum ( mData->mExternalId, prof ); } @@ -612,9 +612,9 @@ void Addressee::setIDStr( const QString & s ) detach(); mData->mExternalId = s; } -QString Addressee::IDStr() const +const QString Addressee::IDStr() const { return mData->mExternalId; } @@ -625,9 +625,9 @@ void Addressee::setExternalUID( const QString &id ) mData->empty = false; mData->externalUID = id; } -QString Addressee::externalUID() const +const QString Addressee::externalUID() const { return mData->externalUID; } void Addressee::setOriginalExternalUID( const QString &id ) @@ -652,9 +652,9 @@ void Addressee::setUid( const QString &id ) mData->empty = false; mData->uid = id; } -QString Addressee::uid() const +const QString Addressee::uid() const { if ( mData->uid.isEmpty() ) mData->uid = KApplication::randomString( 10 ); diff --git a/kabc/addressee.h b/kabc/addressee.h index 08d2f56..8051fec 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h @@ -99,22 +99,22 @@ class Addressee // sync stuff void setTempSyncStat(int id); int tempSyncStat() const; void setIDStr( const QString & ); - QString IDStr() const; + const QString IDStr() const; void setID( const QString &, const QString & ); - QString getID( const QString & ); + const QString getID( const QString & ) const; void setCsum( const QString &, const QString & ); - QString getCsum( const QString & ); + const QString getCsum( const QString & ) const ; void removeID(const QString &); void computeCsum(const QString &dev); ulong getCsum4List( const QStringList & attList); /** Return, if the address book entry is empty. */ bool isEmpty() const; void setExternalUID( const QString &id ); - QString externalUID() const; + const QString externalUID() const; void setOriginalExternalUID( const QString &id ); QString originalExternalUID() const; void mergeContact( const Addressee& ad, bool isSubSet ); void simplifyEmails(); @@ -130,9 +130,9 @@ class Addressee void setUid( const QString &uid ); /** Return unique identifier. */ - QString uid() const; + const QString uid() const; /** Return translated label for uid field. */ static QString uidLabel(); diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d393660..42e147f 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -1373,10 +1373,10 @@ void KABCore::save() 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. " ); - message(i18n("Saving ... please wait! ")); - qApp->processEvents(); + message(i18n("Saving ... please wait! "), false); + //qApp->processEvents(); #ifndef KAB_EMBEDDED KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); if ( !b || !b->save() ) { KMessageBox::error( this, text, i18n( "Unable to Save" ) ); @@ -2296,13 +2296,17 @@ void KABCore::manageCategories( ) delete cp; return; } int count = 0; + int cc = 0; message( i18n("Please wait, processing categories...")); if ( cp->addCat() ) { KABC::AddressBook::Iterator it; QStringList catList = KABPrefs::instance()->mCustomCategories; for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { + ++cc; + if ( cc %10 == 0) + message(i18n("Processing contact #%1").arg(cc)); QStringList catIncList = (*it).categories(); int i; for( i = 0; i< catIncList.count(); ++i ) { if ( !catList.contains (catIncList[i])) { @@ -2321,8 +2325,11 @@ void KABCore::manageCategories( ) QStringList catIncList; QStringList newCatList; KABC::AddressBook::Iterator it; for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { + ++cc; + if ( cc %10 == 0) + message(i18n("Processing contact #%1").arg(cc)); QStringList catIncList = (*it).categories(); int i; if ( catIncList.count() ) { newCatList.clear(); @@ -2373,9 +2380,11 @@ void KABCore::setFormattedName() int count = 0; KABC::AddressBook::Iterator it; for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { if ( (*it).tagged() ) { - message(i18n("Changing contact #%1").arg( ++count ) ); + ++count; + if ( count %10 == 0 ) + message(i18n("Changing contact #%1").arg( count ) ); qApp->processEvents(); QString fName; if ( setpref.simple->isChecked() ) fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); @@ -2391,8 +2400,9 @@ void KABCore::setFormattedName() (*it).setFormattedName( fName ); } } message(i18n("Refreshing view...") ); + qApp->processEvents(); mViewManager->refreshView( "" ); Addressee add; mDetails->setAddressee( add ); message(i18n("Setting formatted name completed!") ); @@ -3188,34 +3198,45 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource) QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); AddressBook abLocal( resource,"syncContact"); bool syncOK = false; + message(i18n("Loading DTM address data..."), false); if ( abLocal.load() ) { qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); mGlobalSyncMode = SYNC_MODE_EXTERNAL; + message(i18n("Sync preprocessing..."),false); abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); + message(i18n("Synchronizing..."),false); syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); if ( syncOK ) { if ( syncManager->mWriteBackFile ) { abLocal.removeSyncAddressees( false ); + message(i18n("Saving DTM address data..."),false); abLocal.saveAB(); + message(i18n("Sync postprocessing..."),false); abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); } } else message( i18n("Sync cancelled or failed.") ); setModified(); } abLocal.removeResources(); - if ( syncOK ) + if ( syncOK ) { mViewManager->refreshView(); + message(i18n("DTM syncing finished.")); + } disableBR( false ); return syncOK; } -void KABCore::message( QString m ) +void KABCore::message( QString m, bool startTimer) { topLevelWidget()->setCaption( m ); - mMessageTimer->start( 20000, true ); + qApp->processEvents(); + if ( startTimer ) + mMessageTimer->start( 15000, true ); + else + mMessageTimer->stop(); } bool KABCore::syncPhone() { QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index ecfe6e9..786549a 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h @@ -499,9 +499,9 @@ class KABCore : public QWidget, public KSyncInterface virtual bool sync(KSyncManager* manager, QString filename, int mode); virtual bool syncExternal(KSyncManager* manager, QString resource); virtual void removeSyncInfo( QString syncProfile); bool syncPhone(); - void message( QString m ); + void message( QString m , bool startTimer = true); // LR ******************************* // sync stuff! QString sentSyncFile(); diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 6c1f444..f488a07 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -993,18 +993,19 @@ void KSyncManager::showProgressBar(int percentage, QString caption, int total) if (!bar->isVisible()) { bar->setCaption (caption); bar->setTotalSteps ( total ) ; - bar->show(); } - + bar->raise(); bar->setProgress( percentage ); + qApp->processEvents(); } void KSyncManager::hideProgressBar() { bar->hide(); + qApp->processEvents(); } bool KSyncManager::isProgressBarCanceled() { diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 2101bbb..3db58ec 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -184,9 +184,9 @@ void KSyncPrefsDialog::setupSyncAlgTab() QVBox * fibo2 = new QVBox ( gb5 ); new QLabel ( i18n("Incoming calendar filter:"), fibo2 ); mFilterInCal = new QComboBox( fibo2 ); fibo2 = new QVBox ( gb5 ); - new QLabel ( i18n("Incoming adressbook filter:"), fibo2 ); + new QLabel ( i18n("Incoming addressbook filter:"), fibo2 ); mFilterInAB = new QComboBox( fibo2 ); mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); diff --git a/microkde/kidmanager.cpp b/microkde/kidmanager.cpp index e687e5d..d712771 100644 --- a/microkde/kidmanager.cpp +++ b/microkde/kidmanager.cpp @@ -5,9 +5,9 @@ KIdManager::KIdManager() } // :profilename;12;id_withLen12;123456: // 123456 is the csum -QString KIdManager::setId (const QString& idString,const QString& prof,const QString& idvalue ) +const QString KIdManager::setId (const QString& idString,const QString& prof,const QString& idvalue ) { int startProf; int startIDnum; int startIDnumlen; @@ -24,9 +24,9 @@ QString KIdManager::setId (const QString& idString,const QString& prof,const QSt } //qDebug("setID:profile:%s*retval:%s*idvalue:%s* ", prof.latin1(), newIDString.latin1() ,idvalue.latin1() ); return newIDString; } -QString KIdManager::getId (const QString& idString,const QString& prof ) +const QString KIdManager::getId (const QString& idString,const QString& prof ) { int startProf; int startIDnum; int startIDnumlen; @@ -43,9 +43,9 @@ QString KIdManager::getId (const QString& idString,const QString& prof ) return idval; } -QString KIdManager::removeId (const QString& idString,const QString& prof ) +const QString KIdManager::removeId (const QString& idString,const QString& prof ) { int startProf; int startIDnum; int startIDnumlen; @@ -63,9 +63,9 @@ QString KIdManager::removeId (const QString& idString,const QString& prof ) //qDebug("removeID:profile:%s*retval:%s*oldidstring:%s* ", prof.latin1(), newIDString.latin1() ,idString.latin1() ); return newIDString; } -QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum ) +const QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum ) { int startProf; int startIDnum; int startIDnumlen; @@ -82,9 +82,9 @@ QString KIdManager::setCsum (const QString& idString,const QString& prof,const Q } //qDebug("setCsum:profile:%s*retval:%s*idCsum:%s* ", prof.latin1(), newIDString.latin1() ,idCsum.latin1() ); return newIDString; } -QString KIdManager::getCsum (const QString& idString,const QString& prof ) +const QString KIdManager::getCsum (const QString& idString,const QString& prof ) { int startProf; int startIDnum; int startIDnumlen; diff --git a/microkde/kidmanager.h b/microkde/kidmanager.h index 00580a0..9786c9f 100644 --- a/microkde/kidmanager.h +++ b/microkde/kidmanager.h @@ -8,13 +8,13 @@ class KIdManager : public QObject { Q_OBJECT public: KIdManager( ); - static QString setId (const QString& idString,const QString& id,const QString& idvalue ) ; - static QString getId (const QString& idString,const QString& id ) ; - static QString removeId (const QString& idString,const QString& id ) ; - static QString setCsum (const QString& idString,const QString& id,const QString& idvalue ) ; - static QString getCsum (const QString& idString,const QString& id ) ; + static const QString setId (const QString& idString,const QString& id,const QString& idvalue ) ; + static const QString getId (const QString& idString,const QString& id ) ; + static const QString removeId (const QString& idString,const QString& id ) ; + static const QString setCsum (const QString& idString,const QString& id,const QString& idvalue ) ; + static const QString getCsum (const QString& idString,const QString& id ) ; static bool getNumbers (const QString& idString,const QString& id, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) ; private: private slots: |