-rw-r--r-- | kabc/addressbook.cpp | 4 | ||||
-rw-r--r-- | kabc/addressbook.h | 2 | ||||
-rw-r--r-- | kabc/addressee.cpp | 10 | ||||
-rw-r--r-- | kabc/addressee.h | 10 |
4 files changed, 13 insertions, 13 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 | ||
954 | bool AddressBook::containsExternalUid( const QString& uid ) | 954 | bool 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 | } |
963 | Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) | 963 | const 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 | } |
972 | void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset ) | 972 | void 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 | } |
575 | void Addressee::setID( const QString & prof , const QString & id ) | 575 | void 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 | } |
581 | void Addressee::setTempSyncStat( int id ) | 581 | void 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 | } |
587 | int Addressee::tempSyncStat() const | 587 | int Addressee::tempSyncStat() const |
588 | { | 588 | { |
589 | return mData->mTempSyncStat; | 589 | return mData->mTempSyncStat; |
590 | } | 590 | } |
591 | 591 | ||
592 | QString Addressee::getID( const QString & prof) | 592 | const 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 | ||
597 | void Addressee::setCsum( const QString & prof , const QString & id ) | 597 | void 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 | ||
605 | QString Addressee::getCsum( const QString & prof) | 605 | const 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 | ||
610 | void Addressee::setIDStr( const QString & s ) | 610 | void Addressee::setIDStr( const QString & s ) |
611 | { | 611 | { |
612 | detach(); | 612 | detach(); |
613 | mData->mExternalId = s; | 613 | mData->mExternalId = s; |
614 | } | 614 | } |
615 | 615 | ||
616 | QString Addressee::IDStr() const | 616 | const QString Addressee::IDStr() const |
617 | { | 617 | { |
618 | return mData->mExternalId; | 618 | return mData->mExternalId; |
619 | } | 619 | } |
620 | 620 | ||
621 | void Addressee::setExternalUID( const QString &id ) | 621 | void 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 | ||
629 | QString Addressee::externalUID() const | 629 | const QString Addressee::externalUID() const |
630 | { | 630 | { |
631 | return mData->externalUID; | 631 | return mData->externalUID; |
632 | } | 632 | } |
633 | void Addressee::setOriginalExternalUID( const QString &id ) | 633 | void 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 | ||
642 | QString Addressee::originalExternalUID() const | 642 | QString Addressee::originalExternalUID() const |
643 | { | 643 | { |
644 | return mData->originalExternalUID; | 644 | return mData->originalExternalUID; |
645 | } | 645 | } |
646 | 646 | ||
647 | void Addressee::setUid( const QString &id ) | 647 | void 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 | ||
656 | QString Addressee::uid() const | 656 | const 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 | ||
664 | QString Addressee::uidLabel() | 664 | QString Addressee::uidLabel() |
665 | { | 665 | { |
666 | return i18n("Unique Identifier"); | 666 | return i18n("Unique Identifier"); |
667 | } | 667 | } |
668 | 668 | ||
669 | void Addressee::setName( const QString &name ) | 669 | void 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 | ||
677 | QString Addressee::name() const | 677 | QString 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 | */ |
80 | class Addressee | 80 | class 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. |