summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show 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
@@ -951,27 +951,27 @@ void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool
951 951
952} 952}
953 953
954bool AddressBook::containsExternalUid( const QString& uid ) 954bool AddressBook::containsExternalUid( const QString& uid )
955{ 955{
956 Iterator it; 956 Iterator it;
957 for ( it = begin(); it != end(); ++it ) { 957 for ( it = begin(); it != end(); ++it ) {
958 if ( uid == (*it).externalUID( ) ) 958 if ( uid == (*it).externalUID( ) )
959 return true; 959 return true;
960 } 960 }
961 return false; 961 return false;
962} 962}
963Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) 963const Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) const
964{ 964{
965 Iterator it; 965 ConstIterator it;
966 for ( it = begin(); it != end(); ++it ) { 966 for ( it = begin(); it != end(); ++it ) {
967 if ( uid == (*it).getID( profile ) ) 967 if ( uid == (*it).getID( profile ) )
968 return (*it); 968 return (*it);
969 } 969 }
970 return Addressee(); 970 return Addressee();
971} 971}
972void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset ) 972void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset )
973{ 973{
974 Iterator it; 974 Iterator it;
975 Addressee ad; 975 Addressee ad;
976 for ( it = begin(); it != end(); ++it ) { 976 for ( it = begin(); it != end(); ++it ) {
977 ad = aBook->findByExternUid( (*it).externalUID(), profile ); 977 ad = aBook->findByExternUid( (*it).externalUID(), profile );
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 2351add..18c03b5 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -295,25 +295,25 @@ class AddressBook : public QObject
295 295
296 /** 296 /**
297 Query all resources to clean up their lock files 297 Query all resources to clean up their lock files
298 */ 298 */
299 void cleanUp(); 299 void cleanUp();
300 300
301 // sync stuff 301 // sync stuff
302 //Addressee::List getExternLastSyncAddressees(); 302 //Addressee::List getExternLastSyncAddressees();
303 void resetTempSyncStat(); 303 void resetTempSyncStat();
304 QStringList uidList(); 304 QStringList uidList();
305 void removeSyncAddressees( bool removeDeleted = false ); 305 void removeSyncAddressees( bool removeDeleted = false );
306 void mergeAB( AddressBook *aBook, const QString& profile, bool isSubset ); 306 void mergeAB( AddressBook *aBook, const QString& profile, bool isSubset );
307 Addressee findByExternUid( const QString& uid , const QString& profile ); 307 const Addressee findByExternUid( const QString& uid , const QString& profile ) const;
308 bool containsExternalUid( const QString& uid ); 308 bool containsExternalUid( const QString& uid );
309 309
310 void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset ); 310 void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset );
311 void postExternSync( AddressBook* aBook, const QString& csd , bool setID ); 311 void postExternSync( AddressBook* aBook, const QString& csd , bool setID );
312 signals: 312 signals:
313 /** 313 /**
314 Emitted, when the address book has changed on disk. 314 Emitted, when the address book has changed on disk.
315 */ 315 */
316 void addressBookChanged( AddressBook * ); 316 void addressBookChanged( AddressBook * );
317 317
318 /** 318 /**
319 Emitted, when the address book has been locked for writing. 319 Emitted, when the address book has been locked for writing.
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index d60cd6b..3b238f5 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -580,62 +580,62 @@ void Addressee::setID( const QString & prof , const QString & id )
580} 580}
581void Addressee::setTempSyncStat( int id ) 581void Addressee::setTempSyncStat( int id )
582{ 582{
583 if ( mData->mTempSyncStat == id ) return; 583 if ( mData->mTempSyncStat == id ) return;
584 detach(); 584 detach();
585 mData->mTempSyncStat = id; 585 mData->mTempSyncStat = id;
586} 586}
587int Addressee::tempSyncStat() const 587int Addressee::tempSyncStat() const
588{ 588{
589 return mData->mTempSyncStat; 589 return mData->mTempSyncStat;
590} 590}
591 591
592QString Addressee::getID( const QString & prof) 592const QString Addressee::getID( const QString & prof) const
593{ 593{
594 return KIdManager::getId ( mData->mExternalId, prof ); 594 return KIdManager::getId ( mData->mExternalId, prof );
595} 595}
596 596
597void Addressee::setCsum( const QString & prof , const QString & id ) 597void Addressee::setCsum( const QString & prof , const QString & id )
598{ 598{
599 detach(); 599 detach();
600 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 600 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
601 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); 601 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
602 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); 602 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
603} 603}
604 604
605QString Addressee::getCsum( const QString & prof) 605const QString Addressee::getCsum( const QString & prof) const
606{ 606{
607 return KIdManager::getCsum ( mData->mExternalId, prof ); 607 return KIdManager::getCsum ( mData->mExternalId, prof );
608} 608}
609 609
610void Addressee::setIDStr( const QString & s ) 610void Addressee::setIDStr( const QString & s )
611{ 611{
612 detach(); 612 detach();
613 mData->mExternalId = s; 613 mData->mExternalId = s;
614} 614}
615 615
616QString Addressee::IDStr() const 616const QString Addressee::IDStr() const
617{ 617{
618 return mData->mExternalId; 618 return mData->mExternalId;
619} 619}
620 620
621void Addressee::setExternalUID( const QString &id ) 621void Addressee::setExternalUID( const QString &id )
622{ 622{
623 if ( id == mData->externalUID ) return; 623 if ( id == mData->externalUID ) return;
624 detach(); 624 detach();
625 mData->empty = false; 625 mData->empty = false;
626 mData->externalUID = id; 626 mData->externalUID = id;
627} 627}
628 628
629QString Addressee::externalUID() const 629const QString Addressee::externalUID() const
630{ 630{
631 return mData->externalUID; 631 return mData->externalUID;
632} 632}
633void Addressee::setOriginalExternalUID( const QString &id ) 633void Addressee::setOriginalExternalUID( const QString &id )
634{ 634{
635 if ( id == mData->originalExternalUID ) return; 635 if ( id == mData->originalExternalUID ) return;
636 detach(); 636 detach();
637 mData->empty = false; 637 mData->empty = false;
638 //qDebug("*******Set orig uid %s ", id.latin1()); 638 //qDebug("*******Set orig uid %s ", id.latin1());
639 mData->originalExternalUID = id; 639 mData->originalExternalUID = id;
640} 640}
641 641
@@ -644,25 +644,25 @@ QString Addressee::originalExternalUID() const
644 return mData->originalExternalUID; 644 return mData->originalExternalUID;
645} 645}
646 646
647void Addressee::setUid( const QString &id ) 647void Addressee::setUid( const QString &id )
648{ 648{
649 if ( id == mData->uid ) return; 649 if ( id == mData->uid ) return;
650 detach(); 650 detach();
651 //qDebug("****setuid %s ", id.latin1()); 651 //qDebug("****setuid %s ", id.latin1());
652 mData->empty = false; 652 mData->empty = false;
653 mData->uid = id; 653 mData->uid = id;
654} 654}
655 655
656QString Addressee::uid() const 656const QString Addressee::uid() const
657{ 657{
658 if ( mData->uid.isEmpty() ) 658 if ( mData->uid.isEmpty() )
659 mData->uid = KApplication::randomString( 10 ); 659 mData->uid = KApplication::randomString( 10 );
660 660
661 return mData->uid; 661 return mData->uid;
662} 662}
663 663
664QString Addressee::uidLabel() 664QString Addressee::uidLabel()
665{ 665{
666 return i18n("Unique Identifier"); 666 return i18n("Unique Identifier");
667} 667}
668 668
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 08d2f56..8051fec 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -91,56 +91,56 @@ class Addressee
91 Addressee(); 91 Addressee();
92 ~Addressee(); 92 ~Addressee();
93 93
94 Addressee( const Addressee & ); 94 Addressee( const Addressee & );
95 Addressee &operator=( const Addressee & ); 95 Addressee &operator=( const Addressee & );
96 96
97 bool operator==( const Addressee & ) const; 97 bool operator==( const Addressee & ) const;
98 bool operator!=( const Addressee & ) const; 98 bool operator!=( const Addressee & ) const;
99 // sync stuff 99 // sync stuff
100 void setTempSyncStat(int id); 100 void setTempSyncStat(int id);
101 int tempSyncStat() const; 101 int tempSyncStat() const;
102 void setIDStr( const QString & ); 102 void setIDStr( const QString & );
103 QString IDStr() const; 103 const QString IDStr() const;
104 void setID( const QString &, const QString & ); 104 void setID( const QString &, const QString & );
105 QString getID( const QString & ); 105 const QString getID( const QString & ) const;
106 void setCsum( const QString &, const QString & ); 106 void setCsum( const QString &, const QString & );
107 QString getCsum( const QString & ); 107 const QString getCsum( const QString & ) const ;
108 void removeID(const QString &); 108 void removeID(const QString &);
109 void computeCsum(const QString &dev); 109 void computeCsum(const QString &dev);
110 ulong getCsum4List( const QStringList & attList); 110 ulong getCsum4List( const QStringList & attList);
111 /** 111 /**
112 Return, if the address book entry is empty. 112 Return, if the address book entry is empty.
113 */ 113 */
114 bool isEmpty() const; 114 bool isEmpty() const;
115 void setExternalUID( const QString &id ); 115 void setExternalUID( const QString &id );
116 QString externalUID() const; 116 const QString externalUID() const;
117 void setOriginalExternalUID( const QString &id ); 117 void setOriginalExternalUID( const QString &id );
118 QString originalExternalUID() const; 118 QString originalExternalUID() const;
119 void mergeContact( const Addressee& ad, bool isSubSet ); 119 void mergeContact( const Addressee& ad, bool isSubSet );
120 void simplifyEmails(); 120 void simplifyEmails();
121 void simplifyAddresses(); 121 void simplifyAddresses();
122 void simplifyPhoneNumbers(); 122 void simplifyPhoneNumbers();
123 void simplifyPhoneNumberTypes(); 123 void simplifyPhoneNumberTypes();
124 bool removeVoice(); 124 bool removeVoice();
125 bool containsAdr(const Addressee& addr ); 125 bool containsAdr(const Addressee& addr );
126 126
127 /** 127 /**
128 Set unique identifier. 128 Set unique identifier.
129 */ 129 */
130 void setUid( const QString &uid ); 130 void setUid( const QString &uid );
131 /** 131 /**
132 Return unique identifier. 132 Return unique identifier.
133 */ 133 */
134 QString uid() const; 134 const QString uid() const;
135 /** 135 /**
136 Return translated label for uid field. 136 Return translated label for uid field.
137 */ 137 */
138 static QString uidLabel(); 138 static QString uidLabel();
139 139
140 /** 140 /**
141 Set name. 141 Set name.
142 */ 142 */
143 void setName( const QString &name ); 143 void setName( const QString &name );
144 /** 144 /**
145 Return name. 145 Return name.
146 */ 146 */
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index d393660..42e147f 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1365,26 +1365,26 @@ void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1365 1365
1366void KABCore::save() 1366void KABCore::save()
1367{ 1367{
1368 if (syncManager->blockSave()) 1368 if (syncManager->blockSave())
1369 return; 1369 return;
1370 if ( !mModified ) 1370 if ( !mModified )
1371 return; 1371 return;
1372 1372
1373 syncManager->setBlockSave(true); 1373 syncManager->setBlockSave(true);
1374 QString text = i18n( "There was an error while attempting to save\n the " 1374 QString text = i18n( "There was an error while attempting to save\n the "
1375 "address book. Please check that some \nother application is " 1375 "address book. Please check that some \nother application is "
1376 "not using it. " ); 1376 "not using it. " );
1377 message(i18n("Saving ... please wait! ")); 1377 message(i18n("Saving ... please wait! "), false);
1378 qApp->processEvents(); 1378 //qApp->processEvents();
1379#ifndef KAB_EMBEDDED 1379#ifndef KAB_EMBEDDED
1380 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1380 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1381 if ( !b || !b->save() ) { 1381 if ( !b || !b->save() ) {
1382 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1382 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1383 } 1383 }
1384#else //KAB_EMBEDDED 1384#else //KAB_EMBEDDED
1385 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1385 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1386 if ( !b || !b->save() ) { 1386 if ( !b || !b->save() ) {
1387 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1387 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1388 } 1388 }
1389#endif //KAB_EMBEDDED 1389#endif //KAB_EMBEDDED
1390 1390
@@ -2288,49 +2288,56 @@ void KABCore::manageCategories( )
2288 KABCatPrefs* cp = new KABCatPrefs(); 2288 KABCatPrefs* cp = new KABCatPrefs();
2289 cp->show(); 2289 cp->show();
2290 int w =cp->sizeHint().width() ; 2290 int w =cp->sizeHint().width() ;
2291 int h = cp->sizeHint().height() ; 2291 int h = cp->sizeHint().height() ;
2292 int dw = QApplication::desktop()->width(); 2292 int dw = QApplication::desktop()->width();
2293 int dh = QApplication::desktop()->height(); 2293 int dh = QApplication::desktop()->height();
2294 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2294 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2295 if ( !cp->exec() ) { 2295 if ( !cp->exec() ) {
2296 delete cp; 2296 delete cp;
2297 return; 2297 return;
2298 } 2298 }
2299 int count = 0; 2299 int count = 0;
2300 int cc = 0;
2300 message( i18n("Please wait, processing categories...")); 2301 message( i18n("Please wait, processing categories..."));
2301 if ( cp->addCat() ) { 2302 if ( cp->addCat() ) {
2302 KABC::AddressBook::Iterator it; 2303 KABC::AddressBook::Iterator it;
2303 QStringList catList = KABPrefs::instance()->mCustomCategories; 2304 QStringList catList = KABPrefs::instance()->mCustomCategories;
2304 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2305 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2306 ++cc;
2307 if ( cc %10 == 0)
2308 message(i18n("Processing contact #%1").arg(cc));
2305 QStringList catIncList = (*it).categories(); 2309 QStringList catIncList = (*it).categories();
2306 int i; 2310 int i;
2307 for( i = 0; i< catIncList.count(); ++i ) { 2311 for( i = 0; i< catIncList.count(); ++i ) {
2308 if ( !catList.contains (catIncList[i])) { 2312 if ( !catList.contains (catIncList[i])) {
2309 catList.append( catIncList[i] ); 2313 catList.append( catIncList[i] );
2310 //qDebug("add cat %s ", catIncList[i].latin1()); 2314 //qDebug("add cat %s ", catIncList[i].latin1());
2311 ++count; 2315 ++count;
2312 } 2316 }
2313 } 2317 }
2314 } 2318 }
2315 catList.sort(); 2319 catList.sort();
2316 KABPrefs::instance()->mCustomCategories = catList; 2320 KABPrefs::instance()->mCustomCategories = catList;
2317 KABPrefs::instance()->writeConfig(); 2321 KABPrefs::instance()->writeConfig();
2318 message(QString::number( count )+ i18n(" categories added to list! ")); 2322 message(QString::number( count )+ i18n(" categories added to list! "));
2319 } else { 2323 } else {
2320 QStringList catList = KABPrefs::instance()->mCustomCategories; 2324 QStringList catList = KABPrefs::instance()->mCustomCategories;
2321 QStringList catIncList; 2325 QStringList catIncList;
2322 QStringList newCatList; 2326 QStringList newCatList;
2323 KABC::AddressBook::Iterator it; 2327 KABC::AddressBook::Iterator it;
2324 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2328 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2329 ++cc;
2330 if ( cc %10 == 0)
2331 message(i18n("Processing contact #%1").arg(cc));
2325 QStringList catIncList = (*it).categories(); 2332 QStringList catIncList = (*it).categories();
2326 int i; 2333 int i;
2327 if ( catIncList.count() ) { 2334 if ( catIncList.count() ) {
2328 newCatList.clear(); 2335 newCatList.clear();
2329 for( i = 0; i< catIncList.count(); ++i ) { 2336 for( i = 0; i< catIncList.count(); ++i ) {
2330 if ( catList.contains (catIncList[i])) { 2337 if ( catList.contains (catIncList[i])) {
2331 newCatList.append( catIncList[i] ); 2338 newCatList.append( catIncList[i] );
2332 } 2339 }
2333 } 2340 }
2334 newCatList.sort(); 2341 newCatList.sort();
2335 (*it).setCategories( newCatList ); 2342 (*it).setCategories( newCatList );
2336 mAddressBook->insertAddressee( (*it) ); 2343 mAddressBook->insertAddressee( (*it) );
@@ -2365,42 +2372,45 @@ void KABCore::setFormattedName()
2365 if ( !setpref.exec() ) { 2372 if ( !setpref.exec() ) {
2366 return; 2373 return;
2367 } 2374 }
2368 XXPortSelectDialog dlg( this, false, this ); 2375 XXPortSelectDialog dlg( this, false, this );
2369 if ( !dlg.exec() ) 2376 if ( !dlg.exec() )
2370 return; 2377 return;
2371 mAddressBook->setUntagged(); 2378 mAddressBook->setUntagged();
2372 dlg.tagSelected(); 2379 dlg.tagSelected();
2373 int count = 0; 2380 int count = 0;
2374 KABC::AddressBook::Iterator it; 2381 KABC::AddressBook::Iterator it;
2375 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2382 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2376 if ( (*it).tagged() ) { 2383 if ( (*it).tagged() ) {
2377 message(i18n("Changing contact #%1").arg( ++count ) ); 2384 ++count;
2385 if ( count %10 == 0 )
2386 message(i18n("Changing contact #%1").arg( count ) );
2378 qApp->processEvents(); 2387 qApp->processEvents();
2379 QString fName; 2388 QString fName;
2380 if ( setpref.simple->isChecked() ) 2389 if ( setpref.simple->isChecked() )
2381 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2390 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2382 else if ( setpref.full->isChecked() ) 2391 else if ( setpref.full->isChecked() )
2383 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2392 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2384 else if ( setpref.reverse->isChecked() ) 2393 else if ( setpref.reverse->isChecked() )
2385 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); 2394 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
2386 else 2395 else
2387 fName = (*it).organization(); 2396 fName = (*it).organization();
2388 if ( setpref.setCompany->isChecked() ) 2397 if ( setpref.setCompany->isChecked() )
2389 if ( fName.isEmpty() || fName =="," ) 2398 if ( fName.isEmpty() || fName =="," )
2390 fName = (*it).organization(); 2399 fName = (*it).organization();
2391 (*it).setFormattedName( fName ); 2400 (*it).setFormattedName( fName );
2392 } 2401 }
2393 } 2402 }
2394 message(i18n("Refreshing view...") ); 2403 message(i18n("Refreshing view...") );
2404 qApp->processEvents();
2395 mViewManager->refreshView( "" ); 2405 mViewManager->refreshView( "" );
2396 Addressee add; 2406 Addressee add;
2397 mDetails->setAddressee( add ); 2407 mDetails->setAddressee( add );
2398 message(i18n("Setting formatted name completed!") ); 2408 message(i18n("Setting formatted name completed!") );
2399} 2409}
2400 2410
2401void KABCore::clipboardDataChanged() 2411void KABCore::clipboardDataChanged()
2402{ 2412{
2403 2413
2404 if ( mReadWrite ) 2414 if ( mReadWrite )
2405 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2415 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2406 2416
@@ -3180,50 +3190,61 @@ void KABCore::removeSyncInfo( QString syncProfile)
3180//this is a overwritten callbackmethods from the syncinterface 3190//this is a overwritten callbackmethods from the syncinterface
3181bool KABCore::syncExternal(KSyncManager* manager, QString resource) 3191bool KABCore::syncExternal(KSyncManager* manager, QString resource)
3182{ 3192{
3183 if ( resource == "phone" ) 3193 if ( resource == "phone" )
3184 return syncPhone(); 3194 return syncPhone();
3185 disableBR( true ); 3195 disableBR( true );
3186 if ( manager != syncManager ) 3196 if ( manager != syncManager )
3187 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); 3197 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager ");
3188 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3198 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3189 3199
3190 AddressBook abLocal( resource,"syncContact"); 3200 AddressBook abLocal( resource,"syncContact");
3191 bool syncOK = false; 3201 bool syncOK = false;
3202 message(i18n("Loading DTM address data..."), false);
3192 if ( abLocal.load() ) { 3203 if ( abLocal.load() ) {
3193 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3204 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
3194 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3205 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3206 message(i18n("Sync preprocessing..."),false);
3195 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 3207 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
3208 message(i18n("Synchronizing..."),false);
3196 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3209 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3197 if ( syncOK ) { 3210 if ( syncOK ) {
3198 if ( syncManager->mWriteBackFile ) { 3211 if ( syncManager->mWriteBackFile ) {
3199 abLocal.removeSyncAddressees( false ); 3212 abLocal.removeSyncAddressees( false );
3213 message(i18n("Saving DTM address data..."),false);
3200 abLocal.saveAB(); 3214 abLocal.saveAB();
3215 message(i18n("Sync postprocessing..."),false);
3201 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3216 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3202 } 3217 }
3203 } else 3218 } else
3204 message( i18n("Sync cancelled or failed.") ); 3219 message( i18n("Sync cancelled or failed.") );
3205 setModified(); 3220 setModified();
3206 } 3221 }
3207 abLocal.removeResources(); 3222 abLocal.removeResources();
3208 if ( syncOK ) 3223 if ( syncOK ) {
3209 mViewManager->refreshView(); 3224 mViewManager->refreshView();
3225 message(i18n("DTM syncing finished."));
3226 }
3210 disableBR( false ); 3227 disableBR( false );
3211 return syncOK; 3228 return syncOK;
3212 3229
3213} 3230}
3214void KABCore::message( QString m ) 3231void KABCore::message( QString m, bool startTimer)
3215{ 3232{
3216 topLevelWidget()->setCaption( m ); 3233 topLevelWidget()->setCaption( m );
3217 mMessageTimer->start( 20000, true ); 3234 qApp->processEvents();
3235 if ( startTimer )
3236 mMessageTimer->start( 15000, true );
3237 else
3238 mMessageTimer->stop();
3218} 3239}
3219bool KABCore::syncPhone() 3240bool KABCore::syncPhone()
3220{ 3241{
3221 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 3242 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
3222 QString fileName = getPhoneFile(); 3243 QString fileName = getPhoneFile();
3223 if ( !PhoneAccess::readFromPhone( fileName) ) { 3244 if ( !PhoneAccess::readFromPhone( fileName) ) {
3224 message(i18n("Phone access failed!")); 3245 message(i18n("Phone access failed!"));
3225 return false; 3246 return false;
3226 } 3247 }
3227 AddressBook abLocal( fileName,"syncContact"); 3248 AddressBook abLocal( fileName,"syncContact");
3228 bool syncOK = false; 3249 bool syncOK = false;
3229 { 3250 {
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index ecfe6e9..786549a 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -491,25 +491,25 @@ class KABCore : public QWidget, public KSyncInterface
491 KABCorePrivate *d; 491 KABCorePrivate *d;
492 //US bool mBlockSaveFlag; 492 //US bool mBlockSaveFlag;
493 493
494#ifdef KAB_EMBEDDED 494#ifdef KAB_EMBEDDED
495 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 495 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
496#endif //KAB_EMBEDDED 496#endif //KAB_EMBEDDED
497 497
498 //this are the overwritten callbackmethods from the syncinterface 498 //this are the overwritten callbackmethods from the syncinterface
499 virtual bool sync(KSyncManager* manager, QString filename, int mode); 499 virtual bool sync(KSyncManager* manager, QString filename, int mode);
500 virtual bool syncExternal(KSyncManager* manager, QString resource); 500 virtual bool syncExternal(KSyncManager* manager, QString resource);
501 virtual void removeSyncInfo( QString syncProfile); 501 virtual void removeSyncInfo( QString syncProfile);
502 bool syncPhone(); 502 bool syncPhone();
503 void message( QString m ); 503 void message( QString m , bool startTimer = true);
504 504
505 // LR ******************************* 505 // LR *******************************
506 // sync stuff! 506 // sync stuff!
507 QString sentSyncFile(); 507 QString sentSyncFile();
508 QPopupMenu *syncMenu; 508 QPopupMenu *syncMenu;
509 KSyncManager* syncManager; 509 KSyncManager* syncManager;
510 int mGlobalSyncMode; 510 int mGlobalSyncMode;
511 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 511 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
512 KABC::Addressee getLastSyncAddressee(); 512 KABC::Addressee getLastSyncAddressee();
513 QDateTime mLastAddressbookSync; 513 QDateTime mLastAddressbookSync;
514 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 514 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
515 // ********************* 515 // *********************
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 6c1f444..f488a07 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -985,34 +985,35 @@ void KSyncManager::syncPhone()
985{ 985{
986 986
987 syncExternalApplication("phone"); 987 syncExternalApplication("phone");
988 988
989} 989}
990 990
991void KSyncManager::showProgressBar(int percentage, QString caption, int total) 991void KSyncManager::showProgressBar(int percentage, QString caption, int total)
992{ 992{
993 if (!bar->isVisible()) 993 if (!bar->isVisible())
994 { 994 {
995 bar->setCaption (caption); 995 bar->setCaption (caption);
996 bar->setTotalSteps ( total ) ; 996 bar->setTotalSteps ( total ) ;
997
998 bar->show(); 997 bar->show();
999 } 998 }
1000 999 bar->raise();
1001 bar->setProgress( percentage ); 1000 bar->setProgress( percentage );
1001 qApp->processEvents();
1002} 1002}
1003 1003
1004void KSyncManager::hideProgressBar() 1004void KSyncManager::hideProgressBar()
1005{ 1005{
1006 bar->hide(); 1006 bar->hide();
1007 qApp->processEvents();
1007} 1008}
1008 1009
1009bool KSyncManager::isProgressBarCanceled() 1010bool KSyncManager::isProgressBarCanceled()
1010{ 1011{
1011 return !bar->isVisible(); 1012 return !bar->isVisible();
1012} 1013}
1013 1014
1014QString KSyncManager::syncFileName() 1015QString KSyncManager::syncFileName()
1015{ 1016{
1016 1017
1017 QString fn = "tempfile"; 1018 QString fn = "tempfile";
1018 switch(mTargetApp) 1019 switch(mTargetApp)
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 2101bbb..3db58ec 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -176,25 +176,25 @@ void KSyncPrefsDialog::setupSyncAlgTab()
176 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); 176 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
177 // both = new QRadioButton ( i18n("Take both on conflict"), gr ); 177 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
178 178
179 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); 179 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
180 //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); 180 //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
181 //++iii; 181 //++iii;
182 182
183 QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame); 183 QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame);
184 QVBox * fibo2 = new QVBox ( gb5 ); 184 QVBox * fibo2 = new QVBox ( gb5 );
185 new QLabel ( i18n("Incoming calendar filter:"), fibo2 ); 185 new QLabel ( i18n("Incoming calendar filter:"), fibo2 );
186 mFilterInCal = new QComboBox( fibo2 ); 186 mFilterInCal = new QComboBox( fibo2 );
187 fibo2 = new QVBox ( gb5 ); 187 fibo2 = new QVBox ( gb5 );
188 new QLabel ( i18n("Incoming adressbook filter:"), fibo2 ); 188 new QLabel ( i18n("Incoming addressbook filter:"), fibo2 );
189 mFilterInAB = new QComboBox( fibo2 ); 189 mFilterInAB = new QComboBox( fibo2 );
190 190
191 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); 191 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
192 // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); 192 // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
193 // ++iii; 193 // ++iii;
194 194
195 QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame); 195 QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame);
196 //topLayout->addMultiCellWidget(gb2, iii,iii,0,1); 196 //topLayout->addMultiCellWidget(gb2, iii,iii,0,1);
197 //++iii; 197 //++iii;
198 { 198 {
199 QVGroupBox*topFrame = gb2; 199 QVGroupBox*topFrame = gb2;
200 mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame ); 200 mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame );
diff --git a/microkde/kidmanager.cpp b/microkde/kidmanager.cpp
index e687e5d..d712771 100644
--- a/microkde/kidmanager.cpp
+++ b/microkde/kidmanager.cpp
@@ -1,98 +1,98 @@
1#include "kidmanager.h" 1#include "kidmanager.h"
2 2
3KIdManager::KIdManager() 3KIdManager::KIdManager()
4{ 4{
5 5
6} 6}
7// :profilename;12;id_withLen12;123456: 7// :profilename;12;id_withLen12;123456:
8// 123456 is the csum 8// 123456 is the csum
9QString KIdManager::setId (const QString& idString,const QString& prof,const QString& idvalue ) 9const QString KIdManager::setId (const QString& idString,const QString& prof,const QString& idvalue )
10{ 10{
11 int startProf; 11 int startProf;
12 int startIDnum; 12 int startIDnum;
13 int startIDnumlen; 13 int startIDnumlen;
14 int startID; 14 int startID;
15 int lenID; 15 int lenID;
16 int startCsum; 16 int startCsum;
17 int lenCsum; 17 int lenCsum;
18 int endall; 18 int endall;
19 QString newIDString; 19 QString newIDString;
20 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { 20 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) {
21 newIDString = idString.left(startIDnum ) + QString::number( idvalue.length() ) +";"+idvalue+ ";"+idString.mid( startCsum ); 21 newIDString = idString.left(startIDnum ) + QString::number( idvalue.length() ) +";"+idvalue+ ";"+idString.mid( startCsum );
22 } else { 22 } else {
23 newIDString = idString + prof+";"+ QString::number( idvalue.length() ) +";"+idvalue +";0:"; 23 newIDString = idString + prof+";"+ QString::number( idvalue.length() ) +";"+idvalue +";0:";
24 } 24 }
25 //qDebug("setID:profile:%s*retval:%s*idvalue:%s* ", prof.latin1(), newIDString.latin1() ,idvalue.latin1() ); 25 //qDebug("setID:profile:%s*retval:%s*idvalue:%s* ", prof.latin1(), newIDString.latin1() ,idvalue.latin1() );
26 return newIDString; 26 return newIDString;
27} 27}
28QString KIdManager::getId (const QString& idString,const QString& prof ) 28const QString KIdManager::getId (const QString& idString,const QString& prof )
29{ 29{
30 int startProf; 30 int startProf;
31 int startIDnum; 31 int startIDnum;
32 int startIDnumlen; 32 int startIDnumlen;
33 int startID; 33 int startID;
34 int lenID; 34 int lenID;
35 int startCsum; 35 int startCsum;
36 int lenCsum; 36 int lenCsum;
37 int endall; 37 int endall;
38 QString idval = ""; 38 QString idval = "";
39 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) 39 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) )
40 idval = idString.mid( startID, lenID ); 40 idval = idString.mid( startID, lenID );
41 41
42 //qDebug("getID:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() ); 42 //qDebug("getID:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() );
43 return idval; 43 return idval;
44 44
45} 45}
46 46
47QString KIdManager::removeId (const QString& idString,const QString& prof ) 47const QString KIdManager::removeId (const QString& idString,const QString& prof )
48{ 48{
49 int startProf; 49 int startProf;
50 int startIDnum; 50 int startIDnum;
51 int startIDnumlen; 51 int startIDnumlen;
52 int startID; 52 int startID;
53 int lenID; 53 int lenID;
54 int startCsum; 54 int startCsum;
55 int lenCsum; 55 int lenCsum;
56 int endall; 56 int endall;
57 QString newIDString; 57 QString newIDString;
58 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { 58 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) {
59 newIDString = idString.left(startProf) + idString.mid( endall+1 ); 59 newIDString = idString.left(startProf) + idString.mid( endall+1 );
60 } else { 60 } else {
61 newIDString = idString; 61 newIDString = idString;
62 } 62 }
63 //qDebug("removeID:profile:%s*retval:%s*oldidstring:%s* ", prof.latin1(), newIDString.latin1() ,idString.latin1() ); 63 //qDebug("removeID:profile:%s*retval:%s*oldidstring:%s* ", prof.latin1(), newIDString.latin1() ,idString.latin1() );
64 return newIDString; 64 return newIDString;
65} 65}
66 66
67QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum ) 67const QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum )
68{ 68{
69 int startProf; 69 int startProf;
70 int startIDnum; 70 int startIDnum;
71 int startIDnumlen; 71 int startIDnumlen;
72 int startID; 72 int startID;
73 int lenID; 73 int lenID;
74 int startCsum; 74 int startCsum;
75 int lenCsum; 75 int lenCsum;
76 int endall; 76 int endall;
77 QString newIDString; 77 QString newIDString;
78 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { 78 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) {
79 newIDString = idString.left(startCsum) + idCsum+ idString.mid( endall +1); 79 newIDString = idString.left(startCsum) + idCsum+ idString.mid( endall +1);
80 } else { 80 } else {
81 newIDString = idString + prof + ";3;_u_;"+ idCsum + ":"; 81 newIDString = idString + prof + ";3;_u_;"+ idCsum + ":";
82 } 82 }
83 //qDebug("setCsum:profile:%s*retval:%s*idCsum:%s* ", prof.latin1(), newIDString.latin1() ,idCsum.latin1() ); 83 //qDebug("setCsum:profile:%s*retval:%s*idCsum:%s* ", prof.latin1(), newIDString.latin1() ,idCsum.latin1() );
84 return newIDString; 84 return newIDString;
85} 85}
86QString KIdManager::getCsum (const QString& idString,const QString& prof ) 86const QString KIdManager::getCsum (const QString& idString,const QString& prof )
87{ 87{
88 int startProf; 88 int startProf;
89 int startIDnum; 89 int startIDnum;
90 int startIDnumlen; 90 int startIDnumlen;
91 int startID; 91 int startID;
92 int lenID; 92 int lenID;
93 int startCsum; 93 int startCsum;
94 int lenCsum; 94 int lenCsum;
95 int endall; 95 int endall;
96 QString idval = ""; 96 QString idval = "";
97 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) 97 if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) )
98 idval = idString.mid( startCsum, lenCsum ); 98 idval = idString.mid( startCsum, lenCsum );
diff --git a/microkde/kidmanager.h b/microkde/kidmanager.h
index 00580a0..9786c9f 100644
--- a/microkde/kidmanager.h
+++ b/microkde/kidmanager.h
@@ -1,24 +1,24 @@
1#ifndef MINIKDE_KIDMANAGER_H 1#ifndef MINIKDE_KIDMANAGER_H
2#define MINIKDE_KIDMANAGER_H 2#define MINIKDE_KIDMANAGER_H
3 3
4#include <qstring.h> 4#include <qstring.h>
5 5
6#include <qobject.h> 6#include <qobject.h>
7class KIdManager : public QObject 7class KIdManager : public QObject
8{ 8{
9Q_OBJECT 9Q_OBJECT
10 public: 10 public:
11 KIdManager( ); 11 KIdManager( );
12 static QString setId (const QString& idString,const QString& id,const QString& idvalue ) ; 12 static const QString setId (const QString& idString,const QString& id,const QString& idvalue ) ;
13 static QString getId (const QString& idString,const QString& id ) ; 13 static const QString getId (const QString& idString,const QString& id ) ;
14 static QString removeId (const QString& idString,const QString& id ) ; 14 static const QString removeId (const QString& idString,const QString& id ) ;
15 static QString setCsum (const QString& idString,const QString& id,const QString& idvalue ) ; 15 static const QString setCsum (const QString& idString,const QString& id,const QString& idvalue ) ;
16 static QString getCsum (const QString& idString,const QString& id ) ; 16 static const QString getCsum (const QString& idString,const QString& id ) ;
17 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) ; 17 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) ;
18 private: 18 private:
19 19
20private slots: 20private slots:
21}; 21};
22 22
23 23
24#endif 24#endif