summaryrefslogtreecommitdiffabout
path: root/kabc
authorzautrix <zautrix>2004-10-08 23:38:07 (UTC)
committer zautrix <zautrix>2004-10-08 23:38:07 (UTC)
commit07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861 (patch) (unidiff)
tree03d0e5d20e607e035e17fcdabd6bce789069f41e /kabc
parent44169895703beb3e8b1551a313d2d341bf742905 (diff)
downloadkdepimpi-07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861.zip
kdepimpi-07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861.tar.gz
kdepimpi-07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861.tar.bz2
some bugfixes
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp16
-rw-r--r--kabc/addressee.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index e571980..19a1845 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -126,384 +126,400 @@ Addressee Addressee::copy()
126void Addressee::detach() 126void Addressee::detach()
127{ 127{
128 if ( mData.count() == 1 ) return; 128 if ( mData.count() == 1 ) return;
129 *this = copy(); 129 *this = copy();
130} 130}
131 131
132bool Addressee::operator==( const Addressee &a ) const 132bool Addressee::operator==( const Addressee &a ) const
133{ 133{
134 if ( uid() != a.uid() ) return false; 134 if ( uid() != a.uid() ) return false;
135 if ( mData->name != a.mData->name ) return false; 135 if ( mData->name != a.mData->name ) return false;
136 if ( mData->formattedName != a.mData->formattedName ) return false; 136 if ( mData->formattedName != a.mData->formattedName ) return false;
137 if ( mData->familyName != a.mData->familyName ) return false; 137 if ( mData->familyName != a.mData->familyName ) return false;
138 if ( mData->givenName != a.mData->givenName ) return false; 138 if ( mData->givenName != a.mData->givenName ) return false;
139 if ( mData->additionalName != a.mData->additionalName ) return false; 139 if ( mData->additionalName != a.mData->additionalName ) return false;
140 if ( mData->prefix != a.mData->prefix ) return false; 140 if ( mData->prefix != a.mData->prefix ) return false;
141 if ( mData->suffix != a.mData->suffix ) return false; 141 if ( mData->suffix != a.mData->suffix ) return false;
142 if ( mData->nickName != a.mData->nickName ) return false; 142 if ( mData->nickName != a.mData->nickName ) return false;
143 if ( mData->birthday != a.mData->birthday ) return false; 143 if ( mData->birthday != a.mData->birthday ) return false;
144 if ( mData->mailer != a.mData->mailer ) return false; 144 if ( mData->mailer != a.mData->mailer ) return false;
145 if ( mData->timeZone != a.mData->timeZone ) return false; 145 if ( mData->timeZone != a.mData->timeZone ) return false;
146 if ( mData->geo != a.mData->geo ) return false; 146 if ( mData->geo != a.mData->geo ) return false;
147 if ( mData->title != a.mData->title ) return false; 147 if ( mData->title != a.mData->title ) return false;
148 if ( mData->role != a.mData->role ) return false; 148 if ( mData->role != a.mData->role ) return false;
149 if ( mData->organization != a.mData->organization ) return false; 149 if ( mData->organization != a.mData->organization ) return false;
150 if ( mData->note != a.mData->note ) return false; 150 if ( mData->note != a.mData->note ) return false;
151 if ( mData->productId != a.mData->productId ) return false; 151 if ( mData->productId != a.mData->productId ) return false;
152 //if ( mData->revision != a.mData->revision ) return false; 152 //if ( mData->revision != a.mData->revision ) return false;
153 if ( mData->sortString != a.mData->sortString ) return false; 153 if ( mData->sortString != a.mData->sortString ) return false;
154 if ( mData->secrecy != a.mData->secrecy ) return false; 154 if ( mData->secrecy != a.mData->secrecy ) return false;
155 if ( mData->logo != a.mData->logo ) return false; 155 if ( mData->logo != a.mData->logo ) return false;
156 if ( mData->photo != a.mData->photo ) return false; 156 if ( mData->photo != a.mData->photo ) return false;
157 if ( mData->sound != a.mData->sound ) return false; 157 if ( mData->sound != a.mData->sound ) return false;
158 if ( mData->agent != a.mData->agent ) return false; 158 if ( mData->agent != a.mData->agent ) return false;
159 if ( ( mData->url.isValid() || a.mData->url.isValid() ) && 159 if ( ( mData->url.isValid() || a.mData->url.isValid() ) &&
160 ( mData->url != a.mData->url ) ) return false; 160 ( mData->url != a.mData->url ) ) return false;
161 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; 161 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false;
162 if ( mData->addresses != a.mData->addresses ) return false; 162 if ( mData->addresses != a.mData->addresses ) return false;
163 if ( mData->keys != a.mData->keys ) return false; 163 if ( mData->keys != a.mData->keys ) return false;
164 if ( mData->emails != a.mData->emails ) return false; 164 if ( mData->emails != a.mData->emails ) return false;
165 if ( mData->categories != a.mData->categories ) return false; 165 if ( mData->categories != a.mData->categories ) return false;
166 if ( mData->custom != a.mData->custom ) return false; 166 if ( mData->custom != a.mData->custom ) return false;
167 167
168 return true; 168 return true;
169} 169}
170 170
171bool Addressee::operator!=( const Addressee &a ) const 171bool Addressee::operator!=( const Addressee &a ) const
172{ 172{
173 return !( a == *this ); 173 return !( a == *this );
174} 174}
175 175
176bool Addressee::isEmpty() const 176bool Addressee::isEmpty() const
177{ 177{
178 return mData->empty; 178 return mData->empty;
179} 179}
180ulong Addressee::getCsum4List( const QStringList & attList) 180ulong Addressee::getCsum4List( const QStringList & attList)
181{ 181{
182 int max = attList.count(); 182 int max = attList.count();
183 ulong cSum = 0; 183 ulong cSum = 0;
184 int j,k,i; 184 int j,k,i;
185 int add; 185 int add;
186 for ( i = 0; i < max ; ++i ) { 186 for ( i = 0; i < max ; ++i ) {
187 QString s = attList[i]; 187 QString s = attList[i];
188 if ( ! s.isEmpty() ){ 188 if ( ! s.isEmpty() ){
189 j = s.length(); 189 j = s.length();
190 for ( k = 0; k < j; ++k ) { 190 for ( k = 0; k < j; ++k ) {
191 int mul = k +1; 191 int mul = k +1;
192 add = s[k].unicode (); 192 add = s[k].unicode ();
193 if ( k < 16 ) 193 if ( k < 16 )
194 mul = mul * mul; 194 mul = mul * mul;
195 int ii = i+1; 195 int ii = i+1;
196 add = add * mul *ii*ii*ii; 196 add = add * mul *ii*ii*ii;
197 cSum += add; 197 cSum += add;
198 } 198 }
199 } 199 }
200 200
201 } 201 }
202 //QString dump = attList.join(","); 202 //QString dump = attList.join(",");
203 //qDebug("csum: %d %s", cSum,dump.latin1()); 203 //qDebug("csum: %d %s", cSum,dump.latin1());
204 204
205 return cSum; 205 return cSum;
206 206
207} 207}
208void Addressee::computeCsum(const QString &dev) 208void Addressee::computeCsum(const QString &dev)
209{ 209{
210 QStringList l; 210 QStringList l;
211 if ( !mData->name.isEmpty() ) l.append(mData->name); 211 if ( !mData->name.isEmpty() ) l.append(mData->name);
212 if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); 212 if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName );
213 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); 213 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName );
214 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); 214 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName );
215 if ( !mData->additionalName ) l.append( mData->additionalName ); 215 if ( !mData->additionalName ) l.append( mData->additionalName );
216 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); 216 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix );
217 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); 217 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix );
218 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); 218 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName );
219 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); 219 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() );
220 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); 220 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer );
221 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); 221 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
222 if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); 222 if ( mData->geo.isValid() ) l.append( mData->geo.asString() );
223 if ( !mData->title .isEmpty() ) l.append( mData->title ); 223 if ( !mData->title .isEmpty() ) l.append( mData->title );
224 if ( !mData->role.isEmpty() ) l.append( mData->role ); 224 if ( !mData->role.isEmpty() ) l.append( mData->role );
225 if ( !mData->organization.isEmpty() ) l.append( mData->organization ); 225 if ( !mData->organization.isEmpty() ) l.append( mData->organization );
226 if ( !mData->note.isEmpty() ) l.append( mData->note ); 226 if ( !mData->note.isEmpty() ) l.append( mData->note );
227 if ( !mData->productId.isEmpty() ) l.append(mData->productId ); 227 if ( !mData->productId.isEmpty() ) l.append(mData->productId );
228 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); 228 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString );
229 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); 229 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString());
230 // if ( !mData->logo.isEmpty() ) l.append( ); 230 // if ( !mData->logo.isEmpty() ) l.append( );
231 //if ( !mData->photo.isEmpty() ) l.append( ); 231 //if ( !mData->photo.isEmpty() ) l.append( );
232 //if ( !mData->sound.isEmpty() ) l.append( ); 232 //if ( !mData->sound.isEmpty() ) l.append( );
233 //if ( !mData->agent.isEmpty() ) l.append( ); 233 //if ( !mData->agent.isEmpty() ) l.append( );
234 //if ( mData->url.isValid() ) l.append( ); 234 //if ( mData->url.isValid() ) l.append( );
235#if 0 235#if 0
236 if ( !mData->phoneNumbers.isEmpty() ) l.append( ); 236 if ( !mData->phoneNumbers.isEmpty() ) l.append( );
237 if ( !mData->addresses.isEmpty() ) l.append( ); 237 if ( !mData->addresses.isEmpty() ) l.append( );
238 //if ( !mData->keys.isEmpty() ) l.append( ); 238 //if ( !mData->keys.isEmpty() ) l.append( );
239 if ( !mData->emails.isEmpty() ) l.append( ); 239 if ( !mData->emails.isEmpty() ) l.append( );
240 if ( !mData->categories .isEmpty() ) l.append( ); 240 if ( !mData->categories .isEmpty() ) l.append( );
241 if ( !mData->custom.isEmpty() ) l.append( ); 241 if ( !mData->custom.isEmpty() ) l.append( );
242#endif 242#endif
243 KABC::PhoneNumber::List phoneNumbers; 243 KABC::PhoneNumber::List phoneNumbers;
244 KABC::PhoneNumber::List::Iterator phoneIter; 244 KABC::PhoneNumber::List::Iterator phoneIter;
245 245
246 QStringList t; 246 QStringList t;
247 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 247 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
248 ++phoneIter ) 248 ++phoneIter )
249 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); 249 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) );
250 t.sort(); 250 t.sort();
251 uint iii; 251 uint iii;
252 for ( iii = 0; iii < t.count(); ++iii) 252 for ( iii = 0; iii < t.count(); ++iii)
253 l.append( t[iii] ); 253 l.append( t[iii] );
254 t = mData->emails; 254 t = mData->emails;
255 t.sort(); 255 t.sort();
256 for ( iii = 0; iii < t.count(); ++iii) 256 for ( iii = 0; iii < t.count(); ++iii)
257 l.append( t[iii] ); 257 l.append( t[iii] );
258 t = mData->categories; 258 t = mData->categories;
259 t.sort(); 259 t.sort();
260 for ( iii = 0; iii < t.count(); ++iii) 260 for ( iii = 0; iii < t.count(); ++iii)
261 l.append( t[iii] ); 261 l.append( t[iii] );
262 t = mData->custom; 262 t = mData->custom;
263 t.sort(); 263 t.sort();
264 for ( iii = 0; iii < t.count(); ++iii) 264 for ( iii = 0; iii < t.count(); ++iii)
265 l.append( t[iii] ); 265 l.append( t[iii] );
266 KABC::Address::List::Iterator addressIter; 266 KABC::Address::List::Iterator addressIter;
267 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 267 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
268 ++addressIter ) { 268 ++addressIter ) {
269 t = (*addressIter).asList(); 269 t = (*addressIter).asList();
270 t.sort(); 270 t.sort();
271 for ( iii = 0; iii < t.count(); ++iii) 271 for ( iii = 0; iii < t.count(); ++iii)
272 l.append( t[iii] ); 272 l.append( t[iii] );
273 } 273 }
274 uint cs = getCsum4List(l); 274 uint cs = getCsum4List(l);
275 // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); 275 // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
276 setCsum( dev, QString::number (cs )); 276 setCsum( dev, QString::number (cs ));
277} 277}
278 278
279void Addressee::mergeContact( const Addressee& ad ) 279void Addressee::mergeContact( const Addressee& ad )
280{ 280{
281 281
282 detach(); 282 detach();
283 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 283 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
284 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 284 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
285 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 285 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
286 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 286 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
287 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 287 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
288 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; 288 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
289 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; 289 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
290 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; 290 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
291 if ( !mData->birthday.isValid() ) 291 if ( !mData->birthday.isValid() )
292 if ( ad.mData->birthday.isValid()) 292 if ( ad.mData->birthday.isValid())
293 mData->birthday = ad.mData->birthday; 293 mData->birthday = ad.mData->birthday;
294 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 294 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
295 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 295 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
296 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 296 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
297 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 297 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
298 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 298 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
299 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 299 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
300 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; 300 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
301 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; 301 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
302 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; 302 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
303 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; 303 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
304 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; 304 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
305 305
306 // pending: 306 // pending:
307 // merging phonenumbers 307 // merging phonenumbers
308 // merging addresses 308 // merging addresses
309 // merging emails; 309 // merging emails;
310 // merging categories; 310 // merging categories;
311 // merging custom; 311 // merging custom;
312 // merging keys 312 // merging keys
313 qDebug("merge contact %s ", ad.uid().latin1()); 313 qDebug("merge contact %s ", ad.uid().latin1());
314 setUid( ad.uid() ); 314 setUid( ad.uid() );
315 setRevision( ad.revision() ); 315 setRevision( ad.revision() );
316} 316}
317 317
318void Addressee::simplifyAddresses()
319{
320 if ( mData->addresses.count() < 3 ) return ;
321 int count = 0;
322 Address::List list;
323 Address::List::Iterator it;
324 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
325 if ( count > 1 )
326 list.append( *it );
327 ++count;
328 }
329 for( it = list.begin(); it != list.end(); ++it ) {
330 removeAddress( (*it) );
331 }
332}
333
318// removes all emails but the first 334// removes all emails but the first
319// needed by phone sync 335// needed by phone sync
320void Addressee::simplifyEmails() 336void Addressee::simplifyEmails()
321{ 337{
322 if ( mData->emails.count() == 0 ) return ; 338 if ( mData->emails.count() == 0 ) return ;
323 QString email = mData->emails.first(); 339 QString email = mData->emails.first();
324 detach(); 340 detach();
325 mData->emails.clear(); 341 mData->emails.clear();
326 mData->emails.append( email ); 342 mData->emails.append( email );
327} 343}
328 344
329void Addressee::simplifyPhoneNumbers() 345void Addressee::simplifyPhoneNumbers()
330{ 346{
331 KABC::PhoneNumber::List removeNumbers; 347 KABC::PhoneNumber::List removeNumbers;
332 KABC::PhoneNumber::List::Iterator phoneIter; 348 KABC::PhoneNumber::List::Iterator phoneIter;
333 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 349 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
334 ++phoneIter ) { 350 ++phoneIter ) {
335 if ( ! ( *phoneIter ).simplifyNumber() ) 351 if ( ! ( *phoneIter ).simplifyNumber() )
336 removeNumbers.append( ( *phoneIter ) ); 352 removeNumbers.append( ( *phoneIter ) );
337 } 353 }
338 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 354 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
339 ++phoneIter ) { 355 ++phoneIter ) {
340 removePhoneNumber(( *phoneIter )); 356 removePhoneNumber(( *phoneIter ));
341 } 357 }
342} 358}
343void Addressee::simplifyPhoneNumberTypes() 359void Addressee::simplifyPhoneNumberTypes()
344{ 360{
345 KABC::PhoneNumber::List::Iterator phoneIter; 361 KABC::PhoneNumber::List::Iterator phoneIter;
346 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 362 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
347 ++phoneIter ) 363 ++phoneIter )
348 ( *phoneIter ).simplifyType(); 364 ( *phoneIter ).simplifyType();
349} 365}
350void Addressee::removeID(const QString &prof) 366void Addressee::removeID(const QString &prof)
351{ 367{
352 detach(); 368 detach();
353 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 369 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
354 370
355} 371}
356void Addressee::setID( const QString & prof , const QString & id ) 372void Addressee::setID( const QString & prof , const QString & id )
357{ 373{
358 detach(); 374 detach();
359 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 375 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
360 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 376 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
361} 377}
362void Addressee::setTempSyncStat( int id ) 378void Addressee::setTempSyncStat( int id )
363{ 379{
364 if ( mData->mTempSyncStat == id ) return; 380 if ( mData->mTempSyncStat == id ) return;
365 detach(); 381 detach();
366 mData->mTempSyncStat = id; 382 mData->mTempSyncStat = id;
367} 383}
368int Addressee::tempSyncStat() const 384int Addressee::tempSyncStat() const
369{ 385{
370 return mData->mTempSyncStat; 386 return mData->mTempSyncStat;
371} 387}
372 388
373QString Addressee::getID( const QString & prof) 389QString Addressee::getID( const QString & prof)
374{ 390{
375 return KIdManager::getId ( mData->mExternalId, prof ); 391 return KIdManager::getId ( mData->mExternalId, prof );
376} 392}
377 393
378void Addressee::setCsum( const QString & prof , const QString & id ) 394void Addressee::setCsum( const QString & prof , const QString & id )
379{ 395{
380 detach(); 396 detach();
381 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 397 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
382 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); 398 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
383 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); 399 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
384} 400}
385 401
386QString Addressee::getCsum( const QString & prof) 402QString Addressee::getCsum( const QString & prof)
387{ 403{
388 return KIdManager::getCsum ( mData->mExternalId, prof ); 404 return KIdManager::getCsum ( mData->mExternalId, prof );
389} 405}
390 406
391void Addressee::setIDStr( const QString & s ) 407void Addressee::setIDStr( const QString & s )
392{ 408{
393 detach(); 409 detach();
394 mData->mExternalId = s; 410 mData->mExternalId = s;
395} 411}
396 412
397QString Addressee::IDStr() const 413QString Addressee::IDStr() const
398{ 414{
399 return mData->mExternalId; 415 return mData->mExternalId;
400} 416}
401 417
402void Addressee::setExternalUID( const QString &id ) 418void Addressee::setExternalUID( const QString &id )
403{ 419{
404 if ( id == mData->externalUID ) return; 420 if ( id == mData->externalUID ) return;
405 detach(); 421 detach();
406 mData->empty = false; 422 mData->empty = false;
407 mData->externalUID = id; 423 mData->externalUID = id;
408} 424}
409 425
410QString Addressee::externalUID() const 426QString Addressee::externalUID() const
411{ 427{
412 return mData->externalUID; 428 return mData->externalUID;
413} 429}
414void Addressee::setOriginalExternalUID( const QString &id ) 430void Addressee::setOriginalExternalUID( const QString &id )
415{ 431{
416 if ( id == mData->originalExternalUID ) return; 432 if ( id == mData->originalExternalUID ) return;
417 detach(); 433 detach();
418 mData->empty = false; 434 mData->empty = false;
419 //qDebug("*******Set orig uid %s ", id.latin1()); 435 //qDebug("*******Set orig uid %s ", id.latin1());
420 mData->originalExternalUID = id; 436 mData->originalExternalUID = id;
421} 437}
422 438
423QString Addressee::originalExternalUID() const 439QString Addressee::originalExternalUID() const
424{ 440{
425 return mData->originalExternalUID; 441 return mData->originalExternalUID;
426} 442}
427 443
428void Addressee::setUid( const QString &id ) 444void Addressee::setUid( const QString &id )
429{ 445{
430 if ( id == mData->uid ) return; 446 if ( id == mData->uid ) return;
431 detach(); 447 detach();
432 //qDebug("****setuid %s ", id.latin1()); 448 //qDebug("****setuid %s ", id.latin1());
433 mData->empty = false; 449 mData->empty = false;
434 mData->uid = id; 450 mData->uid = id;
435} 451}
436 452
437QString Addressee::uid() const 453QString Addressee::uid() const
438{ 454{
439 if ( mData->uid.isEmpty() ) 455 if ( mData->uid.isEmpty() )
440 mData->uid = KApplication::randomString( 10 ); 456 mData->uid = KApplication::randomString( 10 );
441 457
442 return mData->uid; 458 return mData->uid;
443} 459}
444 460
445QString Addressee::uidLabel() 461QString Addressee::uidLabel()
446{ 462{
447 return i18n("Unique Identifier"); 463 return i18n("Unique Identifier");
448} 464}
449 465
450void Addressee::setName( const QString &name ) 466void Addressee::setName( const QString &name )
451{ 467{
452 if ( name == mData->name ) return; 468 if ( name == mData->name ) return;
453 detach(); 469 detach();
454 mData->empty = false; 470 mData->empty = false;
455 mData->name = name; 471 mData->name = name;
456} 472}
457 473
458QString Addressee::name() const 474QString Addressee::name() const
459{ 475{
460 return mData->name; 476 return mData->name;
461} 477}
462 478
463QString Addressee::nameLabel() 479QString Addressee::nameLabel()
464{ 480{
465 return i18n("Name"); 481 return i18n("Name");
466} 482}
467 483
468 484
469void Addressee::setFormattedName( const QString &formattedName ) 485void Addressee::setFormattedName( const QString &formattedName )
470{ 486{
471 if ( formattedName == mData->formattedName ) return; 487 if ( formattedName == mData->formattedName ) return;
472 detach(); 488 detach();
473 mData->empty = false; 489 mData->empty = false;
474 mData->formattedName = formattedName; 490 mData->formattedName = formattedName;
475} 491}
476 492
477QString Addressee::formattedName() const 493QString Addressee::formattedName() const
478{ 494{
479 return mData->formattedName; 495 return mData->formattedName;
480} 496}
481 497
482QString Addressee::formattedNameLabel() 498QString Addressee::formattedNameLabel()
483{ 499{
484 return i18n("Formatted Name"); 500 return i18n("Formatted Name");
485} 501}
486 502
487 503
488void Addressee::setFamilyName( const QString &familyName ) 504void Addressee::setFamilyName( const QString &familyName )
489{ 505{
490 if ( familyName == mData->familyName ) return; 506 if ( familyName == mData->familyName ) return;
491 detach(); 507 detach();
492 mData->empty = false; 508 mData->empty = false;
493 mData->familyName = familyName; 509 mData->familyName = familyName;
494} 510}
495 511
496QString Addressee::familyName() const 512QString Addressee::familyName() const
497{ 513{
498 return mData->familyName; 514 return mData->familyName;
499} 515}
500 516
501QString Addressee::familyNameLabel() 517QString Addressee::familyNameLabel()
502{ 518{
503 return i18n("Family Name"); 519 return i18n("Family Name");
504} 520}
505 521
506 522
507void Addressee::setGivenName( const QString &givenName ) 523void Addressee::setGivenName( const QString &givenName )
508{ 524{
509 if ( givenName == mData->givenName ) return; 525 if ( givenName == mData->givenName ) return;
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 4cafa86..44f0629 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -1,312 +1,313 @@
1/*** Warning! This file has been generated by the script makeaddressee ***/ 1/*** Warning! This file has been generated by the script makeaddressee ***/
2/* 2/*
3 This file is part of libkabc. 3 This file is part of libkabc.
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22/* 22/*
23Enhanced Version of the file for platform independent KDE tools. 23Enhanced Version of the file for platform independent KDE tools.
24Copyright (c) 2004 Ulf Schenk 24Copyright (c) 2004 Ulf Schenk
25 25
26$Id$ 26$Id$
27*/ 27*/
28 28
29#ifndef KABC_ADDRESSEE_H 29#ifndef KABC_ADDRESSEE_H
30#define KABC_ADDRESSEE_H 30#define KABC_ADDRESSEE_H
31 31
32#include <qdatetime.h> 32#include <qdatetime.h>
33#include <qstring.h> 33#include <qstring.h>
34#include <qstringlist.h> 34#include <qstringlist.h>
35#include <qvaluelist.h> 35#include <qvaluelist.h>
36 36
37#include <ksharedptr.h> 37#include <ksharedptr.h>
38#include <kurl.h> 38#include <kurl.h>
39 39
40#include "address.h" 40#include "address.h"
41#include "agent.h" 41#include "agent.h"
42#include "geo.h" 42#include "geo.h"
43#include "key.h" 43#include "key.h"
44#include "phonenumber.h" 44#include "phonenumber.h"
45#include "picture.h" 45#include "picture.h"
46#include "secrecy.h" 46#include "secrecy.h"
47#include "sound.h" 47#include "sound.h"
48#include "timezone.h" 48#include "timezone.h"
49 49
50namespace KABC { 50namespace KABC {
51 51
52class Resource; 52class Resource;
53 53
54/** 54/**
55 @short address book entry 55 @short address book entry
56 56
57 This class represents an entry in the address book. 57 This class represents an entry in the address book.
58 58
59 The data of this class is implicitly shared. You can pass this class by value. 59 The data of this class is implicitly shared. You can pass this class by value.
60 60
61 If you need the name of a field for presenting it to the user you should use 61 If you need the name of a field for presenting it to the user you should use
62 the functions ending in Label(). They return a translated string which can be 62 the functions ending in Label(). They return a translated string which can be
63 used as label for the corresponding field. 63 used as label for the corresponding field.
64 64
65 About the name fields: 65 About the name fields:
66 66
67 givenName() is the first name and familyName() the last name. In some 67 givenName() is the first name and familyName() the last name. In some
68 countries the family name comes first, that's the reason for the 68 countries the family name comes first, that's the reason for the
69 naming. formattedName() is the full name with the correct formatting. 69 naming. formattedName() is the full name with the correct formatting.
70 It is used as an override, when the correct formatting can't be generated 70 It is used as an override, when the correct formatting can't be generated
71 from the other name fields automatically. 71 from the other name fields automatically.
72 72
73 realName() returns a fully formatted name(). It uses formattedName, if set, 73 realName() returns a fully formatted name(). It uses formattedName, if set,
74 otherwise it constucts the name from the name fields. As fallback, if 74 otherwise it constucts the name from the name fields. As fallback, if
75 nothing else is set it uses name(). 75 nothing else is set it uses name().
76 76
77 name() is the NAME type of RFC2426. It can be used as internal name for the 77 name() is the NAME type of RFC2426. It can be used as internal name for the
78 data enty, but shouldn't be used for displaying the data to the user. 78 data enty, but shouldn't be used for displaying the data to the user.
79 */ 79 */
80class Addressee 80class Addressee
81{ 81{
82 friend QDataStream &operator<<( QDataStream &, const Addressee & ); 82 friend QDataStream &operator<<( QDataStream &, const Addressee & );
83 friend QDataStream &operator>>( QDataStream &, Addressee & ); 83 friend QDataStream &operator>>( QDataStream &, Addressee & );
84 84
85 public: 85 public:
86 typedef QValueList<Addressee> List; 86 typedef QValueList<Addressee> List;
87 87
88 /** 88 /**
89 Construct an empty address book entry. 89 Construct an empty address book entry.
90 */ 90 */
91 Addressee(); 91 Addressee();
92 ~Addressee(); 92 ~Addressee();
93 93
94 Addressee( const Addressee & ); 94 Addressee( const Addressee & );
95 Addressee &operator=( const Addressee & ); 95 Addressee &operator=( const Addressee & );
96 96
97 bool operator==( const Addressee & ) const; 97 bool operator==( const Addressee & ) const;
98 bool operator!=( const Addressee & ) const; 98 bool operator!=( const Addressee & ) const;
99 // sync stuff 99 // sync stuff
100 void setTempSyncStat(int id); 100 void setTempSyncStat(int id);
101 int tempSyncStat() const; 101 int tempSyncStat() const;
102 void setIDStr( const QString & ); 102 void setIDStr( const QString & );
103 QString IDStr() const; 103 QString IDStr() const;
104 void setID( const QString &, const QString & ); 104 void setID( const QString &, const QString & );
105 QString getID( const QString & ); 105 QString getID( const QString & );
106 void setCsum( const QString &, const QString & ); 106 void setCsum( const QString &, const QString & );
107 QString getCsum( const QString & ); 107 QString getCsum( const QString & );
108 void removeID(const QString &); 108 void removeID(const QString &);
109 void computeCsum(const QString &dev); 109 void computeCsum(const QString &dev);
110 ulong getCsum4List( const QStringList & attList); 110 ulong getCsum4List( const QStringList & attList);
111 /** 111 /**
112 Return, if the address book entry is empty. 112 Return, if the address book entry is empty.
113 */ 113 */
114 bool isEmpty() const; 114 bool isEmpty() const;
115 void setExternalUID( const QString &id ); 115 void setExternalUID( const QString &id );
116 QString externalUID() const; 116 QString externalUID() const;
117 void setOriginalExternalUID( const QString &id ); 117 void setOriginalExternalUID( const QString &id );
118 QString originalExternalUID() const; 118 QString originalExternalUID() const;
119 void mergeContact( const Addressee& ad ); 119 void mergeContact( const Addressee& ad );
120 void simplifyEmails(); 120 void simplifyEmails();
121 void simplifyAddresses();
121 void simplifyPhoneNumbers(); 122 void simplifyPhoneNumbers();
122 void simplifyPhoneNumberTypes(); 123 void simplifyPhoneNumberTypes();
123 124
124 /** 125 /**
125 Set unique identifier. 126 Set unique identifier.
126 */ 127 */
127 void setUid( const QString &uid ); 128 void setUid( const QString &uid );
128 /** 129 /**
129 Return unique identifier. 130 Return unique identifier.
130 */ 131 */
131 QString uid() const; 132 QString uid() const;
132 /** 133 /**
133 Return translated label for uid field. 134 Return translated label for uid field.
134 */ 135 */
135 static QString uidLabel(); 136 static QString uidLabel();
136 137
137 /** 138 /**
138 Set name. 139 Set name.
139 */ 140 */
140 void setName( const QString &name ); 141 void setName( const QString &name );
141 /** 142 /**
142 Return name. 143 Return name.
143 */ 144 */
144 QString name() const; 145 QString name() const;
145 /** 146 /**
146 Return translated label for name field. 147 Return translated label for name field.
147 */ 148 */
148 static QString nameLabel(); 149 static QString nameLabel();
149 150
150 /** 151 /**
151 Set formatted name. 152 Set formatted name.
152 */ 153 */
153 void setFormattedName( const QString &formattedName ); 154 void setFormattedName( const QString &formattedName );
154 /** 155 /**
155 Return formatted name. 156 Return formatted name.
156 */ 157 */
157 QString formattedName() const; 158 QString formattedName() const;
158 /** 159 /**
159 Return translated label for formattedName field. 160 Return translated label for formattedName field.
160 */ 161 */
161 static QString formattedNameLabel(); 162 static QString formattedNameLabel();
162 163
163 /** 164 /**
164 Set family name. 165 Set family name.
165 */ 166 */
166 void setFamilyName( const QString &familyName ); 167 void setFamilyName( const QString &familyName );
167 /** 168 /**
168 Return family name. 169 Return family name.
169 */ 170 */
170 QString familyName() const; 171 QString familyName() const;
171 /** 172 /**
172 Return translated label for familyName field. 173 Return translated label for familyName field.
173 */ 174 */
174 static QString familyNameLabel(); 175 static QString familyNameLabel();
175 176
176 /** 177 /**
177 Set given name. 178 Set given name.
178 */ 179 */
179 void setGivenName( const QString &givenName ); 180 void setGivenName( const QString &givenName );
180 /** 181 /**
181 Return given name. 182 Return given name.
182 */ 183 */
183 QString givenName() const; 184 QString givenName() const;
184 /** 185 /**
185 Return translated label for givenName field. 186 Return translated label for givenName field.
186 */ 187 */
187 static QString givenNameLabel(); 188 static QString givenNameLabel();
188 189
189 /** 190 /**
190 Set additional names. 191 Set additional names.
191 */ 192 */
192 void setAdditionalName( const QString &additionalName ); 193 void setAdditionalName( const QString &additionalName );
193 /** 194 /**
194 Return additional names. 195 Return additional names.
195 */ 196 */
196 QString additionalName() const; 197 QString additionalName() const;
197 /** 198 /**
198 Return translated label for additionalName field. 199 Return translated label for additionalName field.
199 */ 200 */
200 static QString additionalNameLabel(); 201 static QString additionalNameLabel();
201 202
202 /** 203 /**
203 Set honorific prefixes. 204 Set honorific prefixes.
204 */ 205 */
205 void setPrefix( const QString &prefix ); 206 void setPrefix( const QString &prefix );
206 /** 207 /**
207 Return honorific prefixes. 208 Return honorific prefixes.
208 */ 209 */
209 QString prefix() const; 210 QString prefix() const;
210 /** 211 /**
211 Return translated label for prefix field. 212 Return translated label for prefix field.
212 */ 213 */
213 static QString prefixLabel(); 214 static QString prefixLabel();
214 215
215 /** 216 /**
216 Set honorific suffixes. 217 Set honorific suffixes.
217 */ 218 */
218 void setSuffix( const QString &suffix ); 219 void setSuffix( const QString &suffix );
219 /** 220 /**
220 Return honorific suffixes. 221 Return honorific suffixes.
221 */ 222 */
222 QString suffix() const; 223 QString suffix() const;
223 /** 224 /**
224 Return translated label for suffix field. 225 Return translated label for suffix field.
225 */ 226 */
226 static QString suffixLabel(); 227 static QString suffixLabel();
227 228
228 /** 229 /**
229 Set nick name. 230 Set nick name.
230 */ 231 */
231 void setNickName( const QString &nickName ); 232 void setNickName( const QString &nickName );
232 /** 233 /**
233 Return nick name. 234 Return nick name.
234 */ 235 */
235 QString nickName() const; 236 QString nickName() const;
236 /** 237 /**
237 Return translated label for nickName field. 238 Return translated label for nickName field.
238 */ 239 */
239 static QString nickNameLabel(); 240 static QString nickNameLabel();
240 241
241 /** 242 /**
242 Set birthday. 243 Set birthday.
243 */ 244 */
244 void setBirthday( const QDateTime &birthday ); 245 void setBirthday( const QDateTime &birthday );
245 /** 246 /**
246 Return birthday. 247 Return birthday.
247 */ 248 */
248 QDateTime birthday() const; 249 QDateTime birthday() const;
249 /** 250 /**
250 Return translated label for birthday field. 251 Return translated label for birthday field.
251 */ 252 */
252 static QString birthdayLabel(); 253 static QString birthdayLabel();
253 254
254 /** 255 /**
255 Return translated label for homeAddressStreet field. 256 Return translated label for homeAddressStreet field.
256 */ 257 */
257 static QString homeAddressStreetLabel(); 258 static QString homeAddressStreetLabel();
258 259
259 /** 260 /**
260 Return translated label for homeAddressLocality field. 261 Return translated label for homeAddressLocality field.
261 */ 262 */
262 static QString homeAddressLocalityLabel(); 263 static QString homeAddressLocalityLabel();
263 264
264 /** 265 /**
265 Return translated label for homeAddressRegion field. 266 Return translated label for homeAddressRegion field.
266 */ 267 */
267 static QString homeAddressRegionLabel(); 268 static QString homeAddressRegionLabel();
268 269
269 /** 270 /**
270 Return translated label for homeAddressPostalCode field. 271 Return translated label for homeAddressPostalCode field.
271 */ 272 */
272 static QString homeAddressPostalCodeLabel(); 273 static QString homeAddressPostalCodeLabel();
273 274
274 /** 275 /**
275 Return translated label for homeAddressCountry field. 276 Return translated label for homeAddressCountry field.
276 */ 277 */
277 static QString homeAddressCountryLabel(); 278 static QString homeAddressCountryLabel();
278 279
279 /** 280 /**
280 Return translated label for homeAddressLabel field. 281 Return translated label for homeAddressLabel field.
281 */ 282 */
282 static QString homeAddressLabelLabel(); 283 static QString homeAddressLabelLabel();
283 284
284 /** 285 /**
285 Return translated label for businessAddressStreet field. 286 Return translated label for businessAddressStreet field.
286 */ 287 */
287 static QString businessAddressStreetLabel(); 288 static QString businessAddressStreetLabel();
288 289
289 /** 290 /**
290 Return translated label for businessAddressLocality field. 291 Return translated label for businessAddressLocality field.
291 */ 292 */
292 static QString businessAddressLocalityLabel(); 293 static QString businessAddressLocalityLabel();
293 294
294 /** 295 /**
295 Return translated label for businessAddressRegion field. 296 Return translated label for businessAddressRegion field.
296 */ 297 */
297 static QString businessAddressRegionLabel(); 298 static QString businessAddressRegionLabel();
298 299
299 /** 300 /**
300 Return translated label for businessAddressPostalCode field. 301 Return translated label for businessAddressPostalCode field.
301 */ 302 */
302 static QString businessAddressPostalCodeLabel(); 303 static QString businessAddressPostalCodeLabel();
303 304
304 /** 305 /**
305 Return translated label for businessAddressCountry field. 306 Return translated label for businessAddressCountry field.
306 */ 307 */
307 static QString businessAddressCountryLabel(); 308 static QString businessAddressCountryLabel();
308 309
309 /** 310 /**
310 Return translated label for businessAddressLabel field. 311 Return translated label for businessAddressLabel field.
311 */ 312 */
312 static QString businessAddressLabelLabel(); 313 static QString businessAddressLabelLabel();