-rw-r--r-- | kabc/addressee.cpp | 25 | ||||
-rw-r--r-- | kabc/addressee.h | 5 | ||||
-rw-r--r-- | kabc/field.cpp | 20 | ||||
-rw-r--r-- | kabc/phonenumber.cpp | 11 |
4 files changed, 54 insertions, 7 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 39d14bb..7f592e9 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -38,32 +38,33 @@ $Id$ #include <libkcal/syncdefines.h> //US #include "resource.h" #include "addressee.h" using namespace KABC; static bool matchBinaryPattern( int value, int pattern ); static bool matchBinaryPatternA( int value, int pattern ); static bool matchBinaryPatternP( int value, int pattern ); struct Addressee::AddresseeData : public KShared { QString uid; QString name; QString formattedName; + QString defaultFormattedName; QString familyName; QString givenName; QString additionalName; QString prefix; QString suffix; QString nickName; QDateTime birthday; QString mailer; TimeZone timeZone; Geo geo; QString title; QString role; QString organization; QString note; QString productId; QDateTime revision; @@ -734,43 +735,59 @@ QString Addressee::name() const return mData->name; } QString Addressee::nameLabel() { return i18n("Name"); } void Addressee::setFormattedName( const QString &formattedName ) { if ( formattedName == mData->formattedName ) return; detach(); mData->empty = false; mData->formattedName = formattedName; } +void Addressee::setDefaultFormattedName( const QString &formattedName ) +{ + if ( formattedName == mData->defaultFormattedName ) return; + detach(); + mData->empty = false; + mData->defaultFormattedName = formattedName; +} QString Addressee::formattedName() const { return mData->formattedName; } +QString Addressee::defaultFormattedName() const +{ + return mData->defaultFormattedName; +} QString Addressee::formattedNameLabel() { return i18n("Formatted Name"); } +QString Addressee::defaultFormattedNameLabel() +{ + return i18n("Def.Formatted Name"); +} + void Addressee::setFamilyName( const QString &familyName ) { if ( familyName == mData->familyName ) return; detach(); mData->empty = false; mData->familyName = familyName; } QString Addressee::familyName() const { return mData->familyName; } QString Addressee::familyNameLabel() { @@ -967,32 +984,40 @@ QString Addressee::businessAddressLabelLabel() QString Addressee::homePhoneLabel() { return i18n("Home Phone"); } QString Addressee::businessPhoneLabel() { return i18n("Business Phone"); } QString Addressee::mobilePhoneLabel() { return i18n("Mobile Phone"); } +QString Addressee::mobileWorkPhoneLabel() +{ + return i18n("Mobile (work)"); +} +QString Addressee::mobileHomePhoneLabel() +{ + return i18n("Mobile (home)"); +} QString Addressee::homeFaxLabel() { return i18n("Home Fax"); } QString Addressee::businessFaxLabel() { return i18n("Business Fax"); } QString Addressee::carPhoneLabel() { diff --git a/kabc/addressee.h b/kabc/addressee.h index 8051fec..0d688f8 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h @@ -141,40 +141,43 @@ class Addressee Set name. */ void setName( const QString &name ); /** Return name. */ QString name() const; /** Return translated label for name field. */ static QString nameLabel(); /** Set formatted name. */ void setFormattedName( const QString &formattedName ); + void setDefaultFormattedName( const QString &formattedName ); /** Return formatted name. */ QString formattedName() const; + QString defaultFormattedName() const; /** Return translated label for formattedName field. */ static QString formattedNameLabel(); + static QString defaultFormattedNameLabel(); /** Set family name. */ void setFamilyName( const QString &familyName ); /** Return family name. */ QString familyName() const; /** Return translated label for familyName field. */ static QString familyNameLabel(); /** Set given name. @@ -315,32 +318,34 @@ class Addressee 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(); diff --git a/kabc/field.cpp b/kabc/field.cpp index 89d0b77..5c561c3 100644 --- a/kabc/field.cpp +++ b/kabc/field.cpp @@ -73,33 +73,36 @@ class Field::FieldImpl HomePhone, BusinessPhone, MobilePhone, HomeFax, BusinessFax, CarPhone, Isdn, Pager, Email, Mailer, Title, Role, Organization, Note, Url, Resource, - Sip + Sip, + DefaultFormattedName, + MobileWorkPhone, + MobileHomePhone }; 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; @@ -113,32 +116,34 @@ 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::DefaultFormattedName: + return Addressee::defaultFormattedNameLabel(); 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: return Addressee::suffixLabel(); case FieldImpl::NickName: return Addressee::nickNameLabel(); case FieldImpl::Birthday: return Addressee::birthdayLabel(); case FieldImpl::HomeAddressStreet: return Addressee::homeAddressStreetLabel(); @@ -157,32 +162,36 @@ QString Field::label() case FieldImpl::BusinessAddressLocality: return Addressee::businessAddressLocalityLabel(); 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(); @@ -226,32 +235,34 @@ QString Field::categoryLabel( int category ) 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::DefaultFormattedName: + return a.defaultFormattedName(); 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: return a.suffix(); case FieldImpl::NickName: return a.nickName(); case FieldImpl::Mailer: return a.mailer(); case FieldImpl::Title: return a.title(); @@ -275,32 +286,36 @@ QString Field::value( const KABC::Addressee &a ) } 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 ).number(); case FieldImpl::BusinessPhone: return a.phoneNumber( PhoneNumber::Work ).number(); case FieldImpl::MobilePhone: return a.phoneNumber( PhoneNumber::Cell ).number(); + case FieldImpl::MobileWorkPhone: + return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Work ).number(); + case FieldImpl::MobileHomePhone: + return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Home ).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(); @@ -380,55 +395,58 @@ bool Field::setValue( KABC::Addressee &a, const QString &value ) //US never copy the resourcename back to the adressee. case FieldImpl::Resource: default: return false; } } bool Field::isCustom() { return mImpl->fieldId() == FieldImpl::CustomField; } Field::List Field::allFields() { if ( mAllFields.isEmpty() ) { createField( FieldImpl::FormattedName, Frequent ); + createField( FieldImpl::DefaultFormattedName, 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 ); } diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 041effc..4c6231d 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp @@ -164,41 +164,40 @@ PhoneNumber::TypeList PhoneNumber::typeList() list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video << 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") +" "; + if ((type & Home) == Home) + typeString += i18n("Home")+" "; + else if ((type & Work) == Work) + typeString += i18n("Work")+" "; + if ((type & Sip) == Sip) typeString += i18n("SIP")+" "; if ((type & Car) == Car) typeString += i18n("Car")+" "; if ((type & Fax) == Fax) typeString += i18n("Fax"); else if ((type & Msg) == Msg) typeString += i18n("Messenger"); 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 & Isdn) == Isdn) |