summaryrefslogtreecommitdiffabout
path: root/kabc
Unidiff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp17
-rw-r--r--kabc/addressee.h3
-rw-r--r--kabc/field.cpp6
3 files changed, 0 insertions, 26 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 7f592e9..155ce24 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -30,49 +30,48 @@ $Id$
30 30
31#include <ksharedptr.h> 31#include <ksharedptr.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <kapplication.h> 33#include <kapplication.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kidmanager.h> 35#include <kidmanager.h>
36//US 36//US
37#include <kstandarddirs.h> 37#include <kstandarddirs.h>
38#include <libkcal/syncdefines.h> 38#include <libkcal/syncdefines.h>
39 39
40//US #include "resource.h" 40//US #include "resource.h"
41#include "addressee.h" 41#include "addressee.h"
42 42
43using namespace KABC; 43using namespace KABC;
44 44
45static bool matchBinaryPattern( int value, int pattern ); 45static bool matchBinaryPattern( int value, int pattern );
46static bool matchBinaryPatternA( int value, int pattern ); 46static bool matchBinaryPatternA( int value, int pattern );
47static bool matchBinaryPatternP( int value, int pattern ); 47static bool matchBinaryPatternP( int value, int pattern );
48 48
49struct Addressee::AddresseeData : public KShared 49struct 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;
55 QString familyName; 54 QString familyName;
56 QString givenName; 55 QString givenName;
57 QString additionalName; 56 QString additionalName;
58 QString prefix; 57 QString prefix;
59 QString suffix; 58 QString suffix;
60 QString nickName; 59 QString nickName;
61 QDateTime birthday; 60 QDateTime birthday;
62 QString mailer; 61 QString mailer;
63 TimeZone timeZone; 62 TimeZone timeZone;
64 Geo geo; 63 Geo geo;
65 QString title; 64 QString title;
66 QString role; 65 QString role;
67 QString organization; 66 QString organization;
68 QString note; 67 QString note;
69 QString productId; 68 QString productId;
70 QDateTime revision; 69 QDateTime revision;
71 QString sortString; 70 QString sortString;
72 QString externalUID; 71 QString externalUID;
73 QString originalExternalUID; 72 QString originalExternalUID;
74 KURL url; 73 KURL url;
75 Secrecy secrecy; 74 Secrecy secrecy;
76 Picture logo; 75 Picture logo;
77 Picture photo; 76 Picture photo;
78 Sound sound; 77 Sound sound;
@@ -727,75 +726,59 @@ void Addressee::setName( const QString &name )
727 if ( name == mData->name ) return; 726 if ( name == mData->name ) return;
728 detach(); 727 detach();
729 mData->empty = false; 728 mData->empty = false;
730 mData->name = name; 729 mData->name = name;
731} 730}
732 731
733QString Addressee::name() const 732QString Addressee::name() const
734{ 733{
735 return mData->name; 734 return mData->name;
736} 735}
737 736
738QString Addressee::nameLabel() 737QString Addressee::nameLabel()
739{ 738{
740 return i18n("Name"); 739 return i18n("Name");
741} 740}
742 741
743 742
744void Addressee::setFormattedName( const QString &formattedName ) 743void Addressee::setFormattedName( const QString &formattedName )
745{ 744{
746 if ( formattedName == mData->formattedName ) return; 745 if ( formattedName == mData->formattedName ) return;
747 detach(); 746 detach();
748 mData->empty = false; 747 mData->empty = false;
749 mData->formattedName = formattedName; 748 mData->formattedName = formattedName;
750} 749}
751void Addressee::setDefaultFormattedName( const QString &formattedName )
752{
753 if ( formattedName == mData->defaultFormattedName ) return;
754 detach();
755 mData->empty = false;
756 mData->defaultFormattedName = formattedName;
757}
758 750
759QString Addressee::formattedName() const 751QString Addressee::formattedName() const
760{ 752{
761 return mData->formattedName; 753 return mData->formattedName;
762} 754}
763QString Addressee::defaultFormattedName() const
764{
765 return mData->defaultFormattedName;
766}
767 755
768QString Addressee::formattedNameLabel() 756QString Addressee::formattedNameLabel()
769{ 757{
770 return i18n("Formatted Name"); 758 return i18n("Formatted Name");
771} 759}
772 760
773QString Addressee::defaultFormattedNameLabel()
774{
775 return i18n("Def.Formatted Name");
776}
777
778 761
779void Addressee::setFamilyName( const QString &familyName ) 762void Addressee::setFamilyName( const QString &familyName )
780{ 763{
781 if ( familyName == mData->familyName ) return; 764 if ( familyName == mData->familyName ) return;
782 detach(); 765 detach();
783 mData->empty = false; 766 mData->empty = false;
784 mData->familyName = familyName; 767 mData->familyName = familyName;
785} 768}
786 769
787QString Addressee::familyName() const 770QString Addressee::familyName() const
788{ 771{
789 return mData->familyName; 772 return mData->familyName;
790} 773}
791 774
792QString Addressee::familyNameLabel() 775QString Addressee::familyNameLabel()
793{ 776{
794 return i18n("Family Name"); 777 return i18n("Family Name");
795} 778}
796 779
797 780
798void Addressee::setGivenName( const QString &givenName ) 781void Addressee::setGivenName( const QString &givenName )
799{ 782{
800 if ( givenName == mData->givenName ) return; 783 if ( givenName == mData->givenName ) return;
801 detach(); 784 detach();
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 0d688f8..a2fbcf5 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -133,59 +133,56 @@ class Addressee
133 */ 133 */
134 const QString uid() const; 134 const QString uid() const;
135 /** 135 /**
136 Return translated label for uid field. 136 Return translated label for uid field.
137 */ 137 */
138 static QString uidLabel(); 138 static QString uidLabel();
139 139
140 /** 140 /**
141 Set name. 141 Set name.
142 */ 142 */
143 void setName( const QString &name ); 143 void setName( const QString &name );
144 /** 144 /**
145 Return name. 145 Return name.
146 */ 146 */
147 QString name() const; 147 QString name() const;
148 /** 148 /**
149 Return translated label for name field. 149 Return translated label for name field.
150 */ 150 */
151 static QString nameLabel(); 151 static QString nameLabel();
152 152
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 );
158 /** 157 /**
159 Return formatted name. 158 Return formatted name.
160 */ 159 */
161 QString formattedName() const; 160 QString formattedName() const;
162 QString defaultFormattedName() const;
163 /** 161 /**
164 Return translated label for formattedName field. 162 Return translated label for formattedName field.
165 */ 163 */
166 static QString formattedNameLabel(); 164 static QString formattedNameLabel();
167 static QString defaultFormattedNameLabel();
168 165
169 /** 166 /**
170 Set family name. 167 Set family name.
171 */ 168 */
172 void setFamilyName( const QString &familyName ); 169 void setFamilyName( const QString &familyName );
173 /** 170 /**
174 Return family name. 171 Return family name.
175 */ 172 */
176 QString familyName() const; 173 QString familyName() const;
177 /** 174 /**
178 Return translated label for familyName field. 175 Return translated label for familyName field.
179 */ 176 */
180 static QString familyNameLabel(); 177 static QString familyNameLabel();
181 178
182 /** 179 /**
183 Set given name. 180 Set given name.
184 */ 181 */
185 void setGivenName( const QString &givenName ); 182 void setGivenName( const QString &givenName );
186 /** 183 /**
187 Return given name. 184 Return given name.
188 */ 185 */
189 QString givenName() const; 186 QString givenName() const;
190 /** 187 /**
191 Return translated label for givenName field. 188 Return translated label for givenName field.
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 );