-rw-r--r-- | kabc/addressee.cpp | 4 | ||||
-rw-r--r-- | kabc/addressee.h | 2 | ||||
-rw-r--r-- | kabc/field.cpp | 8 |
3 files changed, 12 insertions, 2 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 789a694..0d8e8e8 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -1050,96 +1050,100 @@ QString Addressee::homePhoneLabel() QString Addressee::businessPhoneLabel() { return i18n("Work Phone"); } QString Addressee::mobilePhoneLabel() { return i18n("Mobile Phone"); } QString Addressee::mobileWorkPhoneLabel() { return i18n("Mobile2 (Work)"); } QString Addressee::mobileHomePhoneLabel() { return i18n("Mobile (Home)"); } QString Addressee::homeFaxLabel() { return i18n("Fax (Home)"); } QString Addressee::businessFaxLabel() { return i18n("Fax (Work)"); } QString Addressee::carPhoneLabel() { return i18n("Mobile2 (Car)"); } QString Addressee::isdnLabel() { return i18n("ISDN"); } QString Addressee::pagerLabel() { return i18n("Pager"); } +QString Addressee::otherPhoneLabel() +{ + return i18n("Other Phone"); +} 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; } TimeZone Addressee::timeZone() const { return mData->timeZone; } QString Addressee::timeZoneLabel() { return i18n("Time Zone"); } diff --git a/kabc/addressee.h b/kabc/addressee.h index 0c488eb..fcadda6 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h @@ -313,97 +313,97 @@ class Addressee static QString businessAddressCountryLabel(); /** Return translated label for businessAddressLabel field. */ static QString businessAddressLabelLabel(); /** Return translated label for homePhone field. */ static QString homePhoneLabel(); /** Return translated label for businessPhone field. */ static QString businessPhoneLabel(); /** Return translated label for mobilePhone field. */ static QString mobilePhoneLabel(); static QString mobileWorkPhoneLabel(); static QString mobileHomePhoneLabel(); /** 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(); - + static QString otherPhoneLabel(); /** 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. */ void setGeo( const Geo &geo ); /** Return geographic position. */ Geo geo() const; /** Return translated label for geo field. */ static QString geoLabel(); diff --git a/kabc/field.cpp b/kabc/field.cpp index 20885de..6f2b307 100644 --- a/kabc/field.cpp +++ b/kabc/field.cpp @@ -43,97 +43,98 @@ class Field::FieldImpl const QString &label = QString::null, const QString &key = QString::null, const QString &app = QString::null ) : mFieldId( fieldId ), mCategory( category ), mLabel( label ), mKey( key ), mApp( app ) {} enum FieldId { CustomField, FormattedName, FamilyName, GivenName, AdditionalName, Prefix, Suffix, NickName, Birthday, Category, 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, Sip, MobileWorkPhone, - MobileHomePhone + MobileHomePhone, + OtherPhone }; 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; } QString Field::label() { switch ( mImpl->fieldId() ) { case FieldImpl::FormattedName: return Addressee::formattedNameLabel(); case FieldImpl::FamilyName: return Addressee::familyNameLabel(); case FieldImpl::GivenName: return Addressee::givenNameLabel(); case FieldImpl::AdditionalName: return Addressee::additionalNameLabel(); case FieldImpl::Prefix: return Addressee::prefixLabel(); case FieldImpl::Suffix: @@ -161,96 +162,98 @@ QString Field::label() case FieldImpl::BusinessAddressRegion: return Addressee::businessAddressRegionLabel(); case FieldImpl::BusinessAddressPostalCode: return Addressee::businessAddressPostalCodeLabel(); case FieldImpl::BusinessAddressCountry: return Addressee::businessAddressCountryLabel(); case FieldImpl::BusinessAddressLabel: return Addressee::businessAddressLabelLabel(); case FieldImpl::HomePhone: return Addressee::homePhoneLabel(); case FieldImpl::BusinessPhone: return Addressee::businessPhoneLabel(); case FieldImpl::MobilePhone: return Addressee::mobilePhoneLabel(); case FieldImpl::MobileHomePhone: return Addressee::mobileHomePhoneLabel(); case FieldImpl::MobileWorkPhone: return Addressee::mobileWorkPhoneLabel(); 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::Category: return Addressee::categoryLabel(); case FieldImpl::Sip: return Addressee::sipLabel(); + case FieldImpl::OtherPhone: + return Addressee::otherPhoneLabel(); 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"); } } QString Field::value( const KABC::Addressee &a ) { switch ( mImpl->fieldId() ) { case FieldImpl::FormattedName: return a.formattedName(); case FieldImpl::FamilyName: return a.familyName(); case FieldImpl::GivenName: return a.givenName(); case FieldImpl::AdditionalName: return a.additionalName(); case FieldImpl::Prefix: return a.prefix(); case FieldImpl::Suffix: @@ -265,96 +268,98 @@ QString Field::value( const KABC::Addressee &a ) return a.role(); case FieldImpl::Organization: return a.organization(); case FieldImpl::Note: return a.note(); case FieldImpl::Email: return a.preferredEmail(); case FieldImpl::Birthday: 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::Category: return a.categories().join(","); case FieldImpl::HomePhone: return a.phoneNumber( PhoneNumber::Home| PhoneNumber::Pref ).number(); case FieldImpl::BusinessPhone: return a.phoneNumber( PhoneNumber::Work| PhoneNumber::Pref ).number(); case FieldImpl::MobilePhone: return a.phoneNumber( PhoneNumber::Cell ).number(); case FieldImpl::MobileWorkPhone: return a.phoneNumber( PhoneNumber::Car ).number(); case FieldImpl::MobileHomePhone: 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::Pcs | PhoneNumber::Pref ).number(); + case FieldImpl::OtherPhone: + return a.phoneNumber( PhoneNumber::Voice ).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 ); return true; case FieldImpl::FamilyName: a.setFamilyName( value ); return true; case FieldImpl::GivenName: a.setGivenName( value ); return true; case FieldImpl::AdditionalName: a.setAdditionalName( value ); return true; case FieldImpl::Prefix: a.setPrefix( value ); return true; case FieldImpl::Suffix: a.setSuffix( value ); return true; @@ -397,96 +402,97 @@ bool Field::setValue( KABC::Addressee &a, const QString &value ) bool Field::isCustom() { return mImpl->fieldId() == FieldImpl::CustomField; } Field::List Field::allFields() { if ( mAllFields.isEmpty() ) { createField( FieldImpl::FormattedName, Frequent ); createField( FieldImpl::FamilyName, Frequent ); createField( FieldImpl::GivenName, Frequent ); createField( FieldImpl::AdditionalName ); createField( FieldImpl::Prefix ); createField( FieldImpl::Suffix ); createField( FieldImpl::NickName, Personal ); createField( FieldImpl::Birthday, Personal ); createField( FieldImpl::Category ); 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::MobileHomePhone, Frequent ); createField( FieldImpl::MobileWorkPhone, 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 ); + createField( FieldImpl::OtherPhone ); } 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); } mAllFields.clear(); for( it = mDefaultFields.begin(); it != mDefaultFields.end(); ++it ) { delete (*it); } mDefaultFields.clear(); for( it = mCustomFields.begin(); it != mCustomFields.end(); ++it ) { delete (*it); } mCustomFields.clear(); } void Field::saveFields( const QString &identifier, const Field::List &fields ) |