summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-17 19:49:42 (UTC)
committer zautrix <zautrix>2005-01-17 19:49:42 (UTC)
commit522486966ecf041a6e49913b6e420d58d4284837 (patch) (side-by-side diff)
treed15da3e6ef9ec4638eba4aaf9f14ef0c5eaecd04
parent32479683283fc9f20d369ac9671ba0f8a33d3381 (diff)
downloadkdepimpi-522486966ecf041a6e49913b6e420d58d4284837.zip
kdepimpi-522486966ecf041a6e49913b6e420d58d4284837.tar.gz
kdepimpi-522486966ecf041a6e49913b6e420d58d4284837.tar.bz2
const fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp4
-rw-r--r--kabc/addressbook.h2
-rw-r--r--kabc/addressee.cpp10
-rw-r--r--kabc/addressee.h10
-rw-r--r--kaddressbook/kabcore.cpp33
-rw-r--r--kaddressbook/kabcore.h2
-rw-r--r--libkdepim/ksyncmanager.cpp5
-rw-r--r--libkdepim/ksyncprefsdialog.cpp2
-rw-r--r--microkde/kidmanager.cpp10
-rw-r--r--microkde/kidmanager.h10
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
@@ -957,15 +957,15 @@ bool AddressBook::containsExternalUid( const QString& uid )
for ( it = begin(); it != end(); ++it ) {
if ( uid == (*it).externalUID( ) )
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);
}
return Addressee();
}
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 2351add..18c03b5 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -301,13 +301,13 @@ class AddressBook : public QObject
// sync stuff
//Addressee::List getExternLastSyncAddressees();
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 );
signals:
/**
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index d60cd6b..3b238f5 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -586,50 +586,50 @@ void Addressee::setTempSyncStat( int id )
}
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 );
}
void Addressee::setCsum( const QString & prof , const QString & id )
{
detach();
//qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
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 );
}
void Addressee::setIDStr( const QString & s )
{
detach();
mData->mExternalId = s;
}
-QString Addressee::IDStr() const
+const QString Addressee::IDStr() const
{
return mData->mExternalId;
}
void Addressee::setExternalUID( const QString &id )
{
if ( id == mData->externalUID ) return;
detach();
mData->empty = false;
mData->externalUID = id;
}
-QString Addressee::externalUID() const
+const QString Addressee::externalUID() const
{
return mData->externalUID;
}
void Addressee::setOriginalExternalUID( const QString &id )
{
if ( id == mData->originalExternalUID ) return;
@@ -650,13 +650,13 @@ void Addressee::setUid( const QString &id )
detach();
//qDebug("****setuid %s ", id.latin1());
mData->empty = false;
mData->uid = id;
}
-QString Addressee::uid() const
+const QString Addressee::uid() const
{
if ( mData->uid.isEmpty() )
mData->uid = KApplication::randomString( 10 );
return mData->uid;
}
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 08d2f56..8051fec 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -97,26 +97,26 @@ class Addressee
bool operator==( const Addressee & ) const;
bool operator!=( const Addressee & ) const;
// 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();
void simplifyAddresses();
void simplifyPhoneNumbers();
@@ -128,13 +128,13 @@ class Addressee
Set unique identifier.
*/
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
@@ -1371,14 +1371,14 @@ void KABCore::save()
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. " );
- 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" ) );
}
#else //KAB_EMBEDDED
@@ -2294,17 +2294,21 @@ void KABCore::manageCategories( )
cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
if ( !cp->exec() ) {
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])) {
catList.append( catIncList[i] );
//qDebug("add cat %s ", catIncList[i].latin1());
@@ -2319,12 +2323,15 @@ void KABCore::manageCategories( )
} else {
QStringList catList = KABPrefs::instance()->mCustomCategories;
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();
for( i = 0; i< catIncList.count(); ++i ) {
if ( catList.contains (catIncList[i])) {
@@ -2371,13 +2378,15 @@ void KABCore::setFormattedName()
mAddressBook->setUntagged();
dlg.tagSelected();
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 );
else if ( setpref.full->isChecked() )
fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
@@ -2389,12 +2398,13 @@ void KABCore::setFormattedName()
if ( fName.isEmpty() || fName =="," )
fName = (*it).organization();
(*it).setFormattedName( fName );
}
}
message(i18n("Refreshing view...") );
+ qApp->processEvents();
mViewManager->refreshView( "" );
Addressee add;
mDetails->setAddressee( add );
message(i18n("Setting formatted name completed!") );
}
@@ -3186,38 +3196,49 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
if ( manager != syncManager )
qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager ");
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();
QString fileName = getPhoneFile();
if ( !PhoneAccess::readFromPhone( fileName) ) {
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index ecfe6e9..786549a 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -497,13 +497,13 @@ class KABCore : public QWidget, public KSyncInterface
//this are the overwritten callbackmethods from the syncinterface
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();
QPopupMenu *syncMenu;
KSyncManager* syncManager;
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 6c1f444..f488a07 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -991,22 +991,23 @@ void KSyncManager::syncPhone()
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()
{
return !bar->isVisible();
}
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 2101bbb..3db58ec 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -182,13 +182,13 @@ void KSyncPrefsDialog::setupSyncAlgTab()
QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame);
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);
// ++iii;
diff --git a/microkde/kidmanager.cpp b/microkde/kidmanager.cpp
index e687e5d..d712771 100644
--- a/microkde/kidmanager.cpp
+++ b/microkde/kidmanager.cpp
@@ -3,13 +3,13 @@
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;
int startID;
int lenID;
@@ -22,13 +22,13 @@ QString KIdManager::setId (const QString& idString,const QString& prof,const QSt
} else {
newIDString = idString + prof+";"+ QString::number( idvalue.length() ) +";"+idvalue +";0:";
}
//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;
int startID;
int lenID;
@@ -41,13 +41,13 @@ QString KIdManager::getId (const QString& idString,const QString& prof )
//qDebug("getID:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() );
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;
int startID;
int lenID;
@@ -61,13 +61,13 @@ QString KIdManager::removeId (const QString& idString,const QString& prof )
newIDString = idString;
}
//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;
int startID;
int lenID;
@@ -80,13 +80,13 @@ QString KIdManager::setCsum (const QString& idString,const QString& prof,const Q
} else {
newIDString = idString + prof + ";3;_u_;"+ idCsum + ":";
}
//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;
int startID;
int lenID;
diff --git a/microkde/kidmanager.h b/microkde/kidmanager.h
index 00580a0..9786c9f 100644
--- a/microkde/kidmanager.h
+++ b/microkde/kidmanager.h
@@ -6,17 +6,17 @@
#include <qobject.h>
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:
};