-rw-r--r-- | kabc/addressee.cpp | 4 | ||||
-rw-r--r-- | kabc/addressee.h | 5 | ||||
-rw-r--r-- | kabc/field.cpp | 8 | ||||
-rw-r--r-- | kabc/phonenumber.cpp | 4 | ||||
-rw-r--r-- | kabc/phonenumber.h | 3 | ||||
-rw-r--r-- | kabc/vcard21parser.cpp | 5 | ||||
-rw-r--r-- | kabc/vcard21parser.h | 1 | ||||
-rw-r--r-- | kabc/vcardformatimpl.cpp | 2 | ||||
-rw-r--r-- | kabc/vcardparser/vcardtool.cpp | 1 |
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 @@ -467,32 +467,36 @@ QString Addressee::carPhoneLabel() { return i18n("Car Phone"); } QString Addressee::isdnLabel() { return i18n("ISDN"); } QString Addressee::pagerLabel() { return i18n("Pager"); } +QString Addressee::sipLabel() +{ + return i18n("SIP"); +} QString Addressee::emailLabel() { return i18n("Email Address"); } void Addressee::setMailer( const QString &mailer ) { if ( mailer == mData->mailer ) return; detach(); mData->empty = false; mData->mailer = mailer; } QString Addressee::mailer() const diff --git a/kabc/addressee.h b/kabc/addressee.h index 393d1cc..27782f9 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h @@ -320,32 +320,37 @@ class Addressee /** Return translated label for carPhone field. */ static QString carPhoneLabel(); /** Return translated label for isdn field. */ static QString isdnLabel(); /** Return translated label for pager field. */ static QString pagerLabel(); /** + Return translated label for sip field. + */ + static QString sipLabel(); + + /** Return translated label for email field. */ static QString emailLabel(); /** Set mail client. */ void setMailer( const QString &mailer ); /** Return mail client. */ QString mailer() const; /** Return translated label for mailer field. */ static QString mailerLabel(); diff --git a/kabc/field.cpp b/kabc/field.cpp index e27970e..d95cd19 100644 --- a/kabc/field.cpp +++ b/kabc/field.cpp @@ -71,33 +71,34 @@ class Field::FieldImpl BusinessAddressLabel, HomePhone, BusinessPhone, MobilePhone, HomeFax, BusinessFax, CarPhone, Isdn, Pager, Email, Mailer, Title, Role, Organization, Note, Url, - Resource + Resource, + Sip }; int fieldId() { return mFieldId; } int category() { return mCategory; } QString label() { return mLabel; } QString key() { return mKey; } QString app() { return mApp; } private: int mFieldId; int mCategory; QString mLabel; QString mKey; QString mApp; @@ -181,32 +182,34 @@ QString Field::label() case FieldImpl::Email: return Addressee::emailLabel(); case FieldImpl::Mailer: return Addressee::mailerLabel(); case FieldImpl::Title: return Addressee::titleLabel(); case FieldImpl::Role: return Addressee::roleLabel(); case FieldImpl::Organization: return Addressee::organizationLabel(); case FieldImpl::Note: return Addressee::noteLabel(); case FieldImpl::Url: return Addressee::urlLabel(); case FieldImpl::Resource: return Addressee::resourceLabel(); + case FieldImpl::Sip: + return Addressee::sipLabel(); case FieldImpl::CustomField: return mImpl->label(); default: return i18n("Unknown Field"); } } int Field::category() { return mImpl->category(); } QString Field::categoryLabel( int category ) { switch ( category ) { case All: @@ -277,32 +280,34 @@ QString Field::value( const KABC::Addressee &a ) case FieldImpl::HomePhone: return a.phoneNumber( PhoneNumber::Home ).number(); case FieldImpl::BusinessPhone: return a.phoneNumber( PhoneNumber::Work ).number(); case FieldImpl::MobilePhone: return a.phoneNumber( PhoneNumber::Cell ).number(); case FieldImpl::HomeFax: return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); case FieldImpl::BusinessFax: return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); case FieldImpl::CarPhone: return a.phoneNumber( PhoneNumber::Car ).number(); case FieldImpl::Isdn: return a.phoneNumber( PhoneNumber::Isdn ).number(); case FieldImpl::Pager: return a.phoneNumber( PhoneNumber::Pager ).number(); + case FieldImpl::Sip: + return a.phoneNumber( PhoneNumber::Sip ).number(); case FieldImpl::HomeAddressStreet: return a.address( Address::Home ).street(); case FieldImpl::HomeAddressLocality: return a.address( Address::Home ).locality(); case FieldImpl::HomeAddressRegion: return a.address( Address::Home ).region(); case FieldImpl::HomeAddressPostalCode: return a.address( Address::Home ).postalCode(); case FieldImpl::HomeAddressCountry: return a.address( Address::Home ).country(); case FieldImpl::BusinessAddressStreet: return a.address( Address::Work ).street(); case FieldImpl::BusinessAddressLocality: return a.address( Address::Work ).locality(); case FieldImpl::BusinessAddressRegion: return a.address( Address::Work ).region(); @@ -405,32 +410,33 @@ Field::List Field::allFields() createField( FieldImpl::HomePhone, Personal|Frequent ); createField( FieldImpl::BusinessPhone, Organization|Frequent ); createField( FieldImpl::MobilePhone, Frequent ); createField( FieldImpl::HomeFax ); createField( FieldImpl::BusinessFax ); createField( FieldImpl::CarPhone ); createField( FieldImpl::Isdn ); createField( FieldImpl::Pager ); createField( FieldImpl::Email, Email|Frequent ); createField( FieldImpl::Mailer, Email ); createField( FieldImpl::Title, Organization ); createField( FieldImpl::Role, Organization ); createField( FieldImpl::Organization, Organization ); createField( FieldImpl::Note ); createField( FieldImpl::Url ); createField( FieldImpl::Resource ); + createField( FieldImpl::Sip ); } return mAllFields; } Field::List Field::defaultFields() { if ( mDefaultFields.isEmpty() ) { createDefaultField( FieldImpl::GivenName ); createDefaultField( FieldImpl::FamilyName ); createDefaultField( FieldImpl::Email ); } return mDefaultFields; } diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 4ad608d..7aeb2ee 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp @@ -112,33 +112,33 @@ QString PhoneNumber::typeLabel() const } } return label; } QString PhoneNumber::label() const { return typeLabel( type() ); } PhoneNumber::TypeList PhoneNumber::typeList() { TypeList list; list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video - << Bbs << Modem << Car << Isdn << Pcs << Pager; + << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip; return list; } QString PhoneNumber::label( int type ) { return typeLabel( type ); } QString PhoneNumber::typeLabel( int type ) { QString typeString; if ((type & Home) == Home) typeString += i18n("Home"); else if ((type & Work) == Work) @@ -158,32 +158,34 @@ QString PhoneNumber::typeLabel( int type ) // typeString += i18n("Voice"); } else if ((type & Video) == Video) typeString += i18n("Video"); else if ((type & Bbs) == Bbs) typeString += i18n("Mailbox"); else if ((type & Modem) == Modem) typeString += i18n("Modem"); else if ((type & Car) == Car) typeString += i18n("Car"); else if ((type & Isdn) == Isdn) typeString += i18n("ISDN"); else if ((type & Pcs) == Pcs) typeString += i18n("PCS"); else if ((type & Pager) == Pager) typeString += i18n("Pager"); + else if ((type & Sip) == Sip) + typeString += i18n("SIP"); // add the prefered flag if (!typeString.isEmpty()) typeString += " "; if ((type & Pref) == Pref) typeString += i18n("(p)"); //if we still have no match, return "other" if (typeString.isEmpty()) return i18n("Other"); return typeString; } diff --git a/kabc/phonenumber.h b/kabc/phonenumber.h index 6a9c8cb..1df344f 100644 --- a/kabc/phonenumber.h +++ b/kabc/phonenumber.h @@ -51,36 +51,37 @@ class PhoneNumber /** @li @p Home - Home number @li @p Work - Office number @li @p Msg - Messaging @li @p Pref - Preferred number @li @p Voice - Voice @li @p Fax - Fax machine @li @p Cell - Cell phone @li @p Video - Video phone @li @p Bbs - Mailbox @li @p Modem - Modem @li @p Car - Car phone @li @p Isdn - ISDN connection @li @p Pcs - Personal Communication Service @li @p Pager - Pager + @li @p SIP - VoIP */ enum Types { Home = 1, Work = 2, Msg = 4, Pref = 8, Voice = 16, Fax = 32, Cell = 64, Video = 128, Bbs = 256, Modem = 512, Car = 1024, - Isdn = 2048, Pcs = 4096, Pager = 8192 }; + Isdn = 2048, Pcs = 4096, Pager = 8192, Sip = 16384 }; /** Create an empty phone number object. */ PhoneNumber(); /** Create a phonenumber object. @param number Number @param type Type as defined in enum. Multiple types can be specified by combining them by a logical or. */ PhoneNumber( const QString &number, int type = Home ); /** diff --git a/kabc/vcard21parser.cpp b/kabc/vcard21parser.cpp index b02aac4..277de22 100644 --- a/kabc/vcard21parser.cpp +++ b/kabc/vcard21parser.cpp @@ -157,33 +157,34 @@ bool VCardLineX::isValid() const case 't': if ( name == VCARD_TEL && qualified && (qualifiers.contains(VCARD_TEL_HOME) || qualifiers.contains(VCARD_TEL_WORK) || qualifiers.contains(VCARD_TEL_PREF) || qualifiers.contains(VCARD_TEL_VOICE) || qualifiers.contains(VCARD_TEL_FAX) || qualifiers.contains(VCARD_TEL_MSG) || qualifiers.contains(VCARD_TEL_CELL) || qualifiers.contains(VCARD_TEL_PAGER) || qualifiers.contains(VCARD_TEL_BBS) || qualifiers.contains(VCARD_TEL_MODEM) || qualifiers.contains(VCARD_TEL_CAR) || qualifiers.contains(VCARD_TEL_ISDN) || qualifiers.contains(VCARD_TEL_VIDEO) || - qualifiers.contains(VCARD_TEL_PCS) + qualifiers.contains(VCARD_TEL_PCS) || + qualifiers.contains(VCARD_TEL_SIP) ) ) return true; if ( name == VCARD_TZ ) return true; if ( name == VCARD_TITLE ) return true; break; case 'u': if ( name == VCARD_URL ) return true; if ( name == VCARD_UID ) return true; break; case 'v': @@ -288,32 +289,34 @@ KABC::Addressee VCard21Parser::readFromString( const QString &data) if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) ) type |= PhoneNumber::Cell; if ( (*i).qualifiers.contains( VCARD_TEL_PAGER ) ) type |= PhoneNumber::Pager; if ( (*i).qualifiers.contains( VCARD_TEL_BBS ) ) type |= PhoneNumber::Bbs; if ( (*i).qualifiers.contains( VCARD_TEL_MODEM ) ) type |= PhoneNumber::Modem; if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) ) type |= PhoneNumber::Car; if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) ) type |= PhoneNumber::Isdn; if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) ) type |= PhoneNumber::Video; if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) ) type |= PhoneNumber::Pcs; + if ( (*i).qualifiers.contains( VCARD_TEL_SIP ) ) + type |= PhoneNumber::Sip; } addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) ); } } //set the addressee's addresses for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { if ( (*i).name == VCARD_ADR ) { int type = 0; if ( (*i).qualified ) { if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) ) type |= Address::Dom; if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) ) type |= Address::Intl; if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) ) type |= Address::Postal; diff --git a/kabc/vcard21parser.h b/kabc/vcard21parser.h index 24b0eb2..77e69b6 100644 --- a/kabc/vcard21parser.h +++ b/kabc/vcard21parser.h @@ -79,32 +79,33 @@ $Id$ #define VCARD_TEL "tel" // types #define VCARD_TEL_HOME "home" #define VCARD_TEL_WORK "work" #define VCARD_TEL_PREF "pref" #define VCARD_TEL_VOICE "voice" #define VCARD_TEL_FAX "fax" #define VCARD_TEL_MSG "msg" #define VCARD_TEL_CELL "cell" #define VCARD_TEL_PAGER "pager" #define VCARD_TEL_BBS "bbs" #define VCARD_TEL_MODEM "modem" #define VCARD_TEL_CAR "car" #define VCARD_TEL_ISDN "isdn" #define VCARD_TEL_VIDEO "video" #define VCARD_TEL_PCS "pcs" +#define VCARD_TEL_SIP "sip" #define VCARD_EMAIL "email" // types #define VCARD_EMAIL_PREF "pref" #define VCARD_EMAIL_INTERNET "internet" #define VCARD_EMAIL_X400 "x400" #define VCARD_TZ "tz" #define VCARD_GEO "geo" #define VCARD_MAILER "mailer" #define VCARD_TITLE "title" #define VCARD_ROLE "role" #define VCARD_LOGO "logo" #define VCARD_AGENT "agent" #define VCARD_ORG "org" #define VCARD_CATEGORIES "categories" #define VCARD_NOTE "note" #define VCARD_PRODID "prodid" diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index bffaa64..2d6eb3d 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -578,64 +578,66 @@ void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p ) ParamList params; if( p.type() & PhoneNumber::Home ) params.append( new Param( "TYPE", "home" ) ); if( p.type() & PhoneNumber::Work ) params.append( new Param( "TYPE", "work" ) ); if( p.type() & PhoneNumber::Msg ) params.append( new Param( "TYPE", "msg" ) ); if( p.type() & PhoneNumber::Pref ) params.append( new Param( "TYPE", "pref" ) ); if( p.type() & PhoneNumber::Voice ) params.append( new Param( "TYPE", "voice" ) ); if( p.type() & PhoneNumber::Fax ) params.append( new Param( "TYPE", "fax" ) ); if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) ); if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) ); if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) ); if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) ); if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) ); if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) ); if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) ); if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) ); + if( p.type() & PhoneNumber::Sip ) params.append( new Param( "TYPE", "sip" ) ); cl.setParamList( params ); v->add(cl); } PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl ) { PhoneNumber p; TelValue *value = (TelValue *)cl->value(); p.setNumber( QString::fromUtf8( value->asString() ) ); int type = 0; ParamList params = cl->paramList(); ParamListIterator it( params ); QCString tmpStr; for( ; it.current(); ++it ) { if ( (*it)->name() == "TYPE" ) { tmpStr = (*it)->value().lower(); if ( tmpStr == "home" ) type |= PhoneNumber::Home; else if ( tmpStr == "work" ) type |= PhoneNumber::Work; else if ( tmpStr == "msg" ) type |= PhoneNumber::Msg; else if ( tmpStr == "pref" ) type |= PhoneNumber::Pref; else if ( tmpStr == "voice" ) type |= PhoneNumber::Voice; else if ( tmpStr == "fax" ) type |= PhoneNumber::Fax; else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell; else if ( tmpStr == "video" ) type |= PhoneNumber::Video; else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs; else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem; else if ( tmpStr == "car" ) type |= PhoneNumber::Car; else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn; else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs; else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager; + else if ( tmpStr == "sip" ) type |= PhoneNumber::Sip; } } p.setType( type ); return p; } QString VCardFormatImpl::readTextValue( ContentLine *cl ) { VCARD::Value *value = cl->value(); if ( value ) { return QString::fromUtf8( value->asString() ); } else { kdDebug(5700) << "No value: " << cl->asString() << endl; return QString::null; } 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 @@ -44,32 +44,33 @@ VCardTool::VCardTool() mAddressTypeMap.insert( "pref", Address::Pref ); mPhoneTypeMap.insert( "HOME", PhoneNumber::Home ); mPhoneTypeMap.insert( "WORK", PhoneNumber::Work ); mPhoneTypeMap.insert( "MSG", PhoneNumber::Msg ); mPhoneTypeMap.insert( "PREF", PhoneNumber::Pref ); mPhoneTypeMap.insert( "VOICE", PhoneNumber::Voice ); mPhoneTypeMap.insert( "FAX", PhoneNumber::Fax ); mPhoneTypeMap.insert( "CELL", PhoneNumber::Cell ); mPhoneTypeMap.insert( "VIDEO", PhoneNumber::Video ); mPhoneTypeMap.insert( "BBS", PhoneNumber::Bbs ); mPhoneTypeMap.insert( "MODEM", PhoneNumber::Modem ); mPhoneTypeMap.insert( "CAR", PhoneNumber::Car ); mPhoneTypeMap.insert( "ISDN", PhoneNumber::Isdn ); mPhoneTypeMap.insert( "PCS", PhoneNumber::Pcs ); mPhoneTypeMap.insert( "PAGER", PhoneNumber::Pager ); + mPhoneTypeMap.insert( "SIP", PhoneNumber::Sip ); } VCardTool::~VCardTool() { } QString VCardTool::createVCards( Addressee::List list, VCard::Version version ) { VCard::List vCardList; Addressee::List::Iterator addrIt; for ( addrIt = list.begin(); addrIt != list.end(); ++addrIt ) { VCard card; QStringList::ConstIterator strIt; // ADR + LABEL |