summaryrefslogtreecommitdiffabout
path: root/kabc
Unidiff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 295ee4f..2564894 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -66,775 +66,793 @@ struct Addressee::AddresseeData : public KShared
66 QString organization; 66 QString organization;
67 QString note; 67 QString note;
68 QString productId; 68 QString productId;
69 QDateTime revision; 69 QDateTime revision;
70 QString sortString; 70 QString sortString;
71 QString externalUID; 71 QString externalUID;
72 QString originalExternalUID; 72 QString originalExternalUID;
73 KURL url; 73 KURL url;
74 Secrecy secrecy; 74 Secrecy secrecy;
75 Picture logo; 75 Picture logo;
76 Picture photo; 76 Picture photo;
77 Sound sound; 77 Sound sound;
78 Agent agent; 78 Agent agent;
79 QString mExternalId; 79 QString mExternalId;
80 PhoneNumber::List phoneNumbers; 80 PhoneNumber::List phoneNumbers;
81 Address::List addresses; 81 Address::List addresses;
82 Key::List keys; 82 Key::List keys;
83 QStringList emails; 83 QStringList emails;
84 QStringList categories; 84 QStringList categories;
85 QStringList custom; 85 QStringList custom;
86 int mTempSyncStat; 86 int mTempSyncStat;
87 Resource *resource; 87 Resource *resource;
88 88
89 bool empty :1; 89 bool empty :1;
90 bool changed :1; 90 bool changed :1;
91 bool tagged :1; 91 bool tagged :1;
92}; 92};
93 93
94Addressee::Addressee() 94Addressee::Addressee()
95{ 95{
96 mData = new AddresseeData; 96 mData = new AddresseeData;
97 mData->empty = true; 97 mData->empty = true;
98 mData->changed = false; 98 mData->changed = false;
99 mData->resource = 0; 99 mData->resource = 0;
100 mData->mExternalId = ":"; 100 mData->mExternalId = ":";
101 mData->revision = QDateTime ( QDate( 2003,1,1)); 101 mData->revision = QDateTime ( QDate( 2003,1,1));
102 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; 102 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
103} 103}
104 104
105Addressee::~Addressee() 105Addressee::~Addressee()
106{ 106{
107} 107}
108 108
109Addressee::Addressee( const Addressee &a ) 109Addressee::Addressee( const Addressee &a )
110{ 110{
111 mData = a.mData; 111 mData = a.mData;
112} 112}
113 113
114Addressee &Addressee::operator=( const Addressee &a ) 114Addressee &Addressee::operator=( const Addressee &a )
115{ 115{
116 mData = a.mData; 116 mData = a.mData;
117 return (*this); 117 return (*this);
118} 118}
119 119
120Addressee Addressee::copy() 120Addressee Addressee::copy()
121{ 121{
122 Addressee a; 122 Addressee a;
123 *(a.mData) = *mData; 123 *(a.mData) = *mData;
124 return a; 124 return a;
125} 125}
126 126
127void Addressee::detach() 127void Addressee::detach()
128{ 128{
129 if ( mData.count() == 1 ) return; 129 if ( mData.count() == 1 ) return;
130 *this = copy(); 130 *this = copy();
131} 131}
132 132
133bool Addressee::operator==( const Addressee &a ) const 133bool Addressee::operator==( const Addressee &a ) const
134{ 134{
135 if ( uid() != a.uid() ) return false; 135 if ( uid() != a.uid() ) return false;
136 if ( mData->name != a.mData->name ) return false; 136 if ( mData->name != a.mData->name ) return false;
137 if ( mData->formattedName != a.mData->formattedName ) return false; 137 if ( mData->formattedName != a.mData->formattedName ) return false;
138 if ( mData->familyName != a.mData->familyName ) return false; 138 if ( mData->familyName != a.mData->familyName ) return false;
139 if ( mData->givenName != a.mData->givenName ) return false; 139 if ( mData->givenName != a.mData->givenName ) return false;
140 if ( mData->additionalName != a.mData->additionalName ) return false; 140 if ( mData->additionalName != a.mData->additionalName ) return false;
141 if ( mData->prefix != a.mData->prefix ) return false; 141 if ( mData->prefix != a.mData->prefix ) return false;
142 if ( mData->suffix != a.mData->suffix ) return false; 142 if ( mData->suffix != a.mData->suffix ) return false;
143 if ( mData->nickName != a.mData->nickName ) return false; 143 if ( mData->nickName != a.mData->nickName ) return false;
144 if ( mData->birthday != a.mData->birthday ) return false; 144 if ( mData->birthday != a.mData->birthday ) return false;
145 if ( mData->mailer != a.mData->mailer ) return false; 145 if ( mData->mailer != a.mData->mailer ) return false;
146 if ( mData->timeZone != a.mData->timeZone ) return false; 146 if ( mData->timeZone != a.mData->timeZone ) return false;
147 if ( mData->geo != a.mData->geo ) return false; 147 if ( mData->geo != a.mData->geo ) return false;
148 if ( mData->title != a.mData->title ) return false; 148 if ( mData->title != a.mData->title ) return false;
149 if ( mData->role != a.mData->role ) return false; 149 if ( mData->role != a.mData->role ) return false;
150 if ( mData->organization != a.mData->organization ) return false; 150 if ( mData->organization != a.mData->organization ) return false;
151 if ( mData->note != a.mData->note ) return false; 151 if ( mData->note != a.mData->note ) return false;
152 if ( mData->productId != a.mData->productId ) return false; 152 if ( mData->productId != a.mData->productId ) return false;
153 //if ( mData->revision != a.mData->revision ) return false; 153 //if ( mData->revision != a.mData->revision ) return false;
154 if ( mData->sortString != a.mData->sortString ) return false; 154 if ( mData->sortString != a.mData->sortString ) return false;
155 if ( mData->secrecy != a.mData->secrecy ) return false; 155 if ( mData->secrecy != a.mData->secrecy ) return false;
156 if ( mData->logo != a.mData->logo ) return false; 156 if ( mData->logo != a.mData->logo ) return false;
157 if ( mData->photo != a.mData->photo ) return false; 157 if ( mData->photo != a.mData->photo ) return false;
158 if ( mData->sound != a.mData->sound ) return false; 158 if ( mData->sound != a.mData->sound ) return false;
159 if ( mData->agent != a.mData->agent ) return false; 159 if ( mData->agent != a.mData->agent ) return false;
160 if ( ( mData->url.isValid() || a.mData->url.isValid() ) && 160 if ( ( mData->url.isValid() || a.mData->url.isValid() ) &&
161 ( mData->url != a.mData->url ) ) return false; 161 ( mData->url != a.mData->url ) ) return false;
162 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; 162 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false;
163 if ( mData->addresses != a.mData->addresses ) return false; 163 if ( mData->addresses != a.mData->addresses ) return false;
164 if ( mData->keys != a.mData->keys ) return false; 164 if ( mData->keys != a.mData->keys ) return false;
165 if ( mData->emails != a.mData->emails ) return false; 165 if ( mData->emails != a.mData->emails ) return false;
166 if ( mData->categories != a.mData->categories ) return false; 166 if ( mData->categories != a.mData->categories ) return false;
167 if ( mData->custom != a.mData->custom ) return false; 167 if ( mData->custom != a.mData->custom ) return false;
168 168
169 return true; 169 return true;
170} 170}
171 171
172bool Addressee::operator!=( const Addressee &a ) const 172bool Addressee::operator!=( const Addressee &a ) const
173{ 173{
174 return !( a == *this ); 174 return !( a == *this );
175} 175}
176 176
177bool Addressee::isEmpty() const 177bool Addressee::isEmpty() const
178{ 178{
179 return mData->empty; 179 return mData->empty;
180} 180}
181ulong Addressee::getCsum4List( const QStringList & attList) 181ulong Addressee::getCsum4List( const QStringList & attList)
182{ 182{
183 int max = attList.count(); 183 int max = attList.count();
184 ulong cSum = 0; 184 ulong cSum = 0;
185 int j,k,i; 185 int j,k,i;
186 int add; 186 int add;
187 for ( i = 0; i < max ; ++i ) { 187 for ( i = 0; i < max ; ++i ) {
188 QString s = attList[i]; 188 QString s = attList[i];
189 if ( ! s.isEmpty() ){ 189 if ( ! s.isEmpty() ){
190 j = s.length(); 190 j = s.length();
191 for ( k = 0; k < j; ++k ) { 191 for ( k = 0; k < j; ++k ) {
192 int mul = k +1; 192 int mul = k +1;
193 add = s[k].unicode (); 193 add = s[k].unicode ();
194 if ( k < 16 ) 194 if ( k < 16 )
195 mul = mul * mul; 195 mul = mul * mul;
196 int ii = i+1; 196 int ii = i+1;
197 add = add * mul *ii*ii*ii; 197 add = add * mul *ii*ii*ii;
198 cSum += add; 198 cSum += add;
199 } 199 }
200 } 200 }
201 201
202 } 202 }
203 //QString dump = attList.join(","); 203 //QString dump = attList.join(",");
204 //qDebug("csum: %d %s", cSum,dump.latin1()); 204 //qDebug("csum: %d %s", cSum,dump.latin1());
205 205
206 return cSum; 206 return cSum;
207 207
208} 208}
209void Addressee::computeCsum(const QString &dev) 209void Addressee::computeCsum(const QString &dev)
210{ 210{
211 QStringList l; 211 QStringList l;
212 if ( !mData->name.isEmpty() ) l.append(mData->name); 212 if ( !mData->name.isEmpty() ) l.append(mData->name);
213 if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); 213 if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName );
214 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); 214 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName );
215 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); 215 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName );
216 if ( !mData->additionalName ) l.append( mData->additionalName ); 216 if ( !mData->additionalName ) l.append( mData->additionalName );
217 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); 217 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix );
218 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); 218 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix );
219 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); 219 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName );
220 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); 220 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() );
221 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); 221 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer );
222 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); 222 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
223 if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); 223 if ( mData->geo.isValid() ) l.append( mData->geo.asString() );
224 if ( !mData->title .isEmpty() ) l.append( mData->title ); 224 if ( !mData->title .isEmpty() ) l.append( mData->title );
225 if ( !mData->role.isEmpty() ) l.append( mData->role ); 225 if ( !mData->role.isEmpty() ) l.append( mData->role );
226 if ( !mData->organization.isEmpty() ) l.append( mData->organization ); 226 if ( !mData->organization.isEmpty() ) l.append( mData->organization );
227 if ( !mData->note.isEmpty() ) l.append( mData->note ); 227 if ( !mData->note.isEmpty() ) l.append( mData->note );
228 if ( !mData->productId.isEmpty() ) l.append(mData->productId ); 228 if ( !mData->productId.isEmpty() ) l.append(mData->productId );
229 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); 229 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString );
230 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); 230 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString());
231 // if ( !mData->logo.isEmpty() ) l.append( ); 231 // if ( !mData->logo.isEmpty() ) l.append( );
232 //if ( !mData->photo.isEmpty() ) l.append( ); 232 //if ( !mData->photo.isEmpty() ) l.append( );
233 //if ( !mData->sound.isEmpty() ) l.append( ); 233 //if ( !mData->sound.isEmpty() ) l.append( );
234 //if ( !mData->agent.isEmpty() ) l.append( ); 234 //if ( !mData->agent.isEmpty() ) l.append( );
235 if ( mData->url.isValid() ) 235 if ( mData->url.isValid() )
236 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); 236 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() );
237 KABC::PhoneNumber::List phoneNumbers; 237 KABC::PhoneNumber::List phoneNumbers;
238 KABC::PhoneNumber::List::Iterator phoneIter; 238 KABC::PhoneNumber::List::Iterator phoneIter;
239 239
240 QStringList t; 240 QStringList t;
241 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 241 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
242 ++phoneIter ) 242 ++phoneIter )
243 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); 243 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) );
244 t.sort(); 244 t.sort();
245 uint iii; 245 uint iii;
246 for ( iii = 0; iii < t.count(); ++iii) 246 for ( iii = 0; iii < t.count(); ++iii)
247 l.append( t[iii] ); 247 l.append( t[iii] );
248 t = mData->emails; 248 t = mData->emails;
249 t.sort(); 249 t.sort();
250 for ( iii = 0; iii < t.count(); ++iii) 250 for ( iii = 0; iii < t.count(); ++iii)
251 l.append( t[iii] ); 251 l.append( t[iii] );
252 t = mData->categories; 252 t = mData->categories;
253 t.sort(); 253 t.sort();
254 for ( iii = 0; iii < t.count(); ++iii) 254 for ( iii = 0; iii < t.count(); ++iii)
255 l.append( t[iii] ); 255 l.append( t[iii] );
256 t = mData->custom; 256 t = mData->custom;
257 t.sort(); 257 t.sort();
258 for ( iii = 0; iii < t.count(); ++iii) 258 for ( iii = 0; iii < t.count(); ++iii)
259 l.append( t[iii] ); 259 l.append( t[iii] );
260 KABC::Address::List::Iterator addressIter; 260 KABC::Address::List::Iterator addressIter;
261 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 261 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
262 ++addressIter ) { 262 ++addressIter ) {
263 t = (*addressIter).asList(); 263 t = (*addressIter).asList();
264 t.sort(); 264 t.sort();
265 for ( iii = 0; iii < t.count(); ++iii) 265 for ( iii = 0; iii < t.count(); ++iii)
266 l.append( t[iii] ); 266 l.append( t[iii] );
267 } 267 }
268 uint cs = getCsum4List(l); 268 uint cs = getCsum4List(l);
269 // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); 269 // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
270 setCsum( dev, QString::number (cs )); 270 setCsum( dev, QString::number (cs ));
271} 271}
272 272
273void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) 273void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
274{ 274{
275 275
276 detach(); 276 detach();
277 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 277 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
278 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 278 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
279 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 279 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
280 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 280 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
281 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 281 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
282 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; 282 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
283 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; 283 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
284 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; 284 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
285 if ( !mData->birthday.isValid() ) 285 if ( !mData->birthday.isValid() )
286 if ( ad.mData->birthday.isValid()) 286 if ( ad.mData->birthday.isValid())
287 mData->birthday = ad.mData->birthday; 287 mData->birthday = ad.mData->birthday;
288 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 288 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
289 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 289 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
290 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 290 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
291 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 291 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
292 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 292 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
293 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 293 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
294 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; 294 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
295 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; 295 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
296 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; 296 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
297 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; 297 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
298 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; 298 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
299 QStringList t; 299 QStringList t;
300 QStringList tAD; 300 QStringList tAD;
301 uint iii; 301 uint iii;
302 302
303 // ********** phone numbers 303 // ********** phone numbers
304 PhoneNumber::List phoneAD = ad.phoneNumbers(); 304 PhoneNumber::List phoneAD = ad.phoneNumbers();
305 PhoneNumber::List::Iterator phoneItAD; 305 PhoneNumber::List::Iterator phoneItAD;
306 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { 306 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
307 bool found = false; 307 bool found = false;
308 PhoneNumber::List::Iterator it; 308 PhoneNumber::List::Iterator it;
309 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 309 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
310 if ( ( *phoneItAD ).contains( (*it) ) ) { 310 if ( ( *phoneItAD ).contains( (*it) ) ) {
311 found = true; 311 found = true;
312 (*it).setType( ( *phoneItAD ).type() ); 312 (*it).setType( ( *phoneItAD ).type() );
313 break; 313 break;
314 } 314 }
315 } 315 }
316 if ( isSubSet && ! found ) 316 if ( isSubSet && ! found )
317 mData->phoneNumbers.append( *phoneItAD ); 317 mData->phoneNumbers.append( *phoneItAD );
318 } 318 }
319 if ( isSubSet ) { 319 if ( isSubSet ) {
320 // ************* emails; 320 // ************* emails;
321 t = mData->emails; 321 t = mData->emails;
322 tAD = ad.mData->emails; 322 tAD = ad.mData->emails;
323 for ( iii = 0; iii < tAD.count(); ++iii) 323 for ( iii = 0; iii < tAD.count(); ++iii)
324 if ( !t.contains(tAD[iii] ) ) 324 if ( !t.contains(tAD[iii] ) )
325 mData->emails.append( tAD[iii] ); 325 mData->emails.append( tAD[iii] );
326 } 326 }
327 327
328 // ************* categories; 328 // ************* categories;
329 t = mData->categories; 329 t = mData->categories;
330 tAD = ad.mData->categories; 330 tAD = ad.mData->categories;
331 for ( iii = 0; iii < tAD.count(); ++iii) 331 for ( iii = 0; iii < tAD.count(); ++iii)
332 if ( !t.contains(tAD[iii] ) ) 332 if ( !t.contains(tAD[iii] ) )
333 mData->categories.append( tAD[iii] ); 333 mData->categories.append( tAD[iii] );
334 QStringList::ConstIterator it; 334 QStringList::ConstIterator it;
335 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { 335 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) {
336 QString qualifiedName = (*it).left( (*it).find( ":" )); 336 QString qualifiedName = (*it).left( (*it).find( ":" ));
337 bool found = false; 337 bool found = false;
338 QStringList::ConstIterator itL; 338 QStringList::ConstIterator itL;
339 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { 339 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) {
340 if ( (*itL).startsWith( qualifiedName ) ) { 340 if ( (*itL).startsWith( qualifiedName ) ) {
341 found = true; 341 found = true;
342 break; 342 break;
343 } 343 }
344 } 344 }
345 if ( ! found ) { 345 if ( ! found ) {
346 mData->custom.append( *it ); 346 mData->custom.append( *it );
347 } 347 }
348 } 348 }
349 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; 349 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo;
350 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; 350 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo;
351 if ( !mData->sound.isIntern() ) { 351 if ( !mData->sound.isIntern() ) {
352 if ( mData->sound.url().isEmpty() ) { 352 if ( mData->sound.url().isEmpty() ) {
353 mData->sound = ad.mData->sound; 353 mData->sound = ad.mData->sound;
354 } 354 }
355 } 355 }
356 if ( !mData->agent.isIntern() ) { 356 if ( !mData->agent.isIntern() ) {
357 if ( mData->agent.url().isEmpty() ) { 357 if ( mData->agent.url().isEmpty() ) {
358 mData->agent = ad.mData->agent; 358 mData->agent = ad.mData->agent;
359 } 359 }
360 } 360 }
361 { 361 {
362 Key::List::Iterator itA; 362 Key::List::Iterator itA;
363 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { 363 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) {
364 bool found = false; 364 bool found = false;
365 Key::List::Iterator it; 365 Key::List::Iterator it;
366 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 366 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
367 if ( (*it) == (*itA)) { 367 if ( (*it) == (*itA)) {
368 found = true; 368 found = true;
369 break; 369 break;
370 370
371 } 371 }
372 } 372 }
373 if ( ! found ) { 373 if ( ! found ) {
374 mData->keys.append( *itA ); 374 mData->keys.append( *itA );
375 } 375 }
376 } 376 }
377 } 377 }
378 KABC::Address::List::Iterator addressIterA; 378 KABC::Address::List::Iterator addressIterA;
379 for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { 379 for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) {
380 bool found = false; 380 bool found = false;
381 KABC::Address::List::Iterator addressIter; 381 KABC::Address::List::Iterator addressIter;
382 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 382 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
383 ++addressIter ) { 383 ++addressIter ) {
384 if ( (*addressIter) == (*addressIterA)) { 384 if ( (*addressIter) == (*addressIterA)) {
385 found = true; 385 found = true;
386 (*addressIter).setType( (*addressIterA).type() ); 386 (*addressIter).setType( (*addressIterA).type() );
387 break; 387 break;
388 } 388 }
389 389
390 } 390 }
391 if ( isSubSet && ! found ) { 391 if ( isSubSet && ! found ) {
392 mData->addresses.append( *addressIterA ); 392 mData->addresses.append( *addressIterA );
393 } 393 }
394 } 394 }
395 //qDebug("merge contact %s ", ad.uid().latin1()); 395 //qDebug("merge contact %s ", ad.uid().latin1());
396 setUid( ad.uid() ); 396 setUid( ad.uid() );
397 setRevision( ad.revision() ); 397 setRevision( ad.revision() );
398} 398}
399 399
400bool Addressee::removeVoice() 400bool Addressee::removeVoice()
401{ 401{
402 PhoneNumber::List phoneN = phoneNumbers(); 402 PhoneNumber::List phoneN = phoneNumbers();
403 PhoneNumber::List::Iterator phoneIt; 403 PhoneNumber::List::Iterator phoneIt;
404 bool found = false; 404 bool found = false;
405 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { 405 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
406 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 406 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
407 if ((*phoneIt).type() - PhoneNumber::Voice ) { 407 if ((*phoneIt).type() - PhoneNumber::Voice ) {
408 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 408 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
409 insertPhoneNumber( (*phoneIt) ); 409 insertPhoneNumber( (*phoneIt) );
410 found = true; 410 found = true;
411 } 411 }
412 } 412 }
413 413
414 } 414 }
415 return found; 415 return found;
416} 416}
417 417
418bool Addressee::containsAdr(const Addressee& ad ) 418bool Addressee::containsAdr(const Addressee& ad )
419{ 419{
420 if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; 420 if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false;
421 if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; 421 if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false;
422 if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; 422 if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ;
423 if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; 423 if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ;
424 if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; 424 if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ;
425 if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; 425 if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ;
426 if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; 426 if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ;
427 427
428 // compare phone numbers 428 // compare phone numbers
429 PhoneNumber::List phoneN = ad.phoneNumbers(); 429 PhoneNumber::List phoneN = ad.phoneNumbers();
430 PhoneNumber::List::Iterator phoneIt; 430 PhoneNumber::List::Iterator phoneIt;
431 bool found = false; 431 bool found = false;
432 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { 432 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
433 bool found = false; 433 bool found = false;
434 PhoneNumber::List phoneL = ad.phoneNumbers(); 434 PhoneNumber::List phoneL = ad.phoneNumbers();
435 PhoneNumber::List::Iterator phoneItL; 435 PhoneNumber::List::Iterator phoneItL;
436 for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { 436 for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) {
437 if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { 437 if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) {
438 found = true; 438 found = true;
439 break; 439 break;
440 } 440 }
441 } 441 }
442 if ( ! found ) 442 if ( ! found )
443 return false; 443 return false;
444 } 444 }
445 return true; 445 return true;
446 446
447} 447}
448void Addressee::simplifyAddresses() 448void Addressee::simplifyAddresses()
449{ 449{
450
451
452 Address::List list;
453 Address::List::Iterator it;
454 Address::List::Iterator it2;
455 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
456 it2 = it;
457 ++it2;
458 for( ; it2 != mData->addresses.end(); ++it2 ) {
459 if ( (*it) == (*it2) ) {
460 list.append( *it );
461 break;
462 }
463 }
464 }
465 for( it = list.begin(); it != list.end(); ++it ) {
466 removeAddress( (*it) );
467 }
468
469 list.clear();
450 int max = 2; 470 int max = 2;
451 if ( mData->url.isValid() ) 471 if ( mData->url.isValid() )
452 max = 1; 472 max = 1;
453 if ( mData->addresses.count() <= max ) return ; 473 if ( mData->addresses.count() <= max ) return ;
454 int count = 0; 474 int count = 0;
455 Address::List list;
456 Address::List::Iterator it;
457 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 475 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
458 if ( count >= max ) 476 if ( count >= max )
459 list.append( *it ); 477 list.append( *it );
460 ++count; 478 ++count;
461 } 479 }
462 for( it = list.begin(); it != list.end(); ++it ) { 480 for( it = list.begin(); it != list.end(); ++it ) {
463 removeAddress( (*it) ); 481 removeAddress( (*it) );
464 } 482 }
465} 483}
466 484
467// removes all emails but the first 485// removes all emails but the first
468// needed by phone sync 486// needed by phone sync
469void Addressee::simplifyEmails() 487void Addressee::simplifyEmails()
470{ 488{
471 if ( mData->emails.count() == 0 ) return ; 489 if ( mData->emails.count() == 0 ) return ;
472 QString email = mData->emails.first(); 490 QString email = mData->emails.first();
473 detach(); 491 detach();
474 mData->emails.clear(); 492 mData->emails.clear();
475 mData->emails.append( email ); 493 mData->emails.append( email );
476} 494}
477 495
478void Addressee::simplifyPhoneNumbers() 496void Addressee::simplifyPhoneNumbers()
479{ 497{
480 int max = 4; 498 int max = 4;
481 int inList = mData->phoneNumbers.count(); 499 int inList = mData->phoneNumbers.count();
482 KABC::PhoneNumber::List removeNumbers; 500 KABC::PhoneNumber::List removeNumbers;
483 KABC::PhoneNumber::List::Iterator phoneIter; 501 KABC::PhoneNumber::List::Iterator phoneIter;
484 if ( inList > max ) { 502 if ( inList > max ) {
485 // delete non-preferred numbers 503 // delete non-preferred numbers
486 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 504 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
487 ++phoneIter ) { 505 ++phoneIter ) {
488 if ( inList > max ) { 506 if ( inList > max ) {
489 if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { 507 if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) {
490 removeNumbers.append( ( *phoneIter ) ); 508 removeNumbers.append( ( *phoneIter ) );
491 --inList; 509 --inList;
492 } 510 }
493 } else 511 } else
494 break; 512 break;
495 } 513 }
496 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 514 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
497 ++phoneIter ) { 515 ++phoneIter ) {
498 removePhoneNumber(( *phoneIter )); 516 removePhoneNumber(( *phoneIter ));
499 } 517 }
500 // delete preferred numbers 518 // delete preferred numbers
501 if ( inList > max ) { 519 if ( inList > max ) {
502 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 520 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
503 ++phoneIter ) { 521 ++phoneIter ) {
504 if ( inList > max ) { 522 if ( inList > max ) {
505 removeNumbers.append( ( *phoneIter ) ); 523 removeNumbers.append( ( *phoneIter ) );
506 --inList; 524 --inList;
507 } else 525 } else
508 break; 526 break;
509 } 527 }
510 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 528 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
511 ++phoneIter ) { 529 ++phoneIter ) {
512 removePhoneNumber(( *phoneIter )); 530 removePhoneNumber(( *phoneIter ));
513 } 531 }
514 } 532 }
515 } 533 }
516 // remove non-numeric characters 534 // remove non-numeric characters
517 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 535 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
518 ++phoneIter ) { 536 ++phoneIter ) {
519 if ( ! ( *phoneIter ).simplifyNumber() ) 537 if ( ! ( *phoneIter ).simplifyNumber() )
520 removeNumbers.append( ( *phoneIter ) ); 538 removeNumbers.append( ( *phoneIter ) );
521 } 539 }
522 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 540 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
523 ++phoneIter ) { 541 ++phoneIter ) {
524 removePhoneNumber(( *phoneIter )); 542 removePhoneNumber(( *phoneIter ));
525 } 543 }
526} 544}
527void Addressee::simplifyPhoneNumberTypes() 545void Addressee::simplifyPhoneNumberTypes()
528{ 546{
529 KABC::PhoneNumber::List::Iterator phoneIter; 547 KABC::PhoneNumber::List::Iterator phoneIter;
530 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 548 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
531 ++phoneIter ) 549 ++phoneIter )
532 ( *phoneIter ).simplifyType(); 550 ( *phoneIter ).simplifyType();
533} 551}
534void Addressee::removeID(const QString &prof) 552void Addressee::removeID(const QString &prof)
535{ 553{
536 detach(); 554 detach();
537 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 555 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
538 556
539} 557}
540void Addressee::setID( const QString & prof , const QString & id ) 558void Addressee::setID( const QString & prof , const QString & id )
541{ 559{
542 detach(); 560 detach();
543 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 561 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
544 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 562 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
545} 563}
546void Addressee::setTempSyncStat( int id ) 564void Addressee::setTempSyncStat( int id )
547{ 565{
548 if ( mData->mTempSyncStat == id ) return; 566 if ( mData->mTempSyncStat == id ) return;
549 detach(); 567 detach();
550 mData->mTempSyncStat = id; 568 mData->mTempSyncStat = id;
551} 569}
552int Addressee::tempSyncStat() const 570int Addressee::tempSyncStat() const
553{ 571{
554 return mData->mTempSyncStat; 572 return mData->mTempSyncStat;
555} 573}
556 574
557QString Addressee::getID( const QString & prof) 575QString Addressee::getID( const QString & prof)
558{ 576{
559 return KIdManager::getId ( mData->mExternalId, prof ); 577 return KIdManager::getId ( mData->mExternalId, prof );
560} 578}
561 579
562void Addressee::setCsum( const QString & prof , const QString & id ) 580void Addressee::setCsum( const QString & prof , const QString & id )
563{ 581{
564 detach(); 582 detach();
565 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 583 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
566 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); 584 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
567 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); 585 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
568} 586}
569 587
570QString Addressee::getCsum( const QString & prof) 588QString Addressee::getCsum( const QString & prof)
571{ 589{
572 return KIdManager::getCsum ( mData->mExternalId, prof ); 590 return KIdManager::getCsum ( mData->mExternalId, prof );
573} 591}
574 592
575void Addressee::setIDStr( const QString & s ) 593void Addressee::setIDStr( const QString & s )
576{ 594{
577 detach(); 595 detach();
578 mData->mExternalId = s; 596 mData->mExternalId = s;
579} 597}
580 598
581QString Addressee::IDStr() const 599QString Addressee::IDStr() const
582{ 600{
583 return mData->mExternalId; 601 return mData->mExternalId;
584} 602}
585 603
586void Addressee::setExternalUID( const QString &id ) 604void Addressee::setExternalUID( const QString &id )
587{ 605{
588 if ( id == mData->externalUID ) return; 606 if ( id == mData->externalUID ) return;
589 detach(); 607 detach();
590 mData->empty = false; 608 mData->empty = false;
591 mData->externalUID = id; 609 mData->externalUID = id;
592} 610}
593 611
594QString Addressee::externalUID() const 612QString Addressee::externalUID() const
595{ 613{
596 return mData->externalUID; 614 return mData->externalUID;
597} 615}
598void Addressee::setOriginalExternalUID( const QString &id ) 616void Addressee::setOriginalExternalUID( const QString &id )
599{ 617{
600 if ( id == mData->originalExternalUID ) return; 618 if ( id == mData->originalExternalUID ) return;
601 detach(); 619 detach();
602 mData->empty = false; 620 mData->empty = false;
603 //qDebug("*******Set orig uid %s ", id.latin1()); 621 //qDebug("*******Set orig uid %s ", id.latin1());
604 mData->originalExternalUID = id; 622 mData->originalExternalUID = id;
605} 623}
606 624
607QString Addressee::originalExternalUID() const 625QString Addressee::originalExternalUID() const
608{ 626{
609 return mData->originalExternalUID; 627 return mData->originalExternalUID;
610} 628}
611 629
612void Addressee::setUid( const QString &id ) 630void Addressee::setUid( const QString &id )
613{ 631{
614 if ( id == mData->uid ) return; 632 if ( id == mData->uid ) return;
615 detach(); 633 detach();
616 //qDebug("****setuid %s ", id.latin1()); 634 //qDebug("****setuid %s ", id.latin1());
617 mData->empty = false; 635 mData->empty = false;
618 mData->uid = id; 636 mData->uid = id;
619} 637}
620 638
621QString Addressee::uid() const 639QString Addressee::uid() const
622{ 640{
623 if ( mData->uid.isEmpty() ) 641 if ( mData->uid.isEmpty() )
624 mData->uid = KApplication::randomString( 10 ); 642 mData->uid = KApplication::randomString( 10 );
625 643
626 return mData->uid; 644 return mData->uid;
627} 645}
628 646
629QString Addressee::uidLabel() 647QString Addressee::uidLabel()
630{ 648{
631 return i18n("Unique Identifier"); 649 return i18n("Unique Identifier");
632} 650}
633 651
634void Addressee::setName( const QString &name ) 652void Addressee::setName( const QString &name )
635{ 653{
636 if ( name == mData->name ) return; 654 if ( name == mData->name ) return;
637 detach(); 655 detach();
638 mData->empty = false; 656 mData->empty = false;
639 mData->name = name; 657 mData->name = name;
640} 658}
641 659
642QString Addressee::name() const 660QString Addressee::name() const
643{ 661{
644 return mData->name; 662 return mData->name;
645} 663}
646 664
647QString Addressee::nameLabel() 665QString Addressee::nameLabel()
648{ 666{
649 return i18n("Name"); 667 return i18n("Name");
650} 668}
651 669
652 670
653void Addressee::setFormattedName( const QString &formattedName ) 671void Addressee::setFormattedName( const QString &formattedName )
654{ 672{
655 if ( formattedName == mData->formattedName ) return; 673 if ( formattedName == mData->formattedName ) return;
656 detach(); 674 detach();
657 mData->empty = false; 675 mData->empty = false;
658 mData->formattedName = formattedName; 676 mData->formattedName = formattedName;
659} 677}
660 678
661QString Addressee::formattedName() const 679QString Addressee::formattedName() const
662{ 680{
663 return mData->formattedName; 681 return mData->formattedName;
664} 682}
665 683
666QString Addressee::formattedNameLabel() 684QString Addressee::formattedNameLabel()
667{ 685{
668 return i18n("Formatted Name"); 686 return i18n("Formatted Name");
669} 687}
670 688
671 689
672void Addressee::setFamilyName( const QString &familyName ) 690void Addressee::setFamilyName( const QString &familyName )
673{ 691{
674 if ( familyName == mData->familyName ) return; 692 if ( familyName == mData->familyName ) return;
675 detach(); 693 detach();
676 mData->empty = false; 694 mData->empty = false;
677 mData->familyName = familyName; 695 mData->familyName = familyName;
678} 696}
679 697
680QString Addressee::familyName() const 698QString Addressee::familyName() const
681{ 699{
682 return mData->familyName; 700 return mData->familyName;
683} 701}
684 702
685QString Addressee::familyNameLabel() 703QString Addressee::familyNameLabel()
686{ 704{
687 return i18n("Family Name"); 705 return i18n("Family Name");
688} 706}
689 707
690 708
691void Addressee::setGivenName( const QString &givenName ) 709void Addressee::setGivenName( const QString &givenName )
692{ 710{
693 if ( givenName == mData->givenName ) return; 711 if ( givenName == mData->givenName ) return;
694 detach(); 712 detach();
695 mData->empty = false; 713 mData->empty = false;
696 mData->givenName = givenName; 714 mData->givenName = givenName;
697} 715}
698 716
699QString Addressee::givenName() const 717QString Addressee::givenName() const
700{ 718{
701 return mData->givenName; 719 return mData->givenName;
702} 720}
703 721
704QString Addressee::givenNameLabel() 722QString Addressee::givenNameLabel()
705{ 723{
706 return i18n("Given Name"); 724 return i18n("Given Name");
707} 725}
708 726
709 727
710void Addressee::setAdditionalName( const QString &additionalName ) 728void Addressee::setAdditionalName( const QString &additionalName )
711{ 729{
712 if ( additionalName == mData->additionalName ) return; 730 if ( additionalName == mData->additionalName ) return;
713 detach(); 731 detach();
714 mData->empty = false; 732 mData->empty = false;
715 mData->additionalName = additionalName; 733 mData->additionalName = additionalName;
716} 734}
717 735
718QString Addressee::additionalName() const 736QString Addressee::additionalName() const
719{ 737{
720 return mData->additionalName; 738 return mData->additionalName;
721} 739}
722 740
723QString Addressee::additionalNameLabel() 741QString Addressee::additionalNameLabel()
724{ 742{
725 return i18n("Additional Names"); 743 return i18n("Additional Names");
726} 744}
727 745
728 746
729void Addressee::setPrefix( const QString &prefix ) 747void Addressee::setPrefix( const QString &prefix )
730{ 748{
731 if ( prefix == mData->prefix ) return; 749 if ( prefix == mData->prefix ) return;
732 detach(); 750 detach();
733 mData->empty = false; 751 mData->empty = false;
734 mData->prefix = prefix; 752 mData->prefix = prefix;
735} 753}
736 754
737QString Addressee::prefix() const 755QString Addressee::prefix() const
738{ 756{
739 return mData->prefix; 757 return mData->prefix;
740} 758}
741 759
742QString Addressee::prefixLabel() 760QString Addressee::prefixLabel()
743{ 761{
744 return i18n("Honorific Prefixes"); 762 return i18n("Honorific Prefixes");
745} 763}
746 764
747 765
748void Addressee::setSuffix( const QString &suffix ) 766void Addressee::setSuffix( const QString &suffix )
749{ 767{
750 if ( suffix == mData->suffix ) return; 768 if ( suffix == mData->suffix ) return;
751 detach(); 769 detach();
752 mData->empty = false; 770 mData->empty = false;
753 mData->suffix = suffix; 771 mData->suffix = suffix;
754} 772}
755 773
756QString Addressee::suffix() const 774QString Addressee::suffix() const
757{ 775{
758 return mData->suffix; 776 return mData->suffix;
759} 777}
760 778
761QString Addressee::suffixLabel() 779QString Addressee::suffixLabel()
762{ 780{
763 return i18n("Honorific Suffixes"); 781 return i18n("Honorific Suffixes");
764} 782}
765 783
766 784
767void Addressee::setNickName( const QString &nickName ) 785void Addressee::setNickName( const QString &nickName )
768{ 786{
769 if ( nickName == mData->nickName ) return; 787 if ( nickName == mData->nickName ) return;
770 detach(); 788 detach();
771 mData->empty = false; 789 mData->empty = false;
772 mData->nickName = nickName; 790 mData->nickName = nickName;
773} 791}
774 792
775QString Addressee::nickName() const 793QString Addressee::nickName() const
776{ 794{
777 return mData->nickName; 795 return mData->nickName;
778} 796}
779 797
780QString Addressee::nickNameLabel() 798QString Addressee::nickNameLabel()
781{ 799{
782 return i18n("Nick Name"); 800 return i18n("Nick Name");
783} 801}
784 802
785 803
786void Addressee::setBirthday( const QDateTime &birthday ) 804void Addressee::setBirthday( const QDateTime &birthday )
787{ 805{
788 if ( birthday == mData->birthday ) return; 806 if ( birthday == mData->birthday ) return;
789 detach(); 807 detach();
790 mData->empty = false; 808 mData->empty = false;
791 mData->birthday = birthday; 809 mData->birthday = birthday;
792} 810}
793 811
794QDateTime Addressee::birthday() const 812QDateTime Addressee::birthday() const
795{ 813{
796 return mData->birthday; 814 return mData->birthday;
797} 815}
798 816
799QString Addressee::birthdayLabel() 817QString Addressee::birthdayLabel()
800{ 818{
801 return i18n("Birthday"); 819 return i18n("Birthday");
802} 820}
803 821
804 822
805QString Addressee::homeAddressStreetLabel() 823QString Addressee::homeAddressStreetLabel()
806{ 824{
807 return i18n("Home Address Street"); 825 return i18n("Home Address Street");
808} 826}
809 827
810 828
811QString Addressee::homeAddressLocalityLabel() 829QString Addressee::homeAddressLocalityLabel()
812{ 830{
813 return i18n("Home Address Locality"); 831 return i18n("Home Address Locality");
814} 832}
815 833
816 834
817QString Addressee::homeAddressRegionLabel() 835QString Addressee::homeAddressRegionLabel()
818{ 836{
819 return i18n("Home Address Region"); 837 return i18n("Home Address Region");
820} 838}
821 839
822 840
823QString Addressee::homeAddressPostalCodeLabel() 841QString Addressee::homeAddressPostalCodeLabel()
824{ 842{
825 return i18n("Home Address Postal Code"); 843 return i18n("Home Address Postal Code");
826} 844}
827 845
828 846
829QString Addressee::homeAddressCountryLabel() 847QString Addressee::homeAddressCountryLabel()
830{ 848{
831 return i18n("Home Address Country"); 849 return i18n("Home Address Country");
832} 850}
833 851
834 852
835QString Addressee::homeAddressLabelLabel() 853QString Addressee::homeAddressLabelLabel()
836{ 854{
837 return i18n("Home Address Label"); 855 return i18n("Home Address Label");
838} 856}
839 857
840 858