author | zautrix <zautrix> | 2005-04-07 07:42:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-07 07:42:53 (UTC) |
commit | c82f9b40f6023dc7b39ac555cba8c4c313f15ca8 (patch) (unidiff) | |
tree | e9e4f0c0ed3243ec060a475983b271bd27b40d15 /kabc | |
parent | 76e220bf1236ae6afa9d91f18f0cd9ced730cff0 (diff) | |
download | kdepimpi-c82f9b40f6023dc7b39ac555cba8c4c313f15ca8.zip kdepimpi-c82f9b40f6023dc7b39ac555cba8c4c313f15ca8.tar.gz kdepimpi-c82f9b40f6023dc7b39ac555cba8c4c313f15ca8.tar.bz2 |
added fields to kapi
-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 | 13 |
4 files changed, 55 insertions, 8 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 39d14bb..7f592e9 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -50,8 +50,9 @@ struct Addressee::AddresseeData : public KShared | |||
50 | { | 50 | { |
51 | QString uid; | 51 | QString uid; |
52 | QString name; | 52 | QString name; |
53 | QString formattedName; | 53 | QString formattedName; |
54 | QString defaultFormattedName; | ||
54 | QString familyName; | 55 | QString familyName; |
55 | QString givenName; | 56 | QString givenName; |
56 | QString additionalName; | 57 | QString additionalName; |
57 | QString prefix; | 58 | QString prefix; |
@@ -746,19 +747,35 @@ void Addressee::setFormattedName( const QString &formattedName ) | |||
746 | detach(); | 747 | detach(); |
747 | mData->empty = false; | 748 | mData->empty = false; |
748 | mData->formattedName = formattedName; | 749 | mData->formattedName = formattedName; |
749 | } | 750 | } |
751 | void Addressee::setDefaultFormattedName( const QString &formattedName ) | ||
752 | { | ||
753 | if ( formattedName == mData->defaultFormattedName ) return; | ||
754 | detach(); | ||
755 | mData->empty = false; | ||
756 | mData->defaultFormattedName = formattedName; | ||
757 | } | ||
750 | 758 | ||
751 | QString Addressee::formattedName() const | 759 | QString Addressee::formattedName() const |
752 | { | 760 | { |
753 | return mData->formattedName; | 761 | return mData->formattedName; |
754 | } | 762 | } |
763 | QString Addressee::defaultFormattedName() const | ||
764 | { | ||
765 | return mData->defaultFormattedName; | ||
766 | } | ||
755 | 767 | ||
756 | QString Addressee::formattedNameLabel() | 768 | QString Addressee::formattedNameLabel() |
757 | { | 769 | { |
758 | return i18n("Formatted Name"); | 770 | return i18n("Formatted Name"); |
759 | } | 771 | } |
760 | 772 | ||
773 | QString Addressee::defaultFormattedNameLabel() | ||
774 | { | ||
775 | return i18n("Def.Formatted Name"); | ||
776 | } | ||
777 | |||
761 | 778 | ||
762 | void Addressee::setFamilyName( const QString &familyName ) | 779 | void Addressee::setFamilyName( const QString &familyName ) |
763 | { | 780 | { |
764 | if ( familyName == mData->familyName ) return; | 781 | if ( familyName == mData->familyName ) return; |
@@ -979,8 +996,16 @@ QString Addressee::businessPhoneLabel() | |||
979 | QString Addressee::mobilePhoneLabel() | 996 | QString Addressee::mobilePhoneLabel() |
980 | { | 997 | { |
981 | return i18n("Mobile Phone"); | 998 | return i18n("Mobile Phone"); |
982 | } | 999 | } |
1000 | QString Addressee::mobileWorkPhoneLabel() | ||
1001 | { | ||
1002 | return i18n("Mobile (work)"); | ||
1003 | } | ||
1004 | QString Addressee::mobileHomePhoneLabel() | ||
1005 | { | ||
1006 | return i18n("Mobile (home)"); | ||
1007 | } | ||
983 | 1008 | ||
984 | 1009 | ||
985 | QString Addressee::homeFaxLabel() | 1010 | QString Addressee::homeFaxLabel() |
986 | { | 1011 | { |
diff --git a/kabc/addressee.h b/kabc/addressee.h index 8051fec..0d688f8 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h | |||
@@ -153,16 +153,19 @@ class Addressee | |||
153 | /** | 153 | /** |
154 | Set formatted name. | 154 | Set formatted name. |
155 | */ | 155 | */ |
156 | void setFormattedName( const QString &formattedName ); | 156 | void setFormattedName( const QString &formattedName ); |
157 | void setDefaultFormattedName( const QString &formattedName ); | ||
157 | /** | 158 | /** |
158 | Return formatted name. | 159 | Return formatted name. |
159 | */ | 160 | */ |
160 | QString formattedName() const; | 161 | QString formattedName() const; |
162 | QString defaultFormattedName() const; | ||
161 | /** | 163 | /** |
162 | Return translated label for formattedName field. | 164 | Return translated label for formattedName field. |
163 | */ | 165 | */ |
164 | static QString formattedNameLabel(); | 166 | static QString formattedNameLabel(); |
167 | static QString defaultFormattedNameLabel(); | ||
165 | 168 | ||
166 | /** | 169 | /** |
167 | Set family name. | 170 | Set family name. |
168 | */ | 171 | */ |
@@ -327,8 +330,10 @@ class Addressee | |||
327 | /** | 330 | /** |
328 | Return translated label for mobilePhone field. | 331 | Return translated label for mobilePhone field. |
329 | */ | 332 | */ |
330 | static QString mobilePhoneLabel(); | 333 | static QString mobilePhoneLabel(); |
334 | static QString mobileWorkPhoneLabel(); | ||
335 | static QString mobileHomePhoneLabel(); | ||
331 | 336 | ||
332 | /** | 337 | /** |
333 | Return translated label for homeFax field. | 338 | Return translated label for homeFax field. |
334 | */ | 339 | */ |
diff --git a/kabc/field.cpp b/kabc/field.cpp index 89d0b77..5c561c3 100644 --- a/kabc/field.cpp +++ b/kabc/field.cpp | |||
@@ -85,9 +85,12 @@ class Field::FieldImpl | |||
85 | Organization, | 85 | Organization, |
86 | Note, | 86 | Note, |
87 | Url, | 87 | Url, |
88 | Resource, | 88 | Resource, |
89 | Sip | 89 | Sip, |
90 | DefaultFormattedName, | ||
91 | MobileWorkPhone, | ||
92 | MobileHomePhone | ||
90 | }; | 93 | }; |
91 | 94 | ||
92 | int fieldId() { return mFieldId; } | 95 | int fieldId() { return mFieldId; } |
93 | int category() { return mCategory; } | 96 | int category() { return mCategory; } |
@@ -125,8 +128,10 @@ QString Field::label() | |||
125 | { | 128 | { |
126 | switch ( mImpl->fieldId() ) { | 129 | switch ( mImpl->fieldId() ) { |
127 | case FieldImpl::FormattedName: | 130 | case FieldImpl::FormattedName: |
128 | return Addressee::formattedNameLabel(); | 131 | return Addressee::formattedNameLabel(); |
132 | case FieldImpl::DefaultFormattedName: | ||
133 | return Addressee::defaultFormattedNameLabel(); | ||
129 | case FieldImpl::FamilyName: | 134 | case FieldImpl::FamilyName: |
130 | return Addressee::familyNameLabel(); | 135 | return Addressee::familyNameLabel(); |
131 | case FieldImpl::GivenName: | 136 | case FieldImpl::GivenName: |
132 | return Addressee::givenNameLabel(); | 137 | return Addressee::givenNameLabel(); |
@@ -169,8 +174,12 @@ QString Field::label() | |||
169 | case FieldImpl::BusinessPhone: | 174 | case FieldImpl::BusinessPhone: |
170 | return Addressee::businessPhoneLabel(); | 175 | return Addressee::businessPhoneLabel(); |
171 | case FieldImpl::MobilePhone: | 176 | case FieldImpl::MobilePhone: |
172 | return Addressee::mobilePhoneLabel(); | 177 | return Addressee::mobilePhoneLabel(); |
178 | case FieldImpl::MobileHomePhone: | ||
179 | return Addressee::mobileHomePhoneLabel(); | ||
180 | case FieldImpl::MobileWorkPhone: | ||
181 | return Addressee::mobileWorkPhoneLabel(); | ||
173 | case FieldImpl::HomeFax: | 182 | case FieldImpl::HomeFax: |
174 | return Addressee::homeFaxLabel(); | 183 | return Addressee::homeFaxLabel(); |
175 | case FieldImpl::BusinessFax: | 184 | case FieldImpl::BusinessFax: |
176 | return Addressee::businessFaxLabel(); | 185 | return Addressee::businessFaxLabel(); |
@@ -238,8 +247,10 @@ QString Field::value( const KABC::Addressee &a ) | |||
238 | { | 247 | { |
239 | switch ( mImpl->fieldId() ) { | 248 | switch ( mImpl->fieldId() ) { |
240 | case FieldImpl::FormattedName: | 249 | case FieldImpl::FormattedName: |
241 | return a.formattedName(); | 250 | return a.formattedName(); |
251 | case FieldImpl::DefaultFormattedName: | ||
252 | return a.defaultFormattedName(); | ||
242 | case FieldImpl::FamilyName: | 253 | case FieldImpl::FamilyName: |
243 | return a.familyName(); | 254 | return a.familyName(); |
244 | case FieldImpl::GivenName: | 255 | case FieldImpl::GivenName: |
245 | return a.givenName(); | 256 | return a.givenName(); |
@@ -287,8 +298,12 @@ QString Field::value( const KABC::Addressee &a ) | |||
287 | case FieldImpl::BusinessPhone: | 298 | case FieldImpl::BusinessPhone: |
288 | return a.phoneNumber( PhoneNumber::Work ).number(); | 299 | return a.phoneNumber( PhoneNumber::Work ).number(); |
289 | case FieldImpl::MobilePhone: | 300 | case FieldImpl::MobilePhone: |
290 | return a.phoneNumber( PhoneNumber::Cell ).number(); | 301 | return a.phoneNumber( PhoneNumber::Cell ).number(); |
302 | case FieldImpl::MobileWorkPhone: | ||
303 | return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Work ).number(); | ||
304 | case FieldImpl::MobileHomePhone: | ||
305 | return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Home ).number(); | ||
291 | case FieldImpl::HomeFax: | 306 | case FieldImpl::HomeFax: |
292 | return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); | 307 | return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); |
293 | case FieldImpl::BusinessFax: | 308 | case FieldImpl::BusinessFax: |
294 | return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); | 309 | return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); |
@@ -392,8 +407,9 @@ bool Field::isCustom() | |||
392 | Field::List Field::allFields() | 407 | Field::List Field::allFields() |
393 | { | 408 | { |
394 | if ( mAllFields.isEmpty() ) { | 409 | if ( mAllFields.isEmpty() ) { |
395 | createField( FieldImpl::FormattedName, Frequent ); | 410 | createField( FieldImpl::FormattedName, Frequent ); |
411 | createField( FieldImpl::DefaultFormattedName, Frequent ); | ||
396 | createField( FieldImpl::FamilyName, Frequent ); | 412 | createField( FieldImpl::FamilyName, Frequent ); |
397 | createField( FieldImpl::GivenName, Frequent ); | 413 | createField( FieldImpl::GivenName, Frequent ); |
398 | createField( FieldImpl::AdditionalName ); | 414 | createField( FieldImpl::AdditionalName ); |
399 | createField( FieldImpl::Prefix ); | 415 | createField( FieldImpl::Prefix ); |
@@ -415,8 +431,10 @@ Field::List Field::allFields() | |||
415 | createField( FieldImpl::BusinessAddressLabel, Address|Organization ); | 431 | createField( FieldImpl::BusinessAddressLabel, Address|Organization ); |
416 | createField( FieldImpl::HomePhone, Personal|Frequent ); | 432 | createField( FieldImpl::HomePhone, Personal|Frequent ); |
417 | createField( FieldImpl::BusinessPhone, Organization|Frequent ); | 433 | createField( FieldImpl::BusinessPhone, Organization|Frequent ); |
418 | createField( FieldImpl::MobilePhone, Frequent ); | 434 | createField( FieldImpl::MobilePhone, Frequent ); |
435 | createField( FieldImpl::MobileHomePhone, Frequent ); | ||
436 | createField( FieldImpl::MobileWorkPhone, Frequent ); | ||
419 | createField( FieldImpl::HomeFax ); | 437 | createField( FieldImpl::HomeFax ); |
420 | createField( FieldImpl::BusinessFax ); | 438 | createField( FieldImpl::BusinessFax ); |
421 | createField( FieldImpl::CarPhone ); | 439 | createField( FieldImpl::CarPhone ); |
422 | createField( FieldImpl::Isdn ); | 440 | createField( FieldImpl::Isdn ); |
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 041effc..4c6231d 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp | |||
@@ -176,18 +176,17 @@ QString PhoneNumber::label( int type ) | |||
176 | QString PhoneNumber::typeLabel( int type ) | 176 | QString PhoneNumber::typeLabel( int type ) |
177 | { | 177 | { |
178 | QString typeString; | 178 | QString typeString; |
179 | 179 | ||
180 | |||
181 | if ((type & Cell) == Cell) | ||
182 | typeString += i18n("Mobile") +" "; | ||
180 | if ((type & Home) == Home) | 183 | if ((type & Home) == Home) |
181 | typeString += i18n("Home"); | 184 | typeString += i18n("Home")+" "; |
182 | else if ((type & Work) == Work) | 185 | else if ((type & Work) == Work) |
183 | typeString += i18n("Work"); | 186 | typeString += i18n("Work")+" "; |
184 | 187 | ||
185 | if (!typeString.isEmpty()) | 188 | if ((type & Sip) == Sip) |
186 | typeString += " "; | ||
187 | if ((type & Cell) == Cell) | ||
188 | typeString += i18n("Mobile") +" "; | ||
189 | if ((type & Sip) == Sip) | ||
190 | typeString += i18n("SIP")+" "; | 189 | typeString += i18n("SIP")+" "; |
191 | if ((type & Car) == Car) | 190 | if ((type & Car) == Car) |
192 | typeString += i18n("Car")+" "; | 191 | typeString += i18n("Car")+" "; |
193 | 192 | ||