summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-17 19:49:42 (UTC)
committer zautrix <zautrix>2005-01-17 19:49:42 (UTC)
commit522486966ecf041a6e49913b6e420d58d4284837 (patch) (unidiff)
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
@@ -939,51 +939,51 @@ void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool
939 } else 939 } else
940 ad.setID( csd, (*it).uid() ); 940 ad.setID( csd, (*it).uid() );
941 (*it).computeCsum( csd ); 941 (*it).computeCsum( csd );
942 ad.setCsum( csd, (*it).getCsum( csd ) ); 942 ad.setCsum( csd, (*it).getCsum( csd ) );
943 //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); 943 //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() );
944 aBook->insertAddressee( ad , false); 944 aBook->insertAddressee( ad , false);
945 } 945 }
946 } 946 }
947 } 947 }
948 if ( foundEmpty ) { 948 if ( foundEmpty ) {
949 qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty ); 949 qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty );
950 } 950 }
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 );
978 if ( !ad.isEmpty() ) { 978 if ( !ad.isEmpty() ) {
979 (*it).mergeContact( ad ,isSubset); 979 (*it).mergeContact( ad ,isSubset);
980 } 980 }
981 } 981 }
982#if 0 982#if 0
983 // test only 983 // test only
984 for ( it = begin(); it != end(); ++it ) { 984 for ( it = begin(); it != end(); ++it ) {
985 985
986 qDebug("uid %s ", (*it).uid().latin1()); 986 qDebug("uid %s ", (*it).uid().latin1());
987 } 987 }
988#endif 988#endif
989} 989}
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 2351add..18c03b5 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -283,49 +283,49 @@ class AddressBook : public QObject
283 QPtrList<Resource> resources(); 283 QPtrList<Resource> resources();
284 284
285 /** 285 /**
286 Set the @p ErrorHandler, that is used by @ref error() to 286 Set the @p ErrorHandler, that is used by @ref error() to
287 provide gui-independend error messages. 287 provide gui-independend error messages.
288 */ 288 */
289 void setErrorHandler( ErrorHandler * ); 289 void setErrorHandler( ErrorHandler * );
290 290
291 /** 291 /**
292 Shows gui independend error messages. 292 Shows gui independend error messages.
293 */ 293 */
294 void error( const QString& ); 294 void error( const QString& );
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.
320 */ 320 */
321 void addressBookLocked( AddressBook * ); 321 void addressBookLocked( AddressBook * );
322 322
323 /** 323 /**
324 Emitted, when the address book has been unlocked. 324 Emitted, when the address book has been unlocked.
325 */ 325 */
326 void addressBookUnlocked( AddressBook * ); 326 void addressBookUnlocked( AddressBook * );
327 327
328 protected: 328 protected:
329 void deleteRemovedAddressees(); 329 void deleteRemovedAddressees();
330 void setStandardResource( Resource * ); 330 void setStandardResource( Resource * );
331 Resource *standardResource(); 331 Resource *standardResource();
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index d60cd6b..3b238f5 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -568,113 +568,113 @@ void Addressee::removeID(const QString &prof)
568 detach(); 568 detach();
569 if ( prof.isEmpty() ) 569 if ( prof.isEmpty() )
570 mData->mExternalId = ":"; 570 mData->mExternalId = ":";
571 else 571 else
572 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 572 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
573 573
574} 574}
575void Addressee::setID( const QString & prof , const QString & id ) 575void Addressee::setID( const QString & prof , const QString & id )
576{ 576{
577 detach(); 577 detach();
578 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 578 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
579 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 579 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
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
642QString Addressee::originalExternalUID() const 642QString Addressee::originalExternalUID() const
643{ 643{
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
669void Addressee::setName( const QString &name ) 669void Addressee::setName( const QString &name )
670{ 670{
671 if ( name == mData->name ) return; 671 if ( name == mData->name ) return;
672 detach(); 672 detach();
673 mData->empty = false; 673 mData->empty = false;
674 mData->name = name; 674 mData->name = name;
675} 675}
676 676
677QString Addressee::name() const 677QString Addressee::name() const
678{ 678{
679 return mData->name; 679 return mData->name;
680} 680}
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 08d2f56..8051fec 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -79,80 +79,80 @@ class Resource;
79 */ 79 */
80class Addressee 80class Addressee
81{ 81{
82 friend QDataStream &operator<<( QDataStream &, const Addressee & ); 82 friend QDataStream &operator<<( QDataStream &, const Addressee & );
83 friend QDataStream &operator>>( QDataStream &, Addressee & ); 83 friend QDataStream &operator>>( QDataStream &, Addressee & );
84 84
85 public: 85 public:
86 typedef QValueList<Addressee> List; 86 typedef QValueList<Addressee> List;
87 87
88 /** 88 /**
89 Construct an empty address book entry. 89 Construct an empty address book entry.
90 */ 90 */
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 */
147 QString name() const; 147 QString name() const;
148 /** 148 /**
149 Return translated label for name field. 149 Return translated label for name field.
150 */ 150 */
151 static QString nameLabel(); 151 static QString nameLabel();
152 152
153 /** 153 /**
154 Set formatted name. 154 Set formatted name.
155 */ 155 */
156 void setFormattedName( const QString &formattedName ); 156 void setFormattedName( const QString &formattedName );
157 /** 157 /**
158 Return formatted name. 158 Return formatted name.
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index d393660..42e147f 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1353,50 +1353,50 @@ void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1353{ 1353{
1354 if ( mMultipleViewsAtOnce ) 1354 if ( mMultipleViewsAtOnce )
1355 { 1355 {
1356 editContact( uid ); 1356 editContact( uid );
1357 } 1357 }
1358 else 1358 else
1359 { 1359 {
1360 setDetailsVisible( true ); 1360 setDetailsVisible( true );
1361 mActionDetails->setChecked(true); 1361 mActionDetails->setChecked(true);
1362 } 1362 }
1363 1363
1364} 1364}
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
1391 message(i18n("Addressbook saved!")); 1391 message(i18n("Addressbook saved!"));
1392 setModified( false ); 1392 setModified( false );
1393 syncManager->setBlockSave(false); 1393 syncManager->setBlockSave(false);
1394} 1394}
1395 1395
1396 1396
1397void KABCore::undo() 1397void KABCore::undo()
1398{ 1398{
1399 UndoStack::instance()->undo(); 1399 UndoStack::instance()->undo();
1400 1400
1401 // Refresh the view 1401 // Refresh the view
1402 mViewManager->refreshView(); 1402 mViewManager->refreshView();
@@ -2276,73 +2276,80 @@ void KABCore::addActionsManually()
2276 mActionExport2phone->plug( ExportMenu ); 2276 mActionExport2phone->plug( ExportMenu );
2277 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2277 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2278 syncManager->fillSyncMenu(); 2278 syncManager->fillSyncMenu();
2279 2279
2280} 2280}
2281void KABCore::showLicence() 2281void KABCore::showLicence()
2282{ 2282{
2283 KApplication::showLicence(); 2283 KApplication::showLicence();
2284} 2284}
2285 2285
2286void KABCore::manageCategories( ) 2286void KABCore::manageCategories( )
2287{ 2287{
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) );
2337 } 2344 }
2338 } 2345 }
2339 setModified( true ); 2346 setModified( true );
2340 mViewManager->refreshView(); 2347 mViewManager->refreshView();
2341 message( i18n("Removing categories done!")); 2348 message( i18n("Removing categories done!"));
2342 } 2349 }
2343 delete cp; 2350 delete cp;
2344} 2351}
2345void KABCore::removeVoice() 2352void KABCore::removeVoice()
2346{ 2353{
2347 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2354 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2348 return; 2355 return;
@@ -2353,66 +2360,69 @@ void KABCore::removeVoice()
2353 else 2360 else
2354 return; 2361 return;
2355 KABC::Addressee::List::Iterator it; 2362 KABC::Addressee::List::Iterator it;
2356 for ( it = list.begin(); it != list.end(); ++it ) { 2363 for ( it = list.begin(); it != list.end(); ++it ) {
2357 if ( (*it).removeVoice() ) 2364 if ( (*it).removeVoice() )
2358 addrModified((*it), false ); 2365 addrModified((*it), false );
2359 } 2366 }
2360} 2367}
2361 2368
2362void KABCore::setFormattedName() 2369void KABCore::setFormattedName()
2363{ 2370{
2364 KABFormatPrefs setpref; 2371 KABFormatPrefs setpref;
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
2407} 2417}
2408 2418
2409void KABCore::updateActionMenu() 2419void KABCore::updateActionMenu()
2410{ 2420{
2411 UndoStack *undo = UndoStack::instance(); 2421 UndoStack *undo = UndoStack::instance();
2412 RedoStack *redo = RedoStack::instance(); 2422 RedoStack *redo = RedoStack::instance();
2413 2423
2414 if ( undo->isEmpty() ) 2424 if ( undo->isEmpty() )
2415 mActionUndo->setText( i18n( "Undo" ) ); 2425 mActionUndo->setText( i18n( "Undo" ) );
2416 else 2426 else
2417 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2427 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2418 2428
@@ -3168,74 +3178,85 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
3168 mViewManager->refreshView(); 3178 mViewManager->refreshView();
3169 return syncOK; 3179 return syncOK;
3170 3180
3171} 3181}
3172void KABCore::removeSyncInfo( QString syncProfile) 3182void KABCore::removeSyncInfo( QString syncProfile)
3173{ 3183{
3174 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); 3184 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1());
3175 mAddressBook->removeSyncInfo( syncProfile ); 3185 mAddressBook->removeSyncInfo( syncProfile );
3176 setModified(); 3186 setModified();
3177} 3187}
3178 3188
3179 3189
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 {
3230 abLocal.importFromFile( fileName ); 3251 abLocal.importFromFile( fileName );
3231 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3252 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
3232 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3253 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3233 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 3254 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
3234 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 3255 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
3235 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3256 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3236 if ( syncOK ) { 3257 if ( syncOK ) {
3237 if ( syncManager->mWriteBackFile ) { 3258 if ( syncManager->mWriteBackFile ) {
3238 abLocal.removeSyncAddressees( true ); 3259 abLocal.removeSyncAddressees( true );
3239 abLocal.saveABphone( fileName ); 3260 abLocal.saveABphone( fileName );
3240 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 3261 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
3241 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 3262 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index ecfe6e9..786549a 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -479,41 +479,41 @@ class KABCore : public QWidget, public KSyncInterface
479 QPopupMenu *ImportMenu; 479 QPopupMenu *ImportMenu;
480 QPopupMenu *ExportMenu; 480 QPopupMenu *ExportMenu;
481 //LR additional methods 481 //LR additional methods
482 KAction *mActionRemoveVoice; 482 KAction *mActionRemoveVoice;
483 KAction *mActionSetFormattedName; 483 KAction *mActionSetFormattedName;
484 KAction * mActionImportOL; 484 KAction * mActionImportOL;
485 485
486#ifndef KAB_EMBEDDED 486#ifndef KAB_EMBEDDED
487 KAddressBookService *mAddressBookService; 487 KAddressBookService *mAddressBookService;
488#endif //KAB_EMBEDDED 488#endif //KAB_EMBEDDED
489 489
490 class KABCorePrivate; 490 class KABCorePrivate;
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 // *********************
516 516
517}; 517};
518 518
519#endif 519#endif
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 6c1f444..f488a07 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -973,58 +973,59 @@ bool KSyncManager::syncExternalApplication(QString resource)
973 return false; 973 return false;
974 } 974 }
975 975
976 qDebug("Sync extern %s", resource.latin1()); 976 qDebug("Sync extern %s", resource.latin1());
977 977
978 bool syncOK = mImplementation->syncExternal(this, resource); 978 bool syncOK = mImplementation->syncExternal(this, resource);
979 979
980 return syncOK; 980 return syncOK;
981 981
982} 982}
983 983
984void KSyncManager::syncPhone() 984void 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)
1019 { 1020 {
1020 case (KAPI): 1021 case (KAPI):
1021 fn = "tempsyncab.vcf"; 1022 fn = "tempsyncab.vcf";
1022 break; 1023 break;
1023 case (KOPI): 1024 case (KOPI):
1024 fn = "tempsynccal.ics"; 1025 fn = "tempsynccal.ics";
1025 break; 1026 break;
1026 case (PWMPI): 1027 case (PWMPI):
1027 fn = "tempsyncpw.pwm"; 1028 fn = "tempsyncpw.pwm";
1028 break; 1029 break;
1029 default: 1030 default:
1030 break; 1031 break;
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 2101bbb..3db58ec 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -164,49 +164,49 @@ void KSyncPrefsDialog::setupSyncAlgTab()
164 164
165 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); 165 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
166 //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); 166 //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
167 //++iii; 167 //++iii;
168 gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); 168 gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
169 //topLayout->addMultiCellWidget(gr, iii,iii,0,1); 169 //topLayout->addMultiCellWidget(gr, iii,iii,0,1);
170 //++iii; 170 //++iii;
171 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); 171 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
172 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); 172 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
173 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); 173 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
174 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); 174 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
175 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); 175 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
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 );
201 QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame); 201 QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame);
202 QVBox * fibo = new QVBox ( gb4 ); 202 QVBox * fibo = new QVBox ( gb4 );
203 new QLabel ( i18n("Outgoing calendar filter:"), fibo ); 203 new QLabel ( i18n("Outgoing calendar filter:"), fibo );
204 mFilterOutCal = new QComboBox( fibo ); 204 mFilterOutCal = new QComboBox( fibo );
205 fibo = new QVBox ( gb4 ); 205 fibo = new QVBox ( gb4 );
206 new QLabel ( i18n("Outgoing addressbook filter:"), fibo ); 206 new QLabel ( i18n("Outgoing addressbook filter:"), fibo );
207 mFilterOutAB = new QComboBox( fibo ); 207 mFilterOutAB = new QComboBox( fibo );
208 //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 208 //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
209 //++iii; 209 //++iii;
210 mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame ); 210 mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame );
211 //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); 211 //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
212 //++iii; 212 //++iii;
diff --git a/microkde/kidmanager.cpp b/microkde/kidmanager.cpp
index e687e5d..d712771 100644
--- a/microkde/kidmanager.cpp
+++ b/microkde/kidmanager.cpp
@@ -1,110 +1,110 @@
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 );
99 99
100 //qDebug("getCsum:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() ); 100 //qDebug("getCsum:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() );
101 return idval; 101 return idval;
102} 102}
103// :profilename;12;id_withLen12;123456: 103// :profilename;12;id_withLen12;123456:
104bool KIdManager::getNumbers (const QString& idString,const QString& prof, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) 104bool KIdManager::getNumbers (const QString& idString,const QString& prof, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall)
105{ 105{
106 startProf = idString.find( ":"+prof+";" ); 106 startProf = idString.find( ":"+prof+";" );
107 if ( startProf >= 0 ) { 107 if ( startProf >= 0 ) {
108 startIDnum = prof.length()+2+startProf; 108 startIDnum = prof.length()+2+startProf;
109 startID = idString.find( ";", startIDnum ) +1; 109 startID = idString.find( ";", startIDnum ) +1;
110 startIDnumlen = startID - startIDnum - 1; 110 startIDnumlen = startID - startIDnum - 1;
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