author | ulf69 <ulf69> | 2004-09-09 18:57:57 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-09 18:57:57 (UTC) |
commit | 880518b6f1d4b06e3df45224c244d9c62f6fb7a9 (patch) (side-by-side diff) | |
tree | 2b0b5a0c7e40481c31f29ff2bd98aa6abb4c6c90 /kabc | |
parent | 72860f2b84ba97de9223238d9fb97edc0804cc68 (diff) | |
download | kdepimpi-880518b6f1d4b06e3df45224c244d9c62f6fb7a9.zip kdepimpi-880518b6f1d4b06e3df45224c244d9c62f6fb7a9.tar.gz kdepimpi-880518b6f1d4b06e3df45224c244d9c62f6fb7a9.tar.bz2 |
added sip type to phonnumbers
-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 @@ -451,64 +451,68 @@ QString Addressee::mobilePhoneLabel() } QString Addressee::homeFaxLabel() { return i18n("Home Fax"); } QString Addressee::businessFaxLabel() { return i18n("Business Fax"); } 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 { return mData->mailer; } QString Addressee::mailerLabel() { return i18n("Mail Client"); } void Addressee::setTimeZone( const TimeZone &timeZone ) { if ( timeZone == mData->timeZone ) return; detach(); mData->empty = false; mData->timeZone = timeZone; diff --git a/kabc/addressee.h b/kabc/addressee.h index 393d1cc..27782f9 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h @@ -304,64 +304,69 @@ class Addressee /** Return translated label for mobilePhone field. */ static QString mobilePhoneLabel(); /** Return translated label for homeFax field. */ static QString homeFaxLabel(); /** Return translated label for businessFax field. */ static QString businessFaxLabel(); /** 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(); /** Set time zone. */ void setTimeZone( const TimeZone &timeZone ); /** Return time zone. */ TimeZone timeZone() const; /** Return translated label for timeZone field. */ static QString timeZoneLabel(); /** Set geographic position. diff --git a/kabc/field.cpp b/kabc/field.cpp index e27970e..d95cd19 100644 --- a/kabc/field.cpp +++ b/kabc/field.cpp @@ -55,65 +55,66 @@ class Field::FieldImpl AdditionalName, Prefix, Suffix, NickName, Birthday, HomeAddressStreet, HomeAddressLocality, HomeAddressRegion, HomeAddressPostalCode, HomeAddressCountry, HomeAddressLabel, BusinessAddressStreet, BusinessAddressLocality, BusinessAddressRegion, BusinessAddressPostalCode, BusinessAddressCountry, 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; }; Field::List Field::mAllFields; Field::List Field::mDefaultFields; Field::List Field::mCustomFields; Field::Field( FieldImpl *impl ) { mImpl = impl; } Field::~Field() { delete mImpl; @@ -165,64 +166,66 @@ QString Field::label() case FieldImpl::HomePhone: return Addressee::homePhoneLabel(); case FieldImpl::BusinessPhone: return Addressee::businessPhoneLabel(); case FieldImpl::MobilePhone: return Addressee::mobilePhoneLabel(); case FieldImpl::HomeFax: return Addressee::homeFaxLabel(); case FieldImpl::BusinessFax: return Addressee::businessFaxLabel(); case FieldImpl::CarPhone: return Addressee::carPhoneLabel(); case FieldImpl::Isdn: return Addressee::isdnLabel(); case FieldImpl::Pager: return Addressee::pagerLabel(); 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: return i18n("All"); case Frequent: return i18n("Frequent"); case Address: return i18n("Address"); case Email: return i18n("Email"); case Personal: return i18n("Personal"); case Organization: return i18n("Organization"); case CustomCategory: return i18n("Custom"); default: return i18n("Undefined"); } @@ -261,64 +264,66 @@ QString Field::value( const KABC::Addressee &a ) if ( a.birthday().isValid() ) { //the generated code had the following format: return a.birthday().date().toString( Qt::ISODate ); // But Qt::IsoDate was not specified. // QString _oldFormat = KGlobal::locale()->dateFormat(); // KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false, KLocale::ISODate); // KGlobal::locale()->setDateFormat(_oldFormat); return dt; } else return QString::null; case FieldImpl::Url: return a.url().prettyURL(); //US case FieldImpl::Resource: return a.resource()->resourceName(); 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(); case FieldImpl::BusinessAddressPostalCode: return a.address( Address::Work ).postalCode(); case FieldImpl::BusinessAddressCountry: return a.address( Address::Work ).country(); case FieldImpl::CustomField: return a.custom( mImpl->app(), mImpl->key() ); default: return QString::null; } } bool Field::setValue( KABC::Addressee &a, const QString &value ) { switch ( mImpl->fieldId() ) { case FieldImpl::FormattedName: a.setFormattedName( value ); @@ -389,64 +394,65 @@ Field::List Field::allFields() createField( FieldImpl::Prefix ); createField( FieldImpl::Suffix ); createField( FieldImpl::NickName, Personal ); createField( FieldImpl::Birthday, Personal ); createField( FieldImpl::HomeAddressStreet, Address|Personal ); createField( FieldImpl::HomeAddressLocality, Address|Personal ); createField( FieldImpl::HomeAddressRegion, Address|Personal ); createField( FieldImpl::HomeAddressPostalCode, Address|Personal ); createField( FieldImpl::HomeAddressCountry, Address|Personal ); createField( FieldImpl::HomeAddressLabel, Address|Personal ); createField( FieldImpl::BusinessAddressStreet, Address|Organization ); createField( FieldImpl::BusinessAddressLocality, Address|Organization ); createField( FieldImpl::BusinessAddressRegion, Address|Organization ); createField( FieldImpl::BusinessAddressPostalCode, Address|Organization ); createField( FieldImpl::BusinessAddressCountry, Address|Organization ); createField( FieldImpl::BusinessAddressLabel, Address|Organization ); 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; } void Field::createField( int id, int category ) { mAllFields.append( new Field( new FieldImpl( id, category ) ) ); } void Field::createDefaultField( int id, int category ) { mDefaultFields.append( new Field( new FieldImpl( id, category ) ) ); } void Field::deleteFields() { Field::List::ConstIterator it; for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) { delete (*it); diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 4ad608d..7aeb2ee 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp @@ -96,105 +96,107 @@ int PhoneNumber::type() const return mType; } QString PhoneNumber::typeLabel() const { QString label; bool first = true; TypeList list = typeList(); TypeList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); if ( first ) first = false; } } 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) typeString += i18n("Work"); if (!typeString.isEmpty()) typeString += " "; if ((type & Cell) == Cell) typeString += i18n("Mobile"); else if ((type & Fax) == Fax) typeString += i18n("Fax"); else if ((type & Msg) == Msg) typeString += i18n("Messenger"); else if ((type & Voice) == Voice) { // add nothing in case of the Voice flag // 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; } QDataStream &KABC::operator<<( QDataStream &s, const PhoneNumber &phone ) { return s << phone.mId << phone.mType << phone.mNumber; } QDataStream &KABC::operator>>( QDataStream &s, PhoneNumber &phone ) { s >> phone.mId >> phone.mType >> phone.mNumber; return s; } diff --git a/kabc/phonenumber.h b/kabc/phonenumber.h index 6a9c8cb..1df344f 100644 --- a/kabc/phonenumber.h +++ b/kabc/phonenumber.h @@ -35,68 +35,69 @@ namespace KABC { /** @short Phonenumber information. This class provides phone number information. A phone number is classified by a type. The following types are available, it's possible to use multiple types @ref Types for a number by combining them through a logical or. */ class PhoneNumber { friend QDataStream &operator<<( QDataStream &, const PhoneNumber & ); friend QDataStream &operator>>( QDataStream &, PhoneNumber & ); public: typedef QValueList<PhoneNumber> List; typedef QValueList<int> TypeList; /** @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 ); /** Destructor. */ ~PhoneNumber(); bool operator==( const PhoneNumber & ) const; bool operator!=( const PhoneNumber & ) const; /** Sets the unique identifier. */ void setId( const QString &id ); /** Returns the unique identifier. */ QString id() const; diff --git a/kabc/vcard21parser.cpp b/kabc/vcard21parser.cpp index b02aac4..277de22 100644 --- a/kabc/vcard21parser.cpp +++ b/kabc/vcard21parser.cpp @@ -141,65 +141,66 @@ bool VCardLineX::isValid() const return true; break; case 'r': if ( name == VCARD_ROLE ) return true; if ( name == VCARD_REV ) return true; break; case 's': if ( name == VCARD_SOURCE ) return true; if ( name == VCARD_SOUND ) return true; break; 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': if ( name == VCARD_VERSION ) return true; break; default: break; } return false; } VCard21Parser::VCard21Parser() { } VCard21Parser::~VCard21Parser() @@ -272,64 +273,66 @@ KABC::Addressee VCard21Parser::readFromString( const QString &data) for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { if ( (*i).name == VCARD_TEL ) { int type = 0; if ( (*i).qualified ) { if ( (*i).qualifiers.contains( VCARD_TEL_HOME ) ) type |= PhoneNumber::Home; if ( (*i).qualifiers.contains( VCARD_TEL_WORK ) ) type |= PhoneNumber::Work; if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) ) type |= PhoneNumber::Pref; // if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) ) // type |= PhoneNumber::Voice; if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) ) type |= PhoneNumber::Fax; if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) ) type |= PhoneNumber::Msg; 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; if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) ) type |= Address::Parcel; if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) ) type |= Address::Home; if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) ) type |= Address::Work; if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) ) type |= Address::Pref; } addressee.insertAddress( readAddressFromQStringList( (*i).parameters, type ) ); } } //set the addressee's delivery label tmpStr = mVCard->getValue(VCARD_LABEL); if (!tmpStr.isEmpty()) { diff --git a/kabc/vcard21parser.h b/kabc/vcard21parser.h index 24b0eb2..77e69b6 100644 --- a/kabc/vcard21parser.h +++ b/kabc/vcard21parser.h @@ -63,64 +63,65 @@ $Id$ #define VCARD_ADR_POSTAL "postal" #define VCARD_ADR_PARCEL "parcel" #define VCARD_ADR_HOME "home" #define VCARD_ADR_WORK "work" #define VCARD_ADR_PREF "pref" // values #define VCARD_ADR_POBOX "PO Box" #define VCARD_ADR_EXTADR "Extended Address" #define VCARD_ADR_STREET "Street" #define VCARD_ADR_LOCALITY "Locality" #define VCARD_ADR_REGION "Region" #define VCARD_ADR_POSTCODE "Postal Code" #define VCARD_ADR_COUNTRY "Country Name" #define VCARD_LABEL "label" #define VCARD_PROFILE "profile" #define VCARD_SOURCE "source" #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" #define VCARD_REV "rev" #define VCARD_SOUND "sound" #define VCARD_UID "uid" #define VCARD_URL "url" #define VCARD_CLASS "class" #define VCARD_CLASS_PUBLIC "public" #define VCARD_CLASS_PRIVATE "private" #define VCARD_CLASS_CONFIDENTIAL "confidential" #define VCARD_KEY "key" // types #define VCARD_KEY_X509 "x509" #define VCARD_KEY_PGP "pgp" #define VCARD_QUOTED_PRINTABLE "quoted-printable" // this one is a temporary hack until we support TYPE=VALUE #define VCARD_ENCODING_QUOTED_PRINTABLE "encoding=quoted-printable" diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index bffaa64..2d6eb3d 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -562,96 +562,98 @@ void VCardFormatImpl::readNValue( ContentLine *cl, Addressee &a ) NValue *v = (NValue *)cl->value(); a.setFamilyName( QString::fromUtf8( v->family() ) ); a.setGivenName( QString::fromUtf8( v->given() ) ); a.setAdditionalName( QString::fromUtf8( v->middle() ) ); a.setPrefix( QString::fromUtf8( v->prefix() ) ); a.setSuffix( QString::fromUtf8( v->suffix() ) ); } void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p ) { if ( p.number().isEmpty() ) return; ContentLine cl; cl.setName(EntityTypeToParamName(EntityTelephone)); cl.setValue(new TelValue( p.number().utf8() )); 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; } } QDate VCardFormatImpl::readDateValue( ContentLine *cl ) { DateValue *dateValue = (DateValue *)cl->value(); if ( dateValue ) return dateValue->qdate(); else return QDate(); } QDateTime VCardFormatImpl::readDateTimeValue( ContentLine *cl ) { DateValue *dateValue = (DateValue *)cl->value(); if ( dateValue ) return dateValue->qdt(); 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 @@ -28,64 +28,65 @@ #include "picture.h" #include "secrecy.h" #include "sound.h" #include "vcardtool.h" using namespace KABC; VCardTool::VCardTool() { mAddressTypeMap.insert( "dom", Address::Dom ); mAddressTypeMap.insert( "intl", Address::Intl ); mAddressTypeMap.insert( "postal", Address::Postal ); mAddressTypeMap.insert( "parcel", Address::Parcel ); mAddressTypeMap.insert( "home", Address::Home ); mAddressTypeMap.insert( "work", Address::Work ); 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 Address::List addresses = (*addrIt).addresses(); for ( Address::List::Iterator it = addresses.begin(); it != addresses.end(); ++it ) { QStringList address; /*US address.append( (*it).postOfficeBox().replace( ';', "\\;" ) ); address.append( (*it).extended().replace( ';', "\\;" ) ); address.append( (*it).street().replace( ';', "\\;" ) ); address.append( (*it).locality().replace( ';', "\\;" ) ); address.append( (*it).region().replace( ';', "\\;" ) ); address.append( (*it).postalCode().replace( ';', "\\;" ) ); address.append( (*it).country().replace( ';', "\\;" ) ); */ //US using the old implementation instead //qDebug("VCardTool::createVCards has to be verified"); address.append( (*it).postOfficeBox().replace( QRegExp(";"), "\\;" ) ); |