summaryrefslogtreecommitdiffabout
path: root/kabc
authorzautrix <zautrix>2006-02-24 18:49:56 (UTC)
committer zautrix <zautrix>2006-02-24 18:49:56 (UTC)
commitd7738fdfc685192eb2f8317db6ffad3c246001c8 (patch) (unidiff)
treed9aae6ca97851fd1b53c4d9e74740a5ee2b69ea9 /kabc
parent987757f168bbae56100f2aff763b865e81ceec18 (diff)
downloadkdepimpi-d7738fdfc685192eb2f8317db6ffad3c246001c8.zip
kdepimpi-d7738fdfc685192eb2f8317db6ffad3c246001c8.tar.gz
kdepimpi-d7738fdfc685192eb2f8317db6ffad3c246001c8.tar.bz2
kapi sync
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp22
-rw-r--r--kabc/addressbook.h1
-rw-r--r--kabc/addressee.cpp75
-rw-r--r--kabc/addressee.h4
-rw-r--r--kabc/phonenumber.cpp24
5 files changed, 120 insertions, 6 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index f9e4387..fe59fcb 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -937,44 +937,62 @@ Addressee AddressBook::findByUid( const QString &uid )
937 return Addressee(); 937 return Addressee();
938} 938}
939void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) 939void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset )
940{ 940{
941 //qDebug("AddressBook::preExternSync "); 941 //qDebug("AddressBook::preExternSync ");
942 AddressBook::Iterator it; 942 AddressBook::Iterator it;
943 for ( it = begin(); it != end(); ++it ) { 943 for ( it = begin(); it != end(); ++it ) {
944 (*it).setID( csd, (*it).externalUID() ); 944 (*it).setID( csd, (*it).externalUID() );
945 (*it).computeCsum( csd ); 945 (*it).computeCsum( csd );
946 } 946 }
947 mergeAB( aBook ,csd, isSubset ); 947 mergeAB( aBook ,csd, isSubset );
948} 948}
949void AddressBook::preOLSync( AddressBook* aBook, const QString& csd )
950{
951 //qDebug("AddressBook::preExternSync ");
952 AddressBook::Iterator it;
953 for ( it = begin(); it != end(); ++it ) {
954 (*it).setID( csd, (*it).externalUID() );
955 (*it).computeCsum( csd );
956 }
957
958 Addressee ad;
959 for ( it = begin(); it != end(); ++it ) {
960 ad = aBook->findByExternUid( (*it).externalUID(), csd );
961 if ( !ad.isEmpty() ) {
962 (*it).mergeOLContact( ad );
963 }
964 }
965}
949void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) 966void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID)
950{ 967{
951 //qDebug("AddressBook::postExternSync "); 968 //qDebug("AddressBook::postExternSync ");
952 AddressBook::Iterator it; 969 AddressBook::Iterator it;
953 int foundEmpty = 0; 970 int foundEmpty = 0;
954 for ( it = begin(); it != end(); ++it ) { 971 for ( it = begin(); it != end(); ++it ) {
955 //qDebug("check uid %s ", (*it).uid().latin1() ); 972 //qDebug("check uid %s ", (*it).uid().latin1() );
956 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || 973 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ||
957 (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM || 974 (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ||
958 (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) { 975 (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) {
959 Addressee ad = aBook->findByUid( ( (*it).uid() )); 976 Addressee ad = aBook->findByUid( ( (*it).uid() ));
960 if ( ad.isEmpty() ) { 977 if ( ad.isEmpty() ) {
961 ++foundEmpty; 978 ++foundEmpty;
962 //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1()); 979 //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1());
963 //qDebug("-- formatted name %s ",(*it).formattedName().latin1() ); 980 //qDebug("-- formatted name %s ",(*it).formattedName().latin1() );
964 } else { 981 } else {
965 (*it).setIDStr(":"); 982 (*it).setIDStr(":");
966 if ( setID ) { 983 if ( setID ) {
967 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) 984 if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID )
968 ad.setID( csd, (*it).externalUID() ); 985 ad.setID( csd, (*it).externalUID() );{
986 }
969 } else 987 } else
970 ad.setID( csd, (*it).uid() ); 988 ad.setID( csd, (*it).uid() );
971 (*it).computeCsum( csd ); 989 (*it).computeCsum( csd );
972 ad.setCsum( csd, (*it).getCsum( csd ) ); 990 ad.setCsum( csd, (*it).getCsum( csd ) );
973 //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); 991 //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() );
974 aBook->insertAddressee( ad , false); 992 aBook->insertAddressee( ad , false);
975 } 993 }
976 } 994 }
977 } 995 }
978 if ( foundEmpty ) { 996 if ( foundEmpty ) {
979 qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty ); 997 qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty );
980 } 998 }
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index e6daa5e..a8a9fc1 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -299,24 +299,25 @@ class AddressBook : public QObject
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 const Addressee findByExternUid( const QString& uid , const QString& profile ) const; 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 preOLSync( AddressBook* aBook, const QString& csd);
311 void postExternSync( AddressBook* aBook, const QString& csd , bool setID ); 312 void postExternSync( AddressBook* aBook, const QString& csd , bool setID );
312 signals: 313 signals:
313 /** 314 /**
314 Emitted, when the address book has changed on disk. 315 Emitted, when the address book has changed on disk.
315 */ 316 */
316 void addressBookChanged( AddressBook * ); 317 void addressBookChanged( AddressBook * );
317 318
318 /** 319 /**
319 Emitted, when the address book has been locked for writing. 320 Emitted, when the address book has been locked for writing.
320 */ 321 */
321 void addressBookLocked( AddressBook * ); 322 void addressBookLocked( AddressBook * );
322 323
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 6cfac80..e8e440c 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -23,24 +23,25 @@
23Enhanced Version of the file for platform independent KDE tools. 23Enhanced Version of the file for platform independent KDE tools.
24Copyright (c) 2004 Ulf Schenk 24Copyright (c) 2004 Ulf Schenk
25 25
26$Id$ 26$Id$
27*/ 27*/
28 28
29#include <kconfig.h> 29#include <kconfig.h>
30 30
31#include <ksharedptr.h> 31#include <ksharedptr.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <kapplication.h> 33#include <kapplication.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kmessagebox.h>
35#include <kidmanager.h> 36#include <kidmanager.h>
36//US 37//US
37#include <kstandarddirs.h> 38#include <kstandarddirs.h>
38#include <libkcal/syncdefines.h> 39#include <libkcal/syncdefines.h>
39 40
40//US #include "resource.h" 41//US #include "resource.h"
41#include "addressee.h" 42#include "addressee.h"
42 43
43using namespace KABC; 44using namespace KABC;
44 45
45static bool matchBinaryPattern( int value, int pattern ); 46static bool matchBinaryPattern( int value, int pattern );
46static bool matchBinaryPatternA( int value, int pattern ); 47static bool matchBinaryPatternA( int value, int pattern );
@@ -202,25 +203,25 @@ ulong Addressee::getCsum4List( const QStringList & attList)
202 203
203 } 204 }
204 //QString dump = attList.join(","); 205 //QString dump = attList.join(",");
205 //qDebug("csum: %d %s", cSum,dump.latin1()); 206 //qDebug("csum: %d %s", cSum,dump.latin1());
206 207
207 return cSum; 208 return cSum;
208 209
209} 210}
210void Addressee::computeCsum(const QString &dev) 211void Addressee::computeCsum(const QString &dev)
211{ 212{
212 QStringList l; 213 QStringList l;
213 //if ( !mData->name.isEmpty() ) l.append(mData->name); 214 //if ( !mData->name.isEmpty() ) l.append(mData->name);
214 //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); 215 if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName );
215 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); 216 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName );
216 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); 217 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName );
217 if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); 218 if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName );
218 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); 219 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix );
219 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); 220 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix );
220 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); 221 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName );
221 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); 222 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() );
222 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); 223 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer );
223 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); 224 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
224 if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); 225 if ( mData->geo.isValid() ) l.append( mData->geo.asString() );
225 if ( !mData->title .isEmpty() ) l.append( mData->title ); 226 if ( !mData->title .isEmpty() ) l.append( mData->title );
226 if ( !mData->role.isEmpty() ) l.append( mData->role ); 227 if ( !mData->role.isEmpty() ) l.append( mData->role );
@@ -323,24 +324,71 @@ bool Addressee::matchPhoneNumber( QRegExp* re ) const
323 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); ++phoneIter ) { 324 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); ++phoneIter ) {
324#if QT_VERSION >= 0x030000 325#if QT_VERSION >= 0x030000
325 if (re->search( (*phoneIter).number() ) == 0) 326 if (re->search( (*phoneIter).number() ) == 0)
326#else 327#else
327 if (re->match( (*phoneIter).number() ) == 0) 328 if (re->match( (*phoneIter).number() ) == 0)
328#endif 329#endif
329 return true; 330 return true;
330 331
331 } 332 }
332 return false; 333 return false;
333 334
334} 335}
336void Addressee::mergeOLContact( const Addressee& ad )
337{
338 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
339 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
340 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
341 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
342 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo;
343 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo;
344 if ( !mData->sound.isIntern() ) {
345 if ( mData->sound.url().isEmpty() ) {
346 mData->sound = ad.mData->sound;
347 }
348 }
349 if ( !mData->agent.isIntern() ) {
350 if ( mData->agent.url().isEmpty() ) {
351 mData->agent = ad.mData->agent;
352 }
353 }
354 {
355 Key::List::Iterator itA;
356 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) {
357 bool found = false;
358 Key::List::Iterator it;
359 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
360 if ( (*it) == (*itA)) {
361 found = true;
362 break;
363
364 }
365 }
366 if ( ! found ) {
367 mData->keys.append( *itA );
368 }
369 }
370 }
371
372 KABC::Address addthis = otherAddress();
373 KABC::Address addother = ad.otherAddress();
374 if ( !addthis.isEmpty() && !addother.isEmpty() )
375 addthis.setType( addother.type() );
376 //qDebug("merge contact %s ", ad.uid().latin1());
377 setUid( ad.uid() );
378 setRevision( ad.revision() );
379
380
381}
382
335void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) 383void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
336{ 384{
337 // merge all standard non-outlook fields. 385 // merge all standard non-outlook fields.
338 //if isSubSet (e.g. mobile phone sync) merge all fields 386 //if isSubSet (e.g. mobile phone sync) merge all fields
339 387
340 detach(); 388 detach();
341 if ( isSubSet ) { 389 if ( isSubSet ) {
342 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 390 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
343 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 391 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
344 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 392 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
345 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 393 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
346 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 394 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
@@ -1644,25 +1692,24 @@ QString Addressee::preferredEmail() const
1644QStringList Addressee::emails() const 1692QStringList Addressee::emails() const
1645{ 1693{
1646 return mData->emails; 1694 return mData->emails;
1647} 1695}
1648void Addressee::setEmails( const QStringList& emails ) { 1696void Addressee::setEmails( const QStringList& emails ) {
1649 detach(); 1697 detach();
1650 mData->emails = emails; 1698 mData->emails = emails;
1651} 1699}
1652void Addressee::insertPhoneNumber( const PhoneNumber &phoneNumber ) 1700void Addressee::insertPhoneNumber( const PhoneNumber &phoneNumber )
1653{ 1701{
1654 detach(); 1702 detach();
1655 mData->empty = false; 1703 mData->empty = false;
1656
1657 PhoneNumber::List::Iterator it; 1704 PhoneNumber::List::Iterator it;
1658 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1705 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1659 if ( (*it).id() == phoneNumber.id() ) { 1706 if ( (*it).id() == phoneNumber.id() ) {
1660 *it = phoneNumber; 1707 *it = phoneNumber;
1661 return; 1708 return;
1662 } 1709 }
1663 } 1710 }
1664 mData->phoneNumbers.append( phoneNumber ); 1711 mData->phoneNumbers.append( phoneNumber );
1665} 1712}
1666 1713
1667void Addressee::removePhoneNumber( const PhoneNumber &phoneNumber ) 1714void Addressee::removePhoneNumber( const PhoneNumber &phoneNumber )
1668{ 1715{
@@ -1711,24 +1758,35 @@ int Addressee::hasPhoneNumberType( int type )
1711PhoneNumber::List Addressee::phoneNumbers( int type ) const 1758PhoneNumber::List Addressee::phoneNumbers( int type ) const
1712{ 1759{
1713 PhoneNumber::List list; 1760 PhoneNumber::List list;
1714 1761
1715 PhoneNumber::List::ConstIterator it; 1762 PhoneNumber::List::ConstIterator it;
1716 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1763 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1717 if ( matchBinaryPattern( (*it).type(), type ) ) { 1764 if ( matchBinaryPattern( (*it).type(), type ) ) {
1718 list.append( *it ); 1765 list.append( *it );
1719 } 1766 }
1720 } 1767 }
1721 return list; 1768 return list;
1722} 1769}
1770QString Addressee::phoneNumberString( int type ) const
1771{
1772
1773 PhoneNumber::List::ConstIterator it;
1774 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1775 if ((*it).type() == type ) {
1776 return ( *it ).number();
1777 }
1778 }
1779 return "";
1780}
1723 1781
1724PhoneNumber Addressee::findPhoneNumber( const QString &id ) const 1782PhoneNumber Addressee::findPhoneNumber( const QString &id ) const
1725{ 1783{
1726 PhoneNumber::List::ConstIterator it; 1784 PhoneNumber::List::ConstIterator it;
1727 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1785 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1728 if ( (*it).id() == id ) { 1786 if ( (*it).id() == id ) {
1729 return *it; 1787 return *it;
1730 } 1788 }
1731 } 1789 }
1732 return PhoneNumber(); 1790 return PhoneNumber();
1733} 1791}
1734 1792
@@ -1916,25 +1974,36 @@ void Addressee::insertAddress( const Address &address )
1916void Addressee::removeAddress( const Address &address ) 1974void Addressee::removeAddress( const Address &address )
1917{ 1975{
1918 detach(); 1976 detach();
1919 1977
1920 Address::List::Iterator it; 1978 Address::List::Iterator it;
1921 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 1979 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
1922 if ( (*it).id() == address.id() ) { 1980 if ( (*it).id() == address.id() ) {
1923 mData->addresses.remove( it ); 1981 mData->addresses.remove( it );
1924 return; 1982 return;
1925 } 1983 }
1926 } 1984 }
1927} 1985}
1928 1986Address Addressee::otherAddress() const
1987{
1988 Address::List::ConstIterator it;
1989 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
1990 if ( matchBinaryPatternA( (*it).type(), KABC::Address::Work ) )
1991 continue;
1992 if ( matchBinaryPatternA( (*it).type(), KABC::Address::Home ) )
1993 continue;
1994 return (*it);
1995 }
1996 return Address();
1997}
1929Address Addressee::address( int type ) const 1998Address Addressee::address( int type ) const
1930{ 1999{
1931 Address address( type ); 2000 Address address( type );
1932 Address::List::ConstIterator it; 2001 Address::List::ConstIterator it;
1933 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 2002 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
1934 if ( matchBinaryPatternA( (*it).type(), type ) ) { 2003 if ( matchBinaryPatternA( (*it).type(), type ) ) {
1935 if ( (*it).type() & Address::Pref ) 2004 if ( (*it).type() & Address::Pref )
1936 return (*it); 2005 return (*it);
1937 else if ( address.isEmpty() ) 2006 else if ( address.isEmpty() )
1938 address = (*it); 2007 address = (*it);
1939 } 2008 }
1940 } 2009 }
diff --git a/kabc/addressee.h b/kabc/addressee.h
index aac78dc..0ea1803 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -109,24 +109,25 @@ class Addressee
109 void removeID(const QString &); 109 void removeID(const QString &);
110 void computeCsum(const QString &dev); 110 void computeCsum(const QString &dev);
111 ulong getCsum4List( const QStringList & attList); 111 ulong getCsum4List( const QStringList & attList);
112 /** 112 /**
113 Return, if the address book entry is empty. 113 Return, if the address book entry is empty.
114 */ 114 */
115 bool isEmpty() const; 115 bool isEmpty() const;
116 void setExternalUID( const QString &id ); 116 void setExternalUID( const QString &id );
117 const QString externalUID() const; 117 const QString externalUID() const;
118 void setOriginalExternalUID( const QString &id ); 118 void setOriginalExternalUID( const QString &id );
119 QString originalExternalUID() const; 119 QString originalExternalUID() const;
120 void mergeContact( const Addressee& ad, bool isSubSet ); 120 void mergeContact( const Addressee& ad, bool isSubSet );
121 void mergeOLContact( const Addressee& ad );
121 void simplifyEmails(); 122 void simplifyEmails();
122 void simplifyAddresses(); 123 void simplifyAddresses();
123 void simplifyPhoneNumbers(); 124 void simplifyPhoneNumbers();
124 void simplifyPhoneNumberTypes(); 125 void simplifyPhoneNumberTypes();
125 void makePhoneNumbersOLcompatible(); 126 void makePhoneNumbersOLcompatible();
126 int hasPhoneNumberType( int type ); 127 int hasPhoneNumberType( int type );
127 bool removeVoice(); 128 bool removeVoice();
128 bool containsAdr(const Addressee& addr ); 129 bool containsAdr(const Addressee& addr );
129 130
130 /** 131 /**
131 Set unique identifier. 132 Set unique identifier.
132 */ 133 */
@@ -638,24 +639,25 @@ class Addressee
638 void insertPhoneNumber( const PhoneNumber &phoneNumber ); 639 void insertPhoneNumber( const PhoneNumber &phoneNumber );
639 640
640 /** 641 /**
641 Remove phone number. If no phone number with the given id exists for this 642 Remove phone number. If no phone number with the given id exists for this
642 addresse nothing happens. 643 addresse nothing happens.
643 */ 644 */
644 void removePhoneNumber( const PhoneNumber &phoneNumber ); 645 void removePhoneNumber( const PhoneNumber &phoneNumber );
645 646
646 /** 647 /**
647 Return phone number, which matches the given type. 648 Return phone number, which matches the given type.
648 */ 649 */
649 PhoneNumber phoneNumber( int type ) const; 650 PhoneNumber phoneNumber( int type ) const;
651 QString phoneNumberString( int type ) const;
650 652
651 bool matchPhoneNumber( QRegExp* searchExp ) const; 653 bool matchPhoneNumber( QRegExp* searchExp ) const;
652 bool matchAddress( QRegExp* searchExp ) const; 654 bool matchAddress( QRegExp* searchExp ) const;
653 655
654 /** 656 /**
655 Return list of all phone numbers. 657 Return list of all phone numbers.
656 */ 658 */
657 PhoneNumber::List phoneNumbers() const; 659 PhoneNumber::List phoneNumbers() const;
658 660
659 /** 661 /**
660 Return list of phone numbers with a special type. 662 Return list of phone numbers with a special type.
661 */ 663 */
@@ -722,25 +724,25 @@ class Addressee
722 */ 724 */
723 void removeAddress( const Address &address ); 725 void removeAddress( const Address &address );
724 726
725 /** 727 /**
726 Return address, which matches the given type. 728 Return address, which matches the given type.
727 */ 729 */
728 Address address( int type ) const; 730 Address address( int type ) const;
729 731
730 /** 732 /**
731 Return list of all addresses. 733 Return list of all addresses.
732 */ 734 */
733 Address::List addresses() const; 735 Address::List addresses() const;
734 736 Address otherAddress() const;
735 /** 737 /**
736 Return list of addresses with a special type. 738 Return list of addresses with a special type.
737 */ 739 */
738 Address::List addresses( int type ) const; 740 Address::List addresses( int type ) const;
739 741
740 /** 742 /**
741 Return address with the given id. 743 Return address with the given id.
742 */ 744 */
743 Address findAddress( const QString &id ) const; 745 Address findAddress( const QString &id ) const;
744 746
745 /** 747 /**
746 Insert category. If the category already exists it is not duplicated. 748 Insert category. If the category already exists it is not duplicated.
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index 12b9b09..1752745 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -223,24 +223,48 @@ PhoneNumber::TypeList PhoneNumber::typeList()
223 list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video 223 list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video
224 << Bbs << Modem << Car << Isdn << Pcs << Pager; 224 << Bbs << Modem << Car << Isdn << Pcs << Pager;
225 225
226 return list; 226 return list;
227} 227}
228PhoneNumber::TypeList PhoneNumber::supportedTypeList() 228PhoneNumber::TypeList PhoneNumber::supportedTypeList()
229{ 229{
230 static TypeList list; 230 static TypeList list;
231 if ( list.count() == 0 ) 231 if ( list.count() == 0 )
232 list << (Home| Pref) << (Work| Pref) << Cell <<(Pcs|Pref)<< (Pcs|Voice)<< Home << Work << Car << Pcs <<(Work| Msg | Voice) << (Work| Msg) << (Home | Fax) << (Work| Fax) << Fax<< Pager << Isdn << Msg << Pref << Voice; 232 list << (Home| Pref) << (Work| Pref) << Cell <<(Pcs|Pref)<< (Pcs|Voice)<< Home << Work << Car << Pcs <<(Work| Msg | Voice) << (Work| Msg) << (Home | Fax) << (Work| Fax) << Fax<< Pager << Isdn << Msg << Pref << Voice;
233 return list; 233 return list;
234} 234}
235
236#if 0
237Home| Pref i18n("Home") Home
238Work| Pref i18n("Work") Business
239Cell i18n("Mobile") Mobile
240Pcs|Pref i18n("SiP") Radio
241Pcs|Voice i18n("VoIP") TTY/TTD
242Home i18n("Home2") Home 2
243Work i18n("Work2") Business 2
244Car i18n("Mobile2") Car
245Pcs i18n("SiP2") Telex
246Work| Msg | Voice i18n("Assistent") Assistent
247Work| Msg i18n("Company") Company
248Home | Fax i18n("Fax (Home)") Home Fax
249Work| Fax i18n("Fax (Work)") Business Fax
250Fax i18n("Fax (Other)") Other Fax
251Pager i18n("Pager") Pager
252Isdn i18n("ISDN") Isdn
253Msg i18n("Callback") Callback
254Pref i18n("Primary") Primary
255Voice; i18n("Other") Other
256
257#endif
258
235QStringList PhoneNumber::supportedTypeListNames() 259QStringList PhoneNumber::supportedTypeListNames()
236{ 260{
237 static QStringList list; 261 static QStringList list;
238 if ( list.count() == 0 ) 262 if ( list.count() == 0 )
239 list << i18n("Home") << i18n("Work") << i18n("Mobile") << i18n("SiP") << i18n("VoIP") <<i18n("Home2")<< i18n("Work2") << i18n("Mobile2") << i18n("SiP2") << i18n("Assistent") << i18n("Company") << i18n("Fax (Home)") << i18n("Fax (Work)") << i18n("Fax (Other)") << i18n("Pager") << i18n("ISDN") << i18n("Callback") << i18n("Primary")<< i18n("Other"); 263 list << i18n("Home") << i18n("Work") << i18n("Mobile") << i18n("SiP") << i18n("VoIP") <<i18n("Home2")<< i18n("Work2") << i18n("Mobile2") << i18n("SiP2") << i18n("Assistent") << i18n("Company") << i18n("Fax (Home)") << i18n("Fax (Work)") << i18n("Fax (Other)") << i18n("Pager") << i18n("ISDN") << i18n("Callback") << i18n("Primary")<< i18n("Other");
240 return list; 264 return list;
241} 265}
242 266
243int PhoneNumber::typeListIndex4Type(int type ) 267int PhoneNumber::typeListIndex4Type(int type )
244{ 268{
245 TypeList list = supportedTypeList(); 269 TypeList list = supportedTypeList();
246 int i = 0; 270 int i = 0;