summaryrefslogtreecommitdiffabout
path: root/kabc/field.cpp
Unidiff
Diffstat (limited to 'kabc/field.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/field.cpp6
1 files changed, 0 insertions, 6 deletions
diff --git a/kabc/field.cpp b/kabc/field.cpp
index 5c561c3..fd51026 100644
--- a/kabc/field.cpp
+++ b/kabc/field.cpp
@@ -66,92 +66,89 @@ class Field::FieldImpl
66 HomeAddressLabel, 66 HomeAddressLabel,
67 BusinessAddressStreet, 67 BusinessAddressStreet,
68 BusinessAddressLocality, 68 BusinessAddressLocality,
69 BusinessAddressRegion, 69 BusinessAddressRegion,
70 BusinessAddressPostalCode, 70 BusinessAddressPostalCode,
71 BusinessAddressCountry, 71 BusinessAddressCountry,
72 BusinessAddressLabel, 72 BusinessAddressLabel,
73 HomePhone, 73 HomePhone,
74 BusinessPhone, 74 BusinessPhone,
75 MobilePhone, 75 MobilePhone,
76 HomeFax, 76 HomeFax,
77 BusinessFax, 77 BusinessFax,
78 CarPhone, 78 CarPhone,
79 Isdn, 79 Isdn,
80 Pager, 80 Pager,
81 Email, 81 Email,
82 Mailer, 82 Mailer,
83 Title, 83 Title,
84 Role, 84 Role,
85 Organization, 85 Organization,
86 Note, 86 Note,
87 Url, 87 Url,
88 Resource, 88 Resource,
89 Sip, 89 Sip,
90 DefaultFormattedName,
91 MobileWorkPhone, 90 MobileWorkPhone,
92 MobileHomePhone 91 MobileHomePhone
93 }; 92 };
94 93
95 int fieldId() { return mFieldId; } 94 int fieldId() { return mFieldId; }
96 int category() { return mCategory; } 95 int category() { return mCategory; }
97 96
98 QString label() { return mLabel; } 97 QString label() { return mLabel; }
99 QString key() { return mKey; } 98 QString key() { return mKey; }
100 QString app() { return mApp; } 99 QString app() { return mApp; }
101 100
102 private: 101 private:
103 int mFieldId; 102 int mFieldId;
104 int mCategory; 103 int mCategory;
105 104
106 QString mLabel; 105 QString mLabel;
107 QString mKey; 106 QString mKey;
108 QString mApp; 107 QString mApp;
109}; 108};
110 109
111 110
112Field::List Field::mAllFields; 111Field::List Field::mAllFields;
113Field::List Field::mDefaultFields; 112Field::List Field::mDefaultFields;
114Field::List Field::mCustomFields; 113Field::List Field::mCustomFields;
115 114
116 115
117Field::Field( FieldImpl *impl ) 116Field::Field( FieldImpl *impl )
118{ 117{
119 mImpl = impl; 118 mImpl = impl;
120} 119}
121 120
122Field::~Field() 121Field::~Field()
123{ 122{
124 delete mImpl; 123 delete mImpl;
125} 124}
126 125
127QString Field::label() 126QString Field::label()
128{ 127{
129 switch ( mImpl->fieldId() ) { 128 switch ( mImpl->fieldId() ) {
130 case FieldImpl::FormattedName: 129 case FieldImpl::FormattedName:
131 return Addressee::formattedNameLabel(); 130 return Addressee::formattedNameLabel();
132 case FieldImpl::DefaultFormattedName:
133 return Addressee::defaultFormattedNameLabel();
134 case FieldImpl::FamilyName: 131 case FieldImpl::FamilyName:
135 return Addressee::familyNameLabel(); 132 return Addressee::familyNameLabel();
136 case FieldImpl::GivenName: 133 case FieldImpl::GivenName:
137 return Addressee::givenNameLabel(); 134 return Addressee::givenNameLabel();
138 case FieldImpl::AdditionalName: 135 case FieldImpl::AdditionalName:
139 return Addressee::additionalNameLabel(); 136 return Addressee::additionalNameLabel();
140 case FieldImpl::Prefix: 137 case FieldImpl::Prefix:
141 return Addressee::prefixLabel(); 138 return Addressee::prefixLabel();
142 case FieldImpl::Suffix: 139 case FieldImpl::Suffix:
143 return Addressee::suffixLabel(); 140 return Addressee::suffixLabel();
144 case FieldImpl::NickName: 141 case FieldImpl::NickName:
145 return Addressee::nickNameLabel(); 142 return Addressee::nickNameLabel();
146 case FieldImpl::Birthday: 143 case FieldImpl::Birthday:
147 return Addressee::birthdayLabel(); 144 return Addressee::birthdayLabel();
148 case FieldImpl::HomeAddressStreet: 145 case FieldImpl::HomeAddressStreet:
149 return Addressee::homeAddressStreetLabel(); 146 return Addressee::homeAddressStreetLabel();
150 case FieldImpl::HomeAddressLocality: 147 case FieldImpl::HomeAddressLocality:
151 return Addressee::homeAddressLocalityLabel(); 148 return Addressee::homeAddressLocalityLabel();
152 case FieldImpl::HomeAddressRegion: 149 case FieldImpl::HomeAddressRegion:
153 return Addressee::homeAddressRegionLabel(); 150 return Addressee::homeAddressRegionLabel();
154 case FieldImpl::HomeAddressPostalCode: 151 case FieldImpl::HomeAddressPostalCode:
155 return Addressee::homeAddressPostalCodeLabel(); 152 return Addressee::homeAddressPostalCodeLabel();
156 case FieldImpl::HomeAddressCountry: 153 case FieldImpl::HomeAddressCountry:
157 return Addressee::homeAddressCountryLabel(); 154 return Addressee::homeAddressCountryLabel();
@@ -227,50 +224,48 @@ QString Field::categoryLabel( int category )
227 case All: 224 case All:
228 return i18n("All"); 225 return i18n("All");
229 case Frequent: 226 case Frequent:
230 return i18n("Frequent"); 227 return i18n("Frequent");
231 case Address: 228 case Address:
232 return i18n("Address"); 229 return i18n("Address");
233 case Email: 230 case Email:
234 return i18n("Email"); 231 return i18n("Email");
235 case Personal: 232 case Personal:
236 return i18n("Personal"); 233 return i18n("Personal");
237 case Organization: 234 case Organization:
238 return i18n("Organization"); 235 return i18n("Organization");
239 case CustomCategory: 236 case CustomCategory:
240 return i18n("Custom"); 237 return i18n("Custom");
241 default: 238 default:
242 return i18n("Undefined"); 239 return i18n("Undefined");
243 } 240 }
244} 241}
245 242
246QString Field::value( const KABC::Addressee &a ) 243QString Field::value( const KABC::Addressee &a )
247{ 244{
248 switch ( mImpl->fieldId() ) { 245 switch ( mImpl->fieldId() ) {
249 case FieldImpl::FormattedName: 246 case FieldImpl::FormattedName:
250 return a.formattedName(); 247 return a.formattedName();
251 case FieldImpl::DefaultFormattedName:
252 return a.defaultFormattedName();
253 case FieldImpl::FamilyName: 248 case FieldImpl::FamilyName:
254 return a.familyName(); 249 return a.familyName();
255 case FieldImpl::GivenName: 250 case FieldImpl::GivenName:
256 return a.givenName(); 251 return a.givenName();
257 case FieldImpl::AdditionalName: 252 case FieldImpl::AdditionalName:
258 return a.additionalName(); 253 return a.additionalName();
259 case FieldImpl::Prefix: 254 case FieldImpl::Prefix:
260 return a.prefix(); 255 return a.prefix();
261 case FieldImpl::Suffix: 256 case FieldImpl::Suffix:
262 return a.suffix(); 257 return a.suffix();
263 case FieldImpl::NickName: 258 case FieldImpl::NickName:
264 return a.nickName(); 259 return a.nickName();
265 case FieldImpl::Mailer: 260 case FieldImpl::Mailer:
266 return a.mailer(); 261 return a.mailer();
267 case FieldImpl::Title: 262 case FieldImpl::Title:
268 return a.title(); 263 return a.title();
269 case FieldImpl::Role: 264 case FieldImpl::Role:
270 return a.role(); 265 return a.role();
271 case FieldImpl::Organization: 266 case FieldImpl::Organization:
272 return a.organization(); 267 return a.organization();
273 case FieldImpl::Note: 268 case FieldImpl::Note:
274 return a.note(); 269 return a.note();
275 case FieldImpl::Email: 270 case FieldImpl::Email:
276 return a.preferredEmail(); 271 return a.preferredEmail();
@@ -387,49 +382,48 @@ bool Field::setValue( KABC::Addressee &a, const QString &value )
387// But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? 382// But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ?
388 { 383 {
389 QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate 384 QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate
390 a.setBirthday(dt); 385 a.setBirthday(dt);
391 } 386 }
392 return true; 387 return true;
393 case FieldImpl::CustomField: 388 case FieldImpl::CustomField:
394 a.insertCustom( mImpl->app(), mImpl->key(), value ); 389 a.insertCustom( mImpl->app(), mImpl->key(), value );
395//US never copy the resourcename back to the adressee. 390//US never copy the resourcename back to the adressee.
396 case FieldImpl::Resource: 391 case FieldImpl::Resource:
397 default: 392 default:
398 return false; 393 return false;
399 } 394 }
400} 395}
401 396
402bool Field::isCustom() 397bool Field::isCustom()
403{ 398{
404 return mImpl->fieldId() == FieldImpl::CustomField; 399 return mImpl->fieldId() == FieldImpl::CustomField;
405} 400}
406 401
407Field::List Field::allFields() 402Field::List Field::allFields()
408{ 403{
409 if ( mAllFields.isEmpty() ) { 404 if ( mAllFields.isEmpty() ) {
410 createField( FieldImpl::FormattedName, Frequent ); 405 createField( FieldImpl::FormattedName, Frequent );
411 createField( FieldImpl::DefaultFormattedName, Frequent );
412 createField( FieldImpl::FamilyName, Frequent ); 406 createField( FieldImpl::FamilyName, Frequent );
413 createField( FieldImpl::GivenName, Frequent ); 407 createField( FieldImpl::GivenName, Frequent );
414 createField( FieldImpl::AdditionalName ); 408 createField( FieldImpl::AdditionalName );
415 createField( FieldImpl::Prefix ); 409 createField( FieldImpl::Prefix );
416 createField( FieldImpl::Suffix ); 410 createField( FieldImpl::Suffix );
417 createField( FieldImpl::NickName, Personal ); 411 createField( FieldImpl::NickName, Personal );
418 createField( FieldImpl::Birthday, Personal ); 412 createField( FieldImpl::Birthday, Personal );
419 createField( FieldImpl::Category ); 413 createField( FieldImpl::Category );
420 createField( FieldImpl::HomeAddressStreet, Address|Personal ); 414 createField( FieldImpl::HomeAddressStreet, Address|Personal );
421 createField( FieldImpl::HomeAddressLocality, Address|Personal ); 415 createField( FieldImpl::HomeAddressLocality, Address|Personal );
422 createField( FieldImpl::HomeAddressRegion, Address|Personal ); 416 createField( FieldImpl::HomeAddressRegion, Address|Personal );
423 createField( FieldImpl::HomeAddressPostalCode, Address|Personal ); 417 createField( FieldImpl::HomeAddressPostalCode, Address|Personal );
424 createField( FieldImpl::HomeAddressCountry, Address|Personal ); 418 createField( FieldImpl::HomeAddressCountry, Address|Personal );
425 createField( FieldImpl::HomeAddressLabel, Address|Personal ); 419 createField( FieldImpl::HomeAddressLabel, Address|Personal );
426 createField( FieldImpl::BusinessAddressStreet, Address|Organization ); 420 createField( FieldImpl::BusinessAddressStreet, Address|Organization );
427 createField( FieldImpl::BusinessAddressLocality, Address|Organization ); 421 createField( FieldImpl::BusinessAddressLocality, Address|Organization );
428 createField( FieldImpl::BusinessAddressRegion, Address|Organization ); 422 createField( FieldImpl::BusinessAddressRegion, Address|Organization );
429 createField( FieldImpl::BusinessAddressPostalCode, Address|Organization ); 423 createField( FieldImpl::BusinessAddressPostalCode, Address|Organization );
430 createField( FieldImpl::BusinessAddressCountry, Address|Organization ); 424 createField( FieldImpl::BusinessAddressCountry, Address|Organization );
431 createField( FieldImpl::BusinessAddressLabel, Address|Organization ); 425 createField( FieldImpl::BusinessAddressLabel, Address|Organization );
432 createField( FieldImpl::HomePhone, Personal|Frequent ); 426 createField( FieldImpl::HomePhone, Personal|Frequent );
433 createField( FieldImpl::BusinessPhone, Organization|Frequent ); 427 createField( FieldImpl::BusinessPhone, Organization|Frequent );
434 createField( FieldImpl::MobilePhone, Frequent ); 428 createField( FieldImpl::MobilePhone, Frequent );
435 createField( FieldImpl::MobileHomePhone, Frequent ); 429 createField( FieldImpl::MobileHomePhone, Frequent );