summaryrefslogtreecommitdiffabout
path: root/kabc
authorulf69 <ulf69>2004-09-09 18:57:57 (UTC)
committer ulf69 <ulf69>2004-09-09 18:57:57 (UTC)
commit880518b6f1d4b06e3df45224c244d9c62f6fb7a9 (patch) (unidiff)
tree2b0b5a0c7e40481c31f29ff2bd98aa6abb4c6c90 /kabc
parent72860f2b84ba97de9223238d9fb97edc0804cc68 (diff)
downloadkdepimpi-880518b6f1d4b06e3df45224c244d9c62f6fb7a9.zip
kdepimpi-880518b6f1d4b06e3df45224c244d9c62f6fb7a9.tar.gz
kdepimpi-880518b6f1d4b06e3df45224c244d9c62f6fb7a9.tar.bz2
added sip type to phonnumbers
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp4
-rw-r--r--kabc/addressee.h5
-rw-r--r--kabc/field.cpp8
-rw-r--r--kabc/phonenumber.cpp4
-rw-r--r--kabc/phonenumber.h3
-rw-r--r--kabc/vcard21parser.cpp5
-rw-r--r--kabc/vcard21parser.h1
-rw-r--r--kabc/vcardformatimpl.cpp2
-rw-r--r--kabc/vcardparser/vcardtool.cpp1
9 files changed, 29 insertions, 4 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index d484073..6b282e2 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -475,16 +475,20 @@ QString Addressee::isdnLabel()
475} 475}
476 476
477 477
478QString Addressee::pagerLabel() 478QString Addressee::pagerLabel()
479{ 479{
480 return i18n("Pager"); 480 return i18n("Pager");
481} 481}
482 482
483QString Addressee::sipLabel()
484{
485 return i18n("SIP");
486}
483 487
484QString Addressee::emailLabel() 488QString Addressee::emailLabel()
485{ 489{
486 return i18n("Email Address"); 490 return i18n("Email Address");
487} 491}
488 492
489 493
490void Addressee::setMailer( const QString &mailer ) 494void Addressee::setMailer( const QString &mailer )
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 393d1cc..27782f9 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -328,16 +328,21 @@ class Addressee
328 static QString isdnLabel(); 328 static QString isdnLabel();
329 329
330 /** 330 /**
331 Return translated label for pager field. 331 Return translated label for pager field.
332 */ 332 */
333 static QString pagerLabel(); 333 static QString pagerLabel();
334 334
335 /** 335 /**
336 Return translated label for sip field.
337 */
338 static QString sipLabel();
339
340 /**
336 Return translated label for email field. 341 Return translated label for email field.
337 */ 342 */
338 static QString emailLabel(); 343 static QString emailLabel();
339 344
340 /** 345 /**
341 Set mail client. 346 Set mail client.
342 */ 347 */
343 void setMailer( const QString &mailer ); 348 void setMailer( const QString &mailer );
diff --git a/kabc/field.cpp b/kabc/field.cpp
index e27970e..d95cd19 100644
--- a/kabc/field.cpp
+++ b/kabc/field.cpp
@@ -79,17 +79,18 @@ class Field::FieldImpl
79 Pager, 79 Pager,
80 Email, 80 Email,
81 Mailer, 81 Mailer,
82 Title, 82 Title,
83 Role, 83 Role,
84 Organization, 84 Organization,
85 Note, 85 Note,
86 Url, 86 Url,
87 Resource 87 Resource,
88 Sip
88 }; 89 };
89 90
90 int fieldId() { return mFieldId; } 91 int fieldId() { return mFieldId; }
91 int category() { return mCategory; } 92 int category() { return mCategory; }
92 93
93 QString label() { return mLabel; } 94 QString label() { return mLabel; }
94 QString key() { return mKey; } 95 QString key() { return mKey; }
95 QString app() { return mApp; } 96 QString app() { return mApp; }
@@ -189,16 +190,18 @@ QString Field::label()
189 case FieldImpl::Organization: 190 case FieldImpl::Organization:
190 return Addressee::organizationLabel(); 191 return Addressee::organizationLabel();
191 case FieldImpl::Note: 192 case FieldImpl::Note:
192 return Addressee::noteLabel(); 193 return Addressee::noteLabel();
193 case FieldImpl::Url: 194 case FieldImpl::Url:
194 return Addressee::urlLabel(); 195 return Addressee::urlLabel();
195 case FieldImpl::Resource: 196 case FieldImpl::Resource:
196 return Addressee::resourceLabel(); 197 return Addressee::resourceLabel();
198 case FieldImpl::Sip:
199 return Addressee::sipLabel();
197 case FieldImpl::CustomField: 200 case FieldImpl::CustomField:
198 return mImpl->label(); 201 return mImpl->label();
199 default: 202 default:
200 return i18n("Unknown Field"); 203 return i18n("Unknown Field");
201 } 204 }
202} 205}
203 206
204int Field::category() 207int Field::category()
@@ -285,16 +288,18 @@ QString Field::value( const KABC::Addressee &a )
285 case FieldImpl::BusinessFax: 288 case FieldImpl::BusinessFax:
286 return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); 289 return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number();
287 case FieldImpl::CarPhone: 290 case FieldImpl::CarPhone:
288 return a.phoneNumber( PhoneNumber::Car ).number(); 291 return a.phoneNumber( PhoneNumber::Car ).number();
289 case FieldImpl::Isdn: 292 case FieldImpl::Isdn:
290 return a.phoneNumber( PhoneNumber::Isdn ).number(); 293 return a.phoneNumber( PhoneNumber::Isdn ).number();
291 case FieldImpl::Pager: 294 case FieldImpl::Pager:
292 return a.phoneNumber( PhoneNumber::Pager ).number(); 295 return a.phoneNumber( PhoneNumber::Pager ).number();
296 case FieldImpl::Sip:
297 return a.phoneNumber( PhoneNumber::Sip ).number();
293 case FieldImpl::HomeAddressStreet: 298 case FieldImpl::HomeAddressStreet:
294 return a.address( Address::Home ).street(); 299 return a.address( Address::Home ).street();
295 case FieldImpl::HomeAddressLocality: 300 case FieldImpl::HomeAddressLocality:
296 return a.address( Address::Home ).locality(); 301 return a.address( Address::Home ).locality();
297 case FieldImpl::HomeAddressRegion: 302 case FieldImpl::HomeAddressRegion:
298 return a.address( Address::Home ).region(); 303 return a.address( Address::Home ).region();
299 case FieldImpl::HomeAddressPostalCode: 304 case FieldImpl::HomeAddressPostalCode:
300 return a.address( Address::Home ).postalCode(); 305 return a.address( Address::Home ).postalCode();
@@ -413,16 +418,17 @@ Field::List Field::allFields()
413 createField( FieldImpl::Email, Email|Frequent ); 418 createField( FieldImpl::Email, Email|Frequent );
414 createField( FieldImpl::Mailer, Email ); 419 createField( FieldImpl::Mailer, Email );
415 createField( FieldImpl::Title, Organization ); 420 createField( FieldImpl::Title, Organization );
416 createField( FieldImpl::Role, Organization ); 421 createField( FieldImpl::Role, Organization );
417 createField( FieldImpl::Organization, Organization ); 422 createField( FieldImpl::Organization, Organization );
418 createField( FieldImpl::Note ); 423 createField( FieldImpl::Note );
419 createField( FieldImpl::Url ); 424 createField( FieldImpl::Url );
420 createField( FieldImpl::Resource ); 425 createField( FieldImpl::Resource );
426 createField( FieldImpl::Sip );
421 } 427 }
422 428
423 return mAllFields; 429 return mAllFields;
424} 430}
425 431
426Field::List Field::defaultFields() 432Field::List Field::defaultFields()
427{ 433{
428 if ( mDefaultFields.isEmpty() ) { 434 if ( mDefaultFields.isEmpty() ) {
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index 4ad608d..7aeb2ee 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -120,17 +120,17 @@ QString PhoneNumber::label() const
120 return typeLabel( type() ); 120 return typeLabel( type() );
121} 121}
122 122
123PhoneNumber::TypeList PhoneNumber::typeList() 123PhoneNumber::TypeList PhoneNumber::typeList()
124{ 124{
125 TypeList list; 125 TypeList list;
126 126
127 list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video 127 list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video
128 << Bbs << Modem << Car << Isdn << Pcs << Pager; 128 << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip;
129 129
130 return list; 130 return list;
131} 131}
132 132
133QString PhoneNumber::label( int type ) 133QString PhoneNumber::label( int type )
134{ 134{
135 return typeLabel( type ); 135 return typeLabel( type );
136} 136}
@@ -166,16 +166,18 @@ QString PhoneNumber::typeLabel( int type )
166 else if ((type & Car) == Car) 166 else if ((type & Car) == Car)
167 typeString += i18n("Car"); 167 typeString += i18n("Car");
168 else if ((type & Isdn) == Isdn) 168 else if ((type & Isdn) == Isdn)
169 typeString += i18n("ISDN"); 169 typeString += i18n("ISDN");
170 else if ((type & Pcs) == Pcs) 170 else if ((type & Pcs) == Pcs)
171 typeString += i18n("PCS"); 171 typeString += i18n("PCS");
172 else if ((type & Pager) == Pager) 172 else if ((type & Pager) == Pager)
173 typeString += i18n("Pager"); 173 typeString += i18n("Pager");
174 else if ((type & Sip) == Sip)
175 typeString += i18n("SIP");
174 176
175 // add the prefered flag 177 // add the prefered flag
176 if (!typeString.isEmpty()) 178 if (!typeString.isEmpty())
177 typeString += " "; 179 typeString += " ";
178 180
179 if ((type & Pref) == Pref) 181 if ((type & Pref) == Pref)
180 typeString += i18n("(p)"); 182 typeString += i18n("(p)");
181 183
diff --git a/kabc/phonenumber.h b/kabc/phonenumber.h
index 6a9c8cb..1df344f 100644
--- a/kabc/phonenumber.h
+++ b/kabc/phonenumber.h
@@ -59,20 +59,21 @@ class PhoneNumber
59 @li @p Cell - Cell phone 59 @li @p Cell - Cell phone
60 @li @p Video - Video phone 60 @li @p Video - Video phone
61 @li @p Bbs - Mailbox 61 @li @p Bbs - Mailbox
62 @li @p Modem - Modem 62 @li @p Modem - Modem
63 @li @p Car - Car phone 63 @li @p Car - Car phone
64 @li @p Isdn - ISDN connection 64 @li @p Isdn - ISDN connection
65 @li @p Pcs - Personal Communication Service 65 @li @p Pcs - Personal Communication Service
66 @li @p Pager - Pager 66 @li @p Pager - Pager
67 @li @p SIP - VoIP
67 */ 68 */
68 enum Types { Home = 1, Work = 2, Msg = 4, Pref = 8, Voice = 16, Fax = 32, 69 enum Types { Home = 1, Work = 2, Msg = 4, Pref = 8, Voice = 16, Fax = 32,
69 Cell = 64, Video = 128, Bbs = 256, Modem = 512, Car = 1024, 70 Cell = 64, Video = 128, Bbs = 256, Modem = 512, Car = 1024,
70 Isdn = 2048, Pcs = 4096, Pager = 8192 }; 71 Isdn = 2048, Pcs = 4096, Pager = 8192, Sip = 16384 };
71 72
72 /** 73 /**
73 Create an empty phone number object. 74 Create an empty phone number object.
74 */ 75 */
75 PhoneNumber(); 76 PhoneNumber();
76 77
77 /** 78 /**
78 Create a phonenumber object. 79 Create a phonenumber object.
diff --git a/kabc/vcard21parser.cpp b/kabc/vcard21parser.cpp
index b02aac4..277de22 100644
--- a/kabc/vcard21parser.cpp
+++ b/kabc/vcard21parser.cpp
@@ -165,17 +165,18 @@ bool VCardLineX::isValid() const
165 qualifiers.contains(VCARD_TEL_MSG) || 165 qualifiers.contains(VCARD_TEL_MSG) ||
166 qualifiers.contains(VCARD_TEL_CELL) || 166 qualifiers.contains(VCARD_TEL_CELL) ||
167 qualifiers.contains(VCARD_TEL_PAGER) || 167 qualifiers.contains(VCARD_TEL_PAGER) ||
168 qualifiers.contains(VCARD_TEL_BBS) || 168 qualifiers.contains(VCARD_TEL_BBS) ||
169 qualifiers.contains(VCARD_TEL_MODEM) || 169 qualifiers.contains(VCARD_TEL_MODEM) ||
170 qualifiers.contains(VCARD_TEL_CAR) || 170 qualifiers.contains(VCARD_TEL_CAR) ||
171 qualifiers.contains(VCARD_TEL_ISDN) || 171 qualifiers.contains(VCARD_TEL_ISDN) ||
172 qualifiers.contains(VCARD_TEL_VIDEO) || 172 qualifiers.contains(VCARD_TEL_VIDEO) ||
173 qualifiers.contains(VCARD_TEL_PCS) 173 qualifiers.contains(VCARD_TEL_PCS) ||
174 qualifiers.contains(VCARD_TEL_SIP)
174 ) ) 175 ) )
175 return true; 176 return true;
176 if ( name == VCARD_TZ ) 177 if ( name == VCARD_TZ )
177 return true; 178 return true;
178 if ( name == VCARD_TITLE ) 179 if ( name == VCARD_TITLE )
179 return true; 180 return true;
180 break; 181 break;
181 182
@@ -296,16 +297,18 @@ KABC::Addressee VCard21Parser::readFromString( const QString &data)
296 if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) ) 297 if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) )
297 type |= PhoneNumber::Car; 298 type |= PhoneNumber::Car;
298 if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) ) 299 if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) )
299 type |= PhoneNumber::Isdn; 300 type |= PhoneNumber::Isdn;
300 if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) ) 301 if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) )
301 type |= PhoneNumber::Video; 302 type |= PhoneNumber::Video;
302 if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) ) 303 if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) )
303 type |= PhoneNumber::Pcs; 304 type |= PhoneNumber::Pcs;
305 if ( (*i).qualifiers.contains( VCARD_TEL_SIP ) )
306 type |= PhoneNumber::Sip;
304 } 307 }
305 addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) ); 308 addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) );
306 } 309 }
307 } 310 }
308 311
309 //set the addressee's addresses 312 //set the addressee's addresses
310 for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { 313 for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
311 if ( (*i).name == VCARD_ADR ) { 314 if ( (*i).name == VCARD_ADR ) {
diff --git a/kabc/vcard21parser.h b/kabc/vcard21parser.h
index 24b0eb2..77e69b6 100644
--- a/kabc/vcard21parser.h
+++ b/kabc/vcard21parser.h
@@ -87,16 +87,17 @@ $Id$
87#define VCARD_TEL_CELL "cell" 87#define VCARD_TEL_CELL "cell"
88#define VCARD_TEL_PAGER "pager" 88#define VCARD_TEL_PAGER "pager"
89#define VCARD_TEL_BBS "bbs" 89#define VCARD_TEL_BBS "bbs"
90#define VCARD_TEL_MODEM "modem" 90#define VCARD_TEL_MODEM "modem"
91#define VCARD_TEL_CAR "car" 91#define VCARD_TEL_CAR "car"
92#define VCARD_TEL_ISDN "isdn" 92#define VCARD_TEL_ISDN "isdn"
93#define VCARD_TEL_VIDEO "video" 93#define VCARD_TEL_VIDEO "video"
94#define VCARD_TEL_PCS "pcs" 94#define VCARD_TEL_PCS "pcs"
95#define VCARD_TEL_SIP "sip"
95#define VCARD_EMAIL "email" 96#define VCARD_EMAIL "email"
96// types 97// types
97#define VCARD_EMAIL_PREF "pref" 98#define VCARD_EMAIL_PREF "pref"
98#define VCARD_EMAIL_INTERNET "internet" 99#define VCARD_EMAIL_INTERNET "internet"
99#define VCARD_EMAIL_X400 "x400" 100#define VCARD_EMAIL_X400 "x400"
100#define VCARD_TZ "tz" 101#define VCARD_TZ "tz"
101#define VCARD_GEO "geo" 102#define VCARD_GEO "geo"
102#define VCARD_MAILER "mailer" 103#define VCARD_MAILER "mailer"
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp
index bffaa64..2d6eb3d 100644
--- a/kabc/vcardformatimpl.cpp
+++ b/kabc/vcardformatimpl.cpp
@@ -586,16 +586,17 @@ void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p )
586 if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) ); 586 if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) );
587 if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) ); 587 if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) );
588 if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) ); 588 if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) );
589 if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) ); 589 if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) );
590 if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) ); 590 if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) );
591 if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) ); 591 if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) );
592 if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) ); 592 if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) );
593 if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) ); 593 if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) );
594 if( p.type() & PhoneNumber::Sip ) params.append( new Param( "TYPE", "sip" ) );
594 cl.setParamList( params ); 595 cl.setParamList( params );
595 596
596 v->add(cl); 597 v->add(cl);
597} 598}
598 599
599PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl ) 600PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl )
600{ 601{
601 PhoneNumber p; 602 PhoneNumber p;
@@ -618,16 +619,17 @@ PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl )
618 else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell; 619 else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell;
619 else if ( tmpStr == "video" ) type |= PhoneNumber::Video; 620 else if ( tmpStr == "video" ) type |= PhoneNumber::Video;
620 else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs; 621 else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs;
621 else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem; 622 else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem;
622 else if ( tmpStr == "car" ) type |= PhoneNumber::Car; 623 else if ( tmpStr == "car" ) type |= PhoneNumber::Car;
623 else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn; 624 else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn;
624 else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs; 625 else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs;
625 else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager; 626 else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager;
627 else if ( tmpStr == "sip" ) type |= PhoneNumber::Sip;
626 } 628 }
627 } 629 }
628 p.setType( type ); 630 p.setType( type );
629 631
630 return p; 632 return p;
631} 633}
632 634
633QString VCardFormatImpl::readTextValue( ContentLine *cl ) 635QString VCardFormatImpl::readTextValue( ContentLine *cl )
diff --git a/kabc/vcardparser/vcardtool.cpp b/kabc/vcardparser/vcardtool.cpp
index 71f29d7..3fb212e 100644
--- a/kabc/vcardparser/vcardtool.cpp
+++ b/kabc/vcardparser/vcardtool.cpp
@@ -52,16 +52,17 @@ VCardTool::VCardTool()
52 mPhoneTypeMap.insert( "CELL", PhoneNumber::Cell ); 52 mPhoneTypeMap.insert( "CELL", PhoneNumber::Cell );
53 mPhoneTypeMap.insert( "VIDEO", PhoneNumber::Video ); 53 mPhoneTypeMap.insert( "VIDEO", PhoneNumber::Video );
54 mPhoneTypeMap.insert( "BBS", PhoneNumber::Bbs ); 54 mPhoneTypeMap.insert( "BBS", PhoneNumber::Bbs );
55 mPhoneTypeMap.insert( "MODEM", PhoneNumber::Modem ); 55 mPhoneTypeMap.insert( "MODEM", PhoneNumber::Modem );
56 mPhoneTypeMap.insert( "CAR", PhoneNumber::Car ); 56 mPhoneTypeMap.insert( "CAR", PhoneNumber::Car );
57 mPhoneTypeMap.insert( "ISDN", PhoneNumber::Isdn ); 57 mPhoneTypeMap.insert( "ISDN", PhoneNumber::Isdn );
58 mPhoneTypeMap.insert( "PCS", PhoneNumber::Pcs ); 58 mPhoneTypeMap.insert( "PCS", PhoneNumber::Pcs );
59 mPhoneTypeMap.insert( "PAGER", PhoneNumber::Pager ); 59 mPhoneTypeMap.insert( "PAGER", PhoneNumber::Pager );
60 mPhoneTypeMap.insert( "SIP", PhoneNumber::Sip );
60} 61}
61 62
62VCardTool::~VCardTool() 63VCardTool::~VCardTool()
63{ 64{
64} 65}
65 66
66QString VCardTool::createVCards( Addressee::List list, VCard::Version version ) 67QString VCardTool::createVCards( Addressee::List list, VCard::Version version )
67{ 68{