summaryrefslogtreecommitdiffabout
path: root/kabc/addressee.cpp
Unidiff
Diffstat (limited to 'kabc/addressee.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index e8e440c..9994e29 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -1,1930 +1,1930 @@
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#include <kconfig.h> 29#include <kconfig.h>
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 <kmessagebox.h> 35#include <kmessagebox.h>
36#include <kidmanager.h> 36#include <kidmanager.h>
37//US 37//US
38#include <kstandarddirs.h> 38#include <kstandarddirs.h>
39#include <libkcal/syncdefines.h> 39#include <libkcal/syncdefines.h>
40 40
41//US #include "resource.h" 41//US #include "resource.h"
42#include "addressee.h" 42#include "addressee.h"
43 43
44using namespace KABC; 44using namespace KABC;
45 45
46static bool matchBinaryPattern( int value, int pattern ); 46static bool matchBinaryPattern( int value, int pattern );
47static bool matchBinaryPatternA( int value, int pattern ); 47static bool matchBinaryPatternA( int value, int pattern );
48static bool matchBinaryPatternP( int value, int pattern ); 48static bool matchBinaryPatternP( int value, int pattern );
49 49
50struct Addressee::AddresseeData : public KShared 50struct Addressee::AddresseeData : public KShared
51{ 51{
52 QString uid; 52 QString uid;
53 QString name; 53 QString name;
54 QString formattedName; 54 QString formattedName;
55 QString familyName; 55 QString familyName;
56 QString givenName; 56 QString givenName;
57 QString additionalName; 57 QString additionalName;
58 QString prefix; 58 QString prefix;
59 QString suffix; 59 QString suffix;
60 QString nickName; 60 QString nickName;
61 QDateTime birthday; 61 QDateTime birthday;
62 QString mailer; 62 QString mailer;
63 TimeZone timeZone; 63 TimeZone timeZone;
64 Geo geo; 64 Geo geo;
65 QString title; 65 QString title;
66 QString role; 66 QString role;
67 QString organization; 67 QString organization;
68 QString note; 68 QString note;
69 QString productId; 69 QString productId;
70 QDateTime revision; 70 QDateTime revision;
71 QString sortString; 71 QString sortString;
72 QString externalUID; 72 QString externalUID;
73 QString originalExternalUID; 73 QString originalExternalUID;
74 KURL url; 74 KURL url;
75 Secrecy secrecy; 75 Secrecy secrecy;
76 Picture logo; 76 Picture logo;
77 Picture photo; 77 Picture photo;
78 Sound sound; 78 Sound sound;
79 Agent agent; 79 Agent agent;
80 QString mExternalId; 80 QString mExternalId;
81 PhoneNumber::List phoneNumbers; 81 PhoneNumber::List phoneNumbers;
82 Address::List addresses; 82 Address::List addresses;
83 Key::List keys; 83 Key::List keys;
84 QStringList emails; 84 QStringList emails;
85 QStringList categories; 85 QStringList categories;
86 QStringList custom; 86 QStringList custom;
87 int mTempSyncStat; 87 int mTempSyncStat;
88 Resource *resource; 88 Resource *resource;
89 89
90 bool empty :1; 90 bool empty :1;
91 bool changed :1; 91 bool changed :1;
92 bool tagged :1; 92 bool tagged :1;
93}; 93};
94 94
95Addressee::Addressee() 95Addressee::Addressee()
96{ 96{
97 mData = new AddresseeData; 97 mData = new AddresseeData;
98 mData->empty = true; 98 mData->empty = true;
99 mData->changed = false; 99 mData->changed = false;
100 mData->resource = 0; 100 mData->resource = 0;
101 mData->mExternalId = ":"; 101 mData->mExternalId = ":";
102 mData->revision = QDateTime ( QDate( 2003,1,1)); 102 mData->revision = QDateTime ( QDate( 2003,1,1));
103 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; 103 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
104} 104}
105 105
106Addressee::~Addressee() 106Addressee::~Addressee()
107{ 107{
108} 108}
109 109
110Addressee::Addressee( const Addressee &a ) 110Addressee::Addressee( const Addressee &a )
111{ 111{
112 mData = a.mData; 112 mData = a.mData;
113} 113}
114 114
115Addressee &Addressee::operator=( const Addressee &a ) 115Addressee &Addressee::operator=( const Addressee &a )
116{ 116{
117 mData = a.mData; 117 mData = a.mData;
118 return (*this); 118 return (*this);
119} 119}
120 120
121Addressee Addressee::copy() 121Addressee Addressee::copy()
122{ 122{
123 Addressee a; 123 Addressee a;
124 *(a.mData) = *mData; 124 *(a.mData) = *mData;
125 return a; 125 return a;
126} 126}
127 127
128void Addressee::detach() 128void Addressee::detach()
129{ 129{
130 if ( mData.count() == 1 ) return; 130 if ( mData.count() == 1 ) return;
131 *this = copy(); 131 *this = copy();
132} 132}
133 133
134bool Addressee::operator==( const Addressee &a ) const 134bool Addressee::operator==( const Addressee &a ) const
135{ 135{
136 if ( uid() != a.uid() ) return false; 136 if ( uid() != a.uid() ) return false;
137 if ( mData->name != a.mData->name ) return false; 137 if ( mData->name != a.mData->name ) return false;
138 if ( mData->formattedName != a.mData->formattedName ) return false; 138 if ( mData->formattedName != a.mData->formattedName ) return false;
139 if ( mData->familyName != a.mData->familyName ) return false; 139 if ( mData->familyName != a.mData->familyName ) return false;
140 if ( mData->givenName != a.mData->givenName ) return false; 140 if ( mData->givenName != a.mData->givenName ) return false;
141 if ( mData->additionalName != a.mData->additionalName ) return false; 141 if ( mData->additionalName != a.mData->additionalName ) return false;
142 if ( mData->prefix != a.mData->prefix ) return false; 142 if ( mData->prefix != a.mData->prefix ) return false;
143 if ( mData->suffix != a.mData->suffix ) return false; 143 if ( mData->suffix != a.mData->suffix ) return false;
144 if ( mData->nickName != a.mData->nickName ) return false; 144 if ( mData->nickName != a.mData->nickName ) return false;
145 if ( mData->birthday != a.mData->birthday ) return false; 145 if ( mData->birthday != a.mData->birthday ) return false;
146 if ( mData->mailer != a.mData->mailer ) return false; 146 if ( mData->mailer != a.mData->mailer ) return false;
147 if ( mData->timeZone != a.mData->timeZone ) return false; 147 if ( mData->timeZone != a.mData->timeZone ) return false;
148 if ( mData->geo != a.mData->geo ) return false; 148 if ( mData->geo != a.mData->geo ) return false;
149 if ( mData->title != a.mData->title ) return false; 149 if ( mData->title != a.mData->title ) return false;
150 if ( mData->role != a.mData->role ) return false; 150 if ( mData->role != a.mData->role ) return false;
151 if ( mData->organization != a.mData->organization ) return false; 151 if ( mData->organization != a.mData->organization ) return false;
152 if ( mData->note != a.mData->note ) return false; 152 if ( mData->note != a.mData->note ) return false;
153 if ( mData->productId != a.mData->productId ) return false; 153 if ( mData->productId != a.mData->productId ) return false;
154 //if ( mData->revision != a.mData->revision ) return false; 154 //if ( mData->revision != a.mData->revision ) return false;
155 if ( mData->sortString != a.mData->sortString ) return false; 155 if ( mData->sortString != a.mData->sortString ) return false;
156 if ( mData->secrecy != a.mData->secrecy ) return false; 156 if ( mData->secrecy != a.mData->secrecy ) return false;
157 if ( mData->logo != a.mData->logo ) return false; 157 if ( mData->logo != a.mData->logo ) return false;
158 if ( mData->photo != a.mData->photo ) return false; 158 if ( mData->photo != a.mData->photo ) return false;
159 if ( mData->sound != a.mData->sound ) return false; 159 if ( mData->sound != a.mData->sound ) return false;
160 if ( mData->agent != a.mData->agent ) return false; 160 if ( mData->agent != a.mData->agent ) return false;
161 if ( ( mData->url.isValid() || a.mData->url.isValid() ) && 161 if ( ( mData->url.isValid() || a.mData->url.isValid() ) &&
162 ( mData->url != a.mData->url ) ) return false; 162 ( mData->url != a.mData->url ) ) return false;
163 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; 163 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false;
164 if ( mData->addresses != a.mData->addresses ) return false; 164 if ( mData->addresses != a.mData->addresses ) return false;
165 if ( mData->keys != a.mData->keys ) return false; 165 if ( mData->keys != a.mData->keys ) return false;
166 if ( mData->emails != a.mData->emails ) return false; 166 if ( mData->emails != a.mData->emails ) return false;
167 if ( mData->categories != a.mData->categories ) return false; 167 if ( mData->categories != a.mData->categories ) return false;
168 if ( mData->custom != a.mData->custom ) return false; 168 if ( mData->custom != a.mData->custom ) return false;
169 169
170 return true; 170 return true;
171} 171}
172 172
173bool Addressee::operator!=( const Addressee &a ) const 173bool Addressee::operator!=( const Addressee &a ) const
174{ 174{
175 return !( a == *this ); 175 return !( a == *this );
176} 176}
177 177
178bool Addressee::isEmpty() const 178bool Addressee::isEmpty() const
179{ 179{
180 return mData->empty; 180 return mData->empty;
181} 181}
182ulong Addressee::getCsum4List( const QStringList & attList) 182ulong Addressee::getCsum4List( const QStringList & attList)
183{ 183{
184 int max = attList.count(); 184 int max = attList.count();
185 ulong cSum = 0; 185 ulong cSum = 0;
186 int j,k,i; 186 int j,k,i;
187 int add; 187 int add;
188 for ( i = 0; i < max ; ++i ) { 188 for ( i = 0; i < max ; ++i ) {
189 QString s = attList[i]; 189 QString s = attList[i];
190 if ( ! s.isEmpty() ){ 190 if ( ! s.isEmpty() ){
191 j = s.length(); 191 j = s.length();
192 for ( k = 0; k < j; ++k ) { 192 for ( k = 0; k < j; ++k ) {
193 int mul = k +1; 193 int mul = k +1;
194 add = s[k].unicode (); 194 add = s[k].unicode ();
195 if ( k < 16 ) 195 if ( k < 16 )
196 mul = mul * mul; 196 mul = mul * mul;
197 int ii = i+1; 197 int ii = i+1;
198 add = add * mul *ii*ii*ii; 198 add = add * mul *ii*ii*ii;
199 cSum += add; 199 cSum += add;
200 //qDebug("csum: %d %d %d", i,k,cSum); 200 //qDebug("csum: %d %d %d", i,k,cSum);
201 } 201 }
202 } 202 }
203 203
204 } 204 }
205 //QString dump = attList.join(","); 205 //QString dump = attList.join(",");
206 //qDebug("csum: %d %s", cSum,dump.latin1()); 206 //qDebug("csum: %d %s", cSum,dump.latin1());
207 207
208 return cSum; 208 return cSum;
209 209
210} 210}
211void Addressee::computeCsum(const QString &dev) 211void Addressee::computeCsum(const QString &dev)
212{ 212{
213 QStringList l; 213 QStringList l;
214 //if ( !mData->name.isEmpty() ) l.append(mData->name); 214 //if ( !mData->name.isEmpty() ) l.append(mData->name);
215 if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); 215 if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName );
216 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); 216 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName );
217 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); 217 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName );
218 if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); 218 if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName );
219 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); 219 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix );
220 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); 220 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix );
221 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); 221 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName );
222 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); 222 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() );
223 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); 223 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer );
224 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); 224 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
225 if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); 225 if ( mData->geo.isValid() ) l.append( mData->geo.asString() );
226 if ( !mData->title .isEmpty() ) l.append( mData->title ); 226 if ( !mData->title .isEmpty() ) l.append( mData->title );
227 if ( !mData->role.isEmpty() ) l.append( mData->role ); 227 if ( !mData->role.isEmpty() ) l.append( mData->role );
228 if ( !mData->organization.isEmpty() ) l.append( mData->organization ); 228 if ( !mData->organization.isEmpty() ) l.append( mData->organization );
229 if ( !mData->note.isEmpty() ) l.append( mData->note ); 229 if ( !mData->note.isEmpty() ) l.append( mData->note );
230 if ( !mData->productId.isEmpty() ) l.append(mData->productId ); 230 if ( !mData->productId.isEmpty() ) l.append(mData->productId );
231 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); 231 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString );
232 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); 232 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString());
233 if ( !mData->logo.undefined() ) { 233 if ( !mData->logo.undefined() ) {
234 if ( !mData->logo.isIntern() ) 234 if ( !mData->logo.isIntern() )
235 l.append( mData->logo.url() ); 235 l.append( mData->logo.url() );
236 else 236 else
237 l.append( QString::number(mData->logo.data().width()* mData->logo.data().height())); 237 l.append( QString::number(mData->logo.data().width()* mData->logo.data().height()));
238 } else { 238 } else {
239 l.append( "nologo"); 239 l.append( "nologo");
240 } 240 }
241 if ( !mData->photo.undefined() ) { 241 if ( !mData->photo.undefined() ) {
242 if ( !mData->photo.isIntern() ) 242 if ( !mData->photo.isIntern() )
243 l.append( mData->photo.url() ); 243 l.append( mData->photo.url() );
244 else 244 else
245 l.append( QString::number(mData->photo.data().width()* mData->photo.data().height())); 245 l.append( QString::number(mData->photo.data().width()* mData->photo.data().height()));
246 } else { 246 } else {
247 l.append( "nophoto"); 247 l.append( "nophoto");
248 } 248 }
249#if 0 249#if 0
250 if ( !mData->sound.undefined() ) { 250 if ( !mData->sound.undefined() ) {
251 if ( !mData->sound.isIntern() ) 251 if ( !mData->sound.isIntern() )
252 l.append( mData->sound.url() ); 252 l.append( mData->sound.url() );
253 else 253 else
254 l.append( QString(mData->sound.data().with()* mData->sound.data().height())); 254 l.append( QString(mData->sound.data().with()* mData->sound.data().height()));
255 } else { 255 } else {
256 l.append( "nosound"); 256 l.append( "nosound");
257 } 257 }
258#endif 258#endif
259 //if ( !mData->agent.isEmpty() ) l.append( ); 259 //if ( !mData->agent.isEmpty() ) l.append( );
260 if ( mData->url.isValid() ) 260 if ( mData->url.isValid() )
261 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); 261 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() );
262 KABC::PhoneNumber::List phoneNumbers; 262 KABC::PhoneNumber::List phoneNumbers;
263 KABC::PhoneNumber::List::Iterator phoneIter; 263 KABC::PhoneNumber::List::Iterator phoneIter;
264 264
265 QStringList t; 265 QStringList t;
266 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 266 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
267 ++phoneIter ) 267 ++phoneIter )
268 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); 268 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) );
269 t.sort(); 269 t.sort();
270 uint iii; 270 uint iii;
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 t = mData->emails; 273 t = mData->emails;
274 t.sort(); 274 t.sort();
275 for ( iii = 0; iii < t.count(); ++iii) 275 for ( iii = 0; iii < t.count(); ++iii)
276 l.append( t[iii] ); 276 l.append( t[iii] );
277 t = mData->categories; 277 t = mData->categories;
278 t.sort(); 278 t.sort();
279 for ( iii = 0; iii < t.count(); ++iii) 279 for ( iii = 0; iii < t.count(); ++iii)
280 l.append( t[iii] ); 280 l.append( t[iii] );
281 t = mData->custom; 281 t = mData->custom;
282 t.sort(); 282 t.sort();
283 for ( iii = 0; iii < t.count(); ++iii) 283 for ( iii = 0; iii < t.count(); ++iii)
284 if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) { 284 if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) {
285 int find = t[iii].find (':')+1; 285 int find = t[iii].find (':')+1;
286 //qDebug("lennnn %d %d ", find, t[iii].length()); 286 //qDebug("lennnn %d %d ", find, t[iii].length());
287 if ( find < t[iii].length()) 287 if ( find < t[iii].length())
288 l.append( t[iii] ); 288 l.append( t[iii] );
289 289
290 } 290 }
291 KABC::Address::List::Iterator addressIter; 291 KABC::Address::List::Iterator addressIter;
292 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 292 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
293 ++addressIter ) { 293 ++addressIter ) {
294 t = (*addressIter).asList(); 294 t = (*addressIter).asList();
295 t.sort(); 295 t.sort();
296 for ( iii = 0; iii < t.count(); ++iii) 296 for ( iii = 0; iii < t.count(); ++iii)
297 l.append( t[iii] ); 297 l.append( t[iii] );
298 } 298 }
299 uint cs = getCsum4List(l); 299 uint cs = getCsum4List(l);
300 300
301#if 0 301#if 0
302 for ( iii = 0; iii < l.count(); ++iii) 302 for ( iii = 0; iii < l.count(); ++iii)
303 qDebug("%d***%s***",iii,l[iii].latin1()); 303 qDebug("%d***%s***",iii,l[iii].latin1());
304 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); 304 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
305#endif 305#endif
306 306
307 307
308 setCsum( dev, QString::number (cs )); 308 setCsum( dev, QString::number (cs ));
309} 309}
310bool Addressee::matchAddress( QRegExp* re ) const 310bool Addressee::matchAddress( QRegExp* re ) const
311{ 311{
312 KABC::Address::List::Iterator addressIter; 312 KABC::Address::List::Iterator addressIter;
313 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 313 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
314 ++addressIter ) { 314 ++addressIter ) {
315 if ( (*addressIter).matchAddress( re ) ) 315 if ( (*addressIter).matchAddress( re ) )
316 return true; 316 return true;
317 } 317 }
318 return false; 318 return false;
319} 319}
320bool Addressee::matchPhoneNumber( QRegExp* re ) const 320bool Addressee::matchPhoneNumber( QRegExp* re ) const
321{ 321{
322 KABC::PhoneNumber::List::Iterator phoneIter; 322 KABC::PhoneNumber::List::Iterator phoneIter;
323 323
324 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); ++phoneIter ) { 324 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); ++phoneIter ) {
325#if QT_VERSION >= 0x030000 325#if QT_VERSION >= 0x030000
326 if (re->search( (*phoneIter).number() ) == 0) 326 if (re->search( (*phoneIter).number() ) == 0)
327#else 327#else
328 if (re->match( (*phoneIter).number() ) == 0) 328 if (re->match( (*phoneIter).number() ) == 0)
329#endif 329#endif
330 return true; 330 return true;
331 331
332 } 332 }
333 return false; 333 return false;
334 334
335} 335}
336void Addressee::mergeOLContact( const Addressee& ad ) 336void Addressee::mergeOLContact( const Addressee& ad )
337{ 337{
338 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 338 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
339 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 339 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
340 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 340 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
341 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 341 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
342 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; 342 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo;
343 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; 343 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo;
344 if ( !mData->sound.isIntern() ) { 344 if ( !mData->sound.isIntern() ) {
345 if ( mData->sound.url().isEmpty() ) { 345 if ( mData->sound.url().isEmpty() ) {
346 mData->sound = ad.mData->sound; 346 mData->sound = ad.mData->sound;
347 } 347 }
348 } 348 }
349 if ( !mData->agent.isIntern() ) { 349 if ( !mData->agent.isIntern() ) {
350 if ( mData->agent.url().isEmpty() ) { 350 if ( mData->agent.url().isEmpty() ) {
351 mData->agent = ad.mData->agent; 351 mData->agent = ad.mData->agent;
352 } 352 }
353 } 353 }
354 { 354 {
355 Key::List::Iterator itA; 355 Key::List::Iterator itA;
356 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { 356 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) {
357 bool found = false; 357 bool found = false;
358 Key::List::Iterator it; 358 Key::List::Iterator it;
359 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 359 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
360 if ( (*it) == (*itA)) { 360 if ( (*it) == (*itA)) {
361 found = true; 361 found = true;
362 break; 362 break;
363 363
364 } 364 }
365 } 365 }
366 if ( ! found ) { 366 if ( ! found ) {
367 mData->keys.append( *itA ); 367 mData->keys.append( *itA );
368 } 368 }
369 } 369 }
370 } 370 }
371 371
372 KABC::Address addthis = otherAddress(); 372 KABC::Address addthis = otherAddress();
373 KABC::Address addother = ad.otherAddress(); 373 KABC::Address addother = ad.otherAddress();
374 if ( !addthis.isEmpty() && !addother.isEmpty() ) 374 if ( !addthis.isEmpty() && !addother.isEmpty() )
375 addthis.setType( addother.type() ); 375 addthis.setType( addother.type() );
376 //qDebug("merge contact %s ", ad.uid().latin1()); 376 //qDebug("merge contact %s ", ad.uid().latin1());
377 setUid( ad.uid() ); 377 setUid( ad.uid() );
378 setRevision( ad.revision() ); 378 setRevision( ad.revision() );
379 379
380 380
381} 381}
382 382
383void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) 383void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
384{ 384{
385 // merge all standard non-outlook fields. 385 // merge all standard non-outlook fields.
386 //if isSubSet (e.g. mobile phone sync) merge all fields 386 //if isSubSet (e.g. mobile phone sync) merge all fields
387 387
388 detach(); 388 detach();
389 if ( isSubSet ) { 389 if ( isSubSet ) {
390 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 390 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
391 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 391 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
392 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 392 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
393 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 393 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
394 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 394 if ( mData->additionalName.isEmpty() ) mData->additionalName = ad.mData->additionalName;
395 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; 395 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
396 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; 396 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
397 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 397 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
398 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 398 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
399 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; 399 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
400 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 400 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
401 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; 401 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
402 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; 402 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
403 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; 403 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
404 if ( !mData->birthday.isValid() ) 404 if ( !mData->birthday.isValid() )
405 if ( ad.mData->birthday.isValid()) 405 if ( ad.mData->birthday.isValid())
406 mData->birthday = ad.mData->birthday; 406 mData->birthday = ad.mData->birthday;
407 407
408 } 408 }
409 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 409 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
410 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 410 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
411 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 411 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
412 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; 412 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
413 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; 413 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
414 QStringList t; 414 QStringList t;
415 QStringList tAD; 415 QStringList tAD;
416 uint iii; 416 uint iii;
417 417
418 // ********** phone numbers 418 // ********** phone numbers
419 if ( isSubSet ) { 419 if ( isSubSet ) {
420 PhoneNumber::List phoneAD = ad.phoneNumbers(); 420 PhoneNumber::List phoneAD = ad.phoneNumbers();
421 PhoneNumber::List::Iterator phoneItAD; 421 PhoneNumber::List::Iterator phoneItAD;
422 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { 422 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
423 bool found = false; 423 bool found = false;
424 PhoneNumber::List::Iterator it; 424 PhoneNumber::List::Iterator it;
425 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 425 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
426 if ( ( *phoneItAD ).contains( (*it) ) ) { 426 if ( ( *phoneItAD ).contains( (*it) ) ) {
427 found = true; 427 found = true;
428 (*it).setType( ( *phoneItAD ).type() ); 428 (*it).setType( ( *phoneItAD ).type() );
429 (*it).setNumber( ( *phoneItAD ).number() ); 429 (*it).setNumber( ( *phoneItAD ).number() );
430 break; 430 break;
431 } 431 }
432 } 432 }
433 // if ( isSubSet && ! found ) 433 // if ( isSubSet && ! found )
434 if ( ! found ) // LR try this one... 434 if ( ! found ) // LR try this one...
435 mData->phoneNumbers.append( *phoneItAD ); 435 mData->phoneNumbers.append( *phoneItAD );
436 } 436 }
437 } else { 437 } else {
438 PhoneNumber::List phoneAD = ad.phoneNumbers(); 438 PhoneNumber::List phoneAD = ad.phoneNumbers();
439 PhoneNumber::List::Iterator phoneItAD; 439 PhoneNumber::List::Iterator phoneItAD;
440 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { 440 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
441 bool found = false; 441 bool found = false;
442 PhoneNumber::List::Iterator it; 442 PhoneNumber::List::Iterator it;
443 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 443 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
444 if ( ( *phoneItAD ).contains( (*it) ) ) { 444 if ( ( *phoneItAD ).contains( (*it) ) ) {
445 found = true; 445 found = true;
446 (*it).setType( ( *phoneItAD ).type() ); 446 (*it).setType( ( *phoneItAD ).type() );
447 (*it).setNumber( ( *phoneItAD ).number() ); 447 (*it).setNumber( ( *phoneItAD ).number() );
448 break; 448 break;
449 } 449 }
450 } 450 }
451 if ( ! found ) { // append numbers which do not have work or home type 451 if ( ! found ) { // append numbers which do not have work or home type
452 if ( ! ( ( *phoneItAD ).type() & (PhoneNumber::Work | PhoneNumber::Home) ) ) 452 if ( ! ( ( *phoneItAD ).type() & (PhoneNumber::Work | PhoneNumber::Home) ) )
453 mData->phoneNumbers.append( *phoneItAD ); 453 mData->phoneNumbers.append( *phoneItAD );
454 } 454 }
455 } 455 }
456 } 456 }
457 if ( isSubSet ) { 457 if ( isSubSet ) {
458 // ************* emails; 458 // ************* emails;
459 t = mData->emails; 459 t = mData->emails;
460 tAD = ad.mData->emails; 460 tAD = ad.mData->emails;
461 for ( iii = 0; iii < tAD.count(); ++iii) 461 for ( iii = 0; iii < tAD.count(); ++iii)
462 if ( !t.contains(tAD[iii] ) ) 462 if ( !t.contains(tAD[iii] ) )
463 mData->emails.append( tAD[iii] ); 463 mData->emails.append( tAD[iii] );
464 } 464 }
465 465
466 // ************* categories; 466 // ************* categories;
467 if ( isSubSet ) { 467 if ( isSubSet ) {
468 t = mData->categories; 468 t = mData->categories;
469 tAD = ad.mData->categories; 469 tAD = ad.mData->categories;
470 for ( iii = 0; iii < tAD.count(); ++iii) 470 for ( iii = 0; iii < tAD.count(); ++iii)
471 if ( !t.contains(tAD[iii] ) ) 471 if ( !t.contains(tAD[iii] ) )
472 mData->categories.append( tAD[iii] ); 472 mData->categories.append( tAD[iii] );
473 } 473 }
474 QStringList::ConstIterator it; 474 QStringList::ConstIterator it;
475 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { 475 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) {
476 QString qualifiedName = (*it).left( (*it).find( ":" )); 476 QString qualifiedName = (*it).left( (*it).find( ":" ));
477 bool found = false; 477 bool found = false;
478 QStringList::ConstIterator itL; 478 QStringList::ConstIterator itL;
479 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { 479 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) {
480 if ( (*itL).startsWith( qualifiedName ) ) { 480 if ( (*itL).startsWith( qualifiedName ) ) {
481 found = true; 481 found = true;
482 break; 482 break;
483 } 483 }
484 } 484 }
485 if ( ! found ) { 485 if ( ! found ) {
486 mData->custom.append( *it ); 486 mData->custom.append( *it );
487 } 487 }
488 } 488 }
489 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; 489 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo;
490 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; 490 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo;
491 if ( !mData->sound.isIntern() ) { 491 if ( !mData->sound.isIntern() ) {
492 if ( mData->sound.url().isEmpty() ) { 492 if ( mData->sound.url().isEmpty() ) {
493 mData->sound = ad.mData->sound; 493 mData->sound = ad.mData->sound;
494 } 494 }
495 } 495 }
496 if ( !mData->agent.isIntern() ) { 496 if ( !mData->agent.isIntern() ) {
497 if ( mData->agent.url().isEmpty() ) { 497 if ( mData->agent.url().isEmpty() ) {
498 mData->agent = ad.mData->agent; 498 mData->agent = ad.mData->agent;
499 } 499 }
500 } 500 }
501 { 501 {
502 Key::List::Iterator itA; 502 Key::List::Iterator itA;
503 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { 503 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) {
504 bool found = false; 504 bool found = false;
505 Key::List::Iterator it; 505 Key::List::Iterator it;
506 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 506 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
507 if ( (*it) == (*itA)) { 507 if ( (*it) == (*itA)) {
508 found = true; 508 found = true;
509 break; 509 break;
510 510
511 } 511 }
512 } 512 }
513 if ( ! found ) { 513 if ( ! found ) {
514 mData->keys.append( *itA ); 514 mData->keys.append( *itA );
515 } 515 }
516 } 516 }
517 } 517 }
518 if ( isSubSet ) { 518 if ( isSubSet ) {
519 KABC::Address::List::Iterator addressIterA; 519 KABC::Address::List::Iterator addressIterA;
520 for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { 520 for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) {
521 bool found = false; 521 bool found = false;
522 KABC::Address::List::Iterator addressIter; 522 KABC::Address::List::Iterator addressIter;
523 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 523 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
524 ++addressIter ) { 524 ++addressIter ) {
525 if ( (*addressIter) == (*addressIterA)) { 525 if ( (*addressIter) == (*addressIterA)) {
526 found = true; 526 found = true;
527 (*addressIter).setType( (*addressIterA).type() ); 527 (*addressIter).setType( (*addressIterA).type() );
528 break; 528 break;
529 } 529 }
530 530
531 } 531 }
532 if ( isSubSet && ! found ) { 532 if ( isSubSet && ! found ) {
533 mData->addresses.append( *addressIterA ); 533 mData->addresses.append( *addressIterA );
534 } 534 }
535 } 535 }
536 } 536 }
537 //qDebug("merge contact %s ", ad.uid().latin1()); 537 //qDebug("merge contact %s ", ad.uid().latin1());
538 setUid( ad.uid() ); 538 setUid( ad.uid() );
539 setRevision( ad.revision() ); 539 setRevision( ad.revision() );
540} 540}
541 541
542bool Addressee::removeVoice() 542bool Addressee::removeVoice()
543{ 543{
544 PhoneNumber::List phoneN = phoneNumbers(); 544 PhoneNumber::List phoneN = phoneNumbers();
545 PhoneNumber::List::Iterator phoneIt; 545 PhoneNumber::List::Iterator phoneIt;
546 bool found = false; 546 bool found = false;
547 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { 547 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
548 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 548 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
549 if ((*phoneIt).type() - PhoneNumber::Voice ) { 549 if ((*phoneIt).type() - PhoneNumber::Voice ) {
550 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 550 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
551 insertPhoneNumber( (*phoneIt) ); 551 insertPhoneNumber( (*phoneIt) );
552 found = true; 552 found = true;
553 } 553 }
554 } 554 }
555 555
556 } 556 }
557 return found; 557 return found;
558} 558}
559 559
560bool Addressee::containsAdr(const Addressee& ad ) 560bool Addressee::containsAdr(const Addressee& ad )
561{ 561{
562 if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; 562 if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false;
563 if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; 563 if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false;
564 if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; 564 if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ;
565 if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; 565 if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ;
566 if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; 566 if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ;
567 if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; 567 if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ;
568 if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; 568 if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ;
569 569
570 // compare phone numbers 570 // compare phone numbers
571 PhoneNumber::List phoneN = ad.phoneNumbers(); 571 PhoneNumber::List phoneN = ad.phoneNumbers();
572 PhoneNumber::List::Iterator phoneIt; 572 PhoneNumber::List::Iterator phoneIt;
573 bool found = false; 573 bool found = false;
574 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { 574 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
575 bool found = false; 575 bool found = false;
576 PhoneNumber::List phoneL = ad.phoneNumbers(); 576 PhoneNumber::List phoneL = ad.phoneNumbers();
577 PhoneNumber::List::Iterator phoneItL; 577 PhoneNumber::List::Iterator phoneItL;
578 for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { 578 for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) {
579 if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { 579 if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) {
580 found = true; 580 found = true;
581 break; 581 break;
582 } 582 }
583 } 583 }
584 if ( ! found ) 584 if ( ! found )
585 return false; 585 return false;
586 } 586 }
587 return true; 587 return true;
588 588
589} 589}
590void Addressee::simplifyAddresses() 590void Addressee::simplifyAddresses()
591{ 591{
592 592
593 593
594 Address::List list; 594 Address::List list;
595 Address::List::Iterator it; 595 Address::List::Iterator it;
596 Address::List::Iterator it2; 596 Address::List::Iterator it2;
597 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 597 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
598 it2 = it; 598 it2 = it;
599 ++it2; 599 ++it2;
600 for( ; it2 != mData->addresses.end(); ++it2 ) { 600 for( ; it2 != mData->addresses.end(); ++it2 ) {
601 if ( (*it) == (*it2) ) { 601 if ( (*it) == (*it2) ) {
602 list.append( *it ); 602 list.append( *it );
603 break; 603 break;
604 } 604 }
605 } 605 }
606 } 606 }
607 for( it = list.begin(); it != list.end(); ++it ) { 607 for( it = list.begin(); it != list.end(); ++it ) {
608 removeAddress( (*it) ); 608 removeAddress( (*it) );
609 } 609 }
610 610
611 list.clear(); 611 list.clear();
612 int max = 2; 612 int max = 2;
613 if ( mData->url.isValid() ) 613 if ( mData->url.isValid() )
614 max = 1; 614 max = 1;
615 if ( mData->addresses.count() <= max ) return ; 615 if ( mData->addresses.count() <= max ) return ;
616 int count = 0; 616 int count = 0;
617 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 617 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
618 if ( count >= max ) 618 if ( count >= max )
619 list.append( *it ); 619 list.append( *it );
620 ++count; 620 ++count;
621 } 621 }
622 for( it = list.begin(); it != list.end(); ++it ) { 622 for( it = list.begin(); it != list.end(); ++it ) {
623 removeAddress( (*it) ); 623 removeAddress( (*it) );
624 } 624 }
625} 625}
626 626
627// removes all emails but the first 627// removes all emails but the first
628// needed by phone sync 628// needed by phone sync
629void Addressee::simplifyEmails() 629void Addressee::simplifyEmails()
630{ 630{
631 if ( mData->emails.count() == 0 ) return ; 631 if ( mData->emails.count() == 0 ) return ;
632 QString email = mData->emails.first(); 632 QString email = mData->emails.first();
633 detach(); 633 detach();
634 mData->emails.clear(); 634 mData->emails.clear();
635 mData->emails.append( email ); 635 mData->emails.append( email );
636} 636}
637void Addressee::makePhoneNumbersOLcompatible() 637void Addressee::makePhoneNumbersOLcompatible()
638{ 638{
639 KABC::PhoneNumber::List::Iterator phoneIter; 639 KABC::PhoneNumber::List::Iterator phoneIter;
640 KABC::PhoneNumber::List::Iterator phoneIter2; 640 KABC::PhoneNumber::List::Iterator phoneIter2;
641 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 641 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
642 ++phoneIter ) { 642 ++phoneIter ) {
643 ( *phoneIter ).makeCompat(); 643 ( *phoneIter ).makeCompat();
644 } 644 }
645 int hasHome = hasPhoneNumberType( PhoneNumber::Home | PhoneNumber::Pref ); 645 int hasHome = hasPhoneNumberType( PhoneNumber::Home | PhoneNumber::Pref );
646 int hasHome2 = hasPhoneNumberType( PhoneNumber::Home ); 646 int hasHome2 = hasPhoneNumberType( PhoneNumber::Home );
647 int hasWork = hasPhoneNumberType( PhoneNumber::Work | PhoneNumber::Pref ); 647 int hasWork = hasPhoneNumberType( PhoneNumber::Work | PhoneNumber::Pref );
648 int hasWork2 = hasPhoneNumberType( PhoneNumber::Work ); 648 int hasWork2 = hasPhoneNumberType( PhoneNumber::Work );
649 int hasCell = hasPhoneNumberType( PhoneNumber::Cell ); 649 int hasCell = hasPhoneNumberType( PhoneNumber::Cell );
650 int hasCell2 = hasPhoneNumberType( PhoneNumber::Car ); 650 int hasCell2 = hasPhoneNumberType( PhoneNumber::Car );
651 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 651 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
652 ++phoneIter ) { 652 ++phoneIter ) {
653 if ( (*phoneIter).type() == PhoneNumber::Home && ! hasHome ) { 653 if ( (*phoneIter).type() == PhoneNumber::Home && ! hasHome ) {
654 (*phoneIter).setType( PhoneNumber::Home | PhoneNumber::Pref ); 654 (*phoneIter).setType( PhoneNumber::Home | PhoneNumber::Pref );
655 ++hasHome; 655 ++hasHome;
656 if ( hasHome2 ) --hasHome2; 656 if ( hasHome2 ) --hasHome2;
657 } else if ( ( (*phoneIter).type() == PhoneNumber::Home | PhoneNumber::Pref) && hasHome>1 && !hasHome2 ) { 657 } else if ( ( (*phoneIter).type() == PhoneNumber::Home | PhoneNumber::Pref) && hasHome>1 && !hasHome2 ) {
658 (*phoneIter).setType( PhoneNumber::Home ); 658 (*phoneIter).setType( PhoneNumber::Home );
659 --hasHome; 659 --hasHome;
660 ++hasHome2; 660 ++hasHome2;
661 } else if ( (*phoneIter).type() == PhoneNumber::Work && ! hasWork ) { 661 } else if ( (*phoneIter).type() == PhoneNumber::Work && ! hasWork ) {
662 (*phoneIter).setType( PhoneNumber::Work | PhoneNumber::Pref ); 662 (*phoneIter).setType( PhoneNumber::Work | PhoneNumber::Pref );
663 ++hasWork; 663 ++hasWork;
664 if ( hasWork2 ) --hasWork2; 664 if ( hasWork2 ) --hasWork2;
665 } else if ( ( (*phoneIter).type() == PhoneNumber::Work | PhoneNumber::Pref) && hasWork > 1 && ! hasWork2 ) { 665 } else if ( ( (*phoneIter).type() == PhoneNumber::Work | PhoneNumber::Pref) && hasWork > 1 && ! hasWork2 ) {
666 (*phoneIter).setType( PhoneNumber::Work ); 666 (*phoneIter).setType( PhoneNumber::Work );
667 --hasWork; 667 --hasWork;
668 ++hasWork2; 668 ++hasWork2;
669 } else if ( (*phoneIter).type() == PhoneNumber::Cell && hasCell > 1 && !hasCell2) { 669 } else if ( (*phoneIter).type() == PhoneNumber::Cell && hasCell > 1 && !hasCell2) {
670 (*phoneIter).setType( PhoneNumber::Car ); 670 (*phoneIter).setType( PhoneNumber::Car );
671 ++hasCell2; 671 ++hasCell2;
672 --hasCell; 672 --hasCell;
673 } else if ( (*phoneIter).type() == PhoneNumber::Car && hasCell2 > 1 && !hasCell) { 673 } else if ( (*phoneIter).type() == PhoneNumber::Car && hasCell2 > 1 && !hasCell) {
674 (*phoneIter).setType( PhoneNumber::Cell ); 674 (*phoneIter).setType( PhoneNumber::Cell );
675 ++hasCell; 675 ++hasCell;
676 --hasCell2; 676 --hasCell2;
677 } else{ 677 } else{
678 phoneIter2 = phoneIter; 678 phoneIter2 = phoneIter;
679 ++phoneIter2; 679 ++phoneIter2;
680 for ( ; phoneIter2 != mData->phoneNumbers.end(); 680 for ( ; phoneIter2 != mData->phoneNumbers.end();
681 ++phoneIter2 ) { 681 ++phoneIter2 ) {
682 if ( (*phoneIter2).type() == (*phoneIter).type() ) { 682 if ( (*phoneIter2).type() == (*phoneIter).type() ) {
683 (*phoneIter2).setType( PhoneNumber::Voice ); 683 (*phoneIter2).setType( PhoneNumber::Voice );
684 684
685 } 685 }
686 } 686 }
687 } 687 }
688 } 688 }
689} 689}
690void Addressee::simplifyPhoneNumbers() 690void Addressee::simplifyPhoneNumbers()
691{ 691{
692 int max = 4; 692 int max = 4;
693 int inList = mData->phoneNumbers.count(); 693 int inList = mData->phoneNumbers.count();
694 KABC::PhoneNumber::List removeNumbers; 694 KABC::PhoneNumber::List removeNumbers;
695 KABC::PhoneNumber::List::Iterator phoneIter; 695 KABC::PhoneNumber::List::Iterator phoneIter;
696 if ( inList > max ) { 696 if ( inList > max ) {
697 // delete non-preferred numbers 697 // delete non-preferred numbers
698 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 698 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
699 ++phoneIter ) { 699 ++phoneIter ) {
700 if ( inList > max ) { 700 if ( inList > max ) {
701 if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { 701 if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) {
702 removeNumbers.append( ( *phoneIter ) ); 702 removeNumbers.append( ( *phoneIter ) );
703 --inList; 703 --inList;
704 } 704 }
705 } else 705 } else
706 break; 706 break;
707 } 707 }
708 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 708 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
709 ++phoneIter ) { 709 ++phoneIter ) {
710 removePhoneNumber(( *phoneIter )); 710 removePhoneNumber(( *phoneIter ));
711 } 711 }
712 // delete preferred numbers 712 // delete preferred numbers
713 if ( inList > max ) { 713 if ( inList > max ) {
714 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 714 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
715 ++phoneIter ) { 715 ++phoneIter ) {
716 if ( inList > max ) { 716 if ( inList > max ) {
717 removeNumbers.append( ( *phoneIter ) ); 717 removeNumbers.append( ( *phoneIter ) );
718 --inList; 718 --inList;
719 } else 719 } else
720 break; 720 break;
721 } 721 }
722 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 722 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
723 ++phoneIter ) { 723 ++phoneIter ) {
724 removePhoneNumber(( *phoneIter )); 724 removePhoneNumber(( *phoneIter ));
725 } 725 }
726 } 726 }
727 } 727 }
728 // remove non-numeric characters 728 // remove non-numeric characters
729 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 729 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
730 ++phoneIter ) { 730 ++phoneIter ) {
731 if ( ! ( *phoneIter ).simplifyNumber() ) 731 if ( ! ( *phoneIter ).simplifyNumber() )
732 removeNumbers.append( ( *phoneIter ) ); 732 removeNumbers.append( ( *phoneIter ) );
733 } 733 }
734 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 734 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
735 ++phoneIter ) { 735 ++phoneIter ) {
736 removePhoneNumber(( *phoneIter )); 736 removePhoneNumber(( *phoneIter ));
737 } 737 }
738} 738}
739void Addressee::simplifyPhoneNumberTypes() 739void Addressee::simplifyPhoneNumberTypes()
740{ 740{
741 KABC::PhoneNumber::List::Iterator phoneIter; 741 KABC::PhoneNumber::List::Iterator phoneIter;
742 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 742 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
743 ++phoneIter ) 743 ++phoneIter )
744 ( *phoneIter ).simplifyType(); 744 ( *phoneIter ).simplifyType();
745} 745}
746void Addressee::removeID(const QString &prof) 746void Addressee::removeID(const QString &prof)
747{ 747{
748 detach(); 748 detach();
749 if ( prof.isEmpty() ) 749 if ( prof.isEmpty() )
750 mData->mExternalId = ":"; 750 mData->mExternalId = ":";
751 else 751 else
752 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 752 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
753 753
754} 754}
755void Addressee::setID( const QString & prof , const QString & id ) 755void Addressee::setID( const QString & prof , const QString & id )
756{ 756{
757 detach(); 757 detach();
758 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 758 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
759 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 759 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
760} 760}
761void Addressee::setTempSyncStat( int id ) 761void Addressee::setTempSyncStat( int id )
762{ 762{
763 if ( mData->mTempSyncStat == id ) return; 763 if ( mData->mTempSyncStat == id ) return;
764 detach(); 764 detach();
765 mData->mTempSyncStat = id; 765 mData->mTempSyncStat = id;
766} 766}
767int Addressee::tempSyncStat() const 767int Addressee::tempSyncStat() const
768{ 768{
769 return mData->mTempSyncStat; 769 return mData->mTempSyncStat;
770} 770}
771 771
772const QString Addressee::getID( const QString & prof) const 772const QString Addressee::getID( const QString & prof) const
773{ 773{
774 return KIdManager::getId ( mData->mExternalId, prof ); 774 return KIdManager::getId ( mData->mExternalId, prof );
775} 775}
776 776
777void Addressee::setCsum( const QString & prof , const QString & id ) 777void Addressee::setCsum( const QString & prof , const QString & id )
778{ 778{
779 detach(); 779 detach();
780 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 780 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
781 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); 781 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
782 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); 782 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
783} 783}
784 784
785const QString Addressee::getCsum( const QString & prof) const 785const QString Addressee::getCsum( const QString & prof) const
786{ 786{
787 return KIdManager::getCsum ( mData->mExternalId, prof ); 787 return KIdManager::getCsum ( mData->mExternalId, prof );
788} 788}
789 789
790void Addressee::setIDStr( const QString & s ) 790void Addressee::setIDStr( const QString & s )
791{ 791{
792 detach(); 792 detach();
793 mData->mExternalId = s; 793 mData->mExternalId = s;
794} 794}
795 795
796const QString Addressee::IDStr() const 796const QString Addressee::IDStr() const
797{ 797{
798 return mData->mExternalId; 798 return mData->mExternalId;
799} 799}
800 800
801void Addressee::setExternalUID( const QString &id ) 801void Addressee::setExternalUID( const QString &id )
802{ 802{
803 if ( id == mData->externalUID ) return; 803 if ( id == mData->externalUID ) return;
804 detach(); 804 detach();
805 mData->empty = false; 805 mData->empty = false;
806 mData->externalUID = id; 806 mData->externalUID = id;
807} 807}
808 808
809const QString Addressee::externalUID() const 809const QString Addressee::externalUID() const
810{ 810{
811 return mData->externalUID; 811 return mData->externalUID;
812} 812}
813void Addressee::setOriginalExternalUID( const QString &id ) 813void Addressee::setOriginalExternalUID( const QString &id )
814{ 814{
815 if ( id == mData->originalExternalUID ) return; 815 if ( id == mData->originalExternalUID ) return;
816 detach(); 816 detach();
817 mData->empty = false; 817 mData->empty = false;
818 //qDebug("*******Set orig uid %s ", id.latin1()); 818 //qDebug("*******Set orig uid %s ", id.latin1());
819 mData->originalExternalUID = id; 819 mData->originalExternalUID = id;
820} 820}
821 821
822QString Addressee::originalExternalUID() const 822QString Addressee::originalExternalUID() const
823{ 823{
824 return mData->originalExternalUID; 824 return mData->originalExternalUID;
825} 825}
826 826
827void Addressee::setUid( const QString &id ) 827void Addressee::setUid( const QString &id )
828{ 828{
829 if ( id == mData->uid ) return; 829 if ( id == mData->uid ) return;
830 detach(); 830 detach();
831 //qDebug("****setuid %s ", id.latin1()); 831 //qDebug("****setuid %s ", id.latin1());
832 mData->empty = false; 832 mData->empty = false;
833 mData->uid = id; 833 mData->uid = id;
834} 834}
835 835
836const QString Addressee::uid() const 836const QString Addressee::uid() const
837{ 837{
838 if ( mData->uid.isEmpty() ) 838 if ( mData->uid.isEmpty() )
839 mData->uid = KApplication::randomString( 10 ); 839 mData->uid = KApplication::randomString( 10 );
840 840
841 return mData->uid; 841 return mData->uid;
842} 842}
843 843
844QString Addressee::uidLabel() 844QString Addressee::uidLabel()
845{ 845{
846 return i18n("Unique Identifier"); 846 return i18n("Unique Identifier");
847} 847}
848 848
849void Addressee::setName( const QString &name ) 849void Addressee::setName( const QString &name )
850{ 850{
851 if ( name == mData->name ) return; 851 if ( name == mData->name ) return;
852 detach(); 852 detach();
853 mData->empty = false; 853 mData->empty = false;
854 mData->name = name; 854 mData->name = name;
855} 855}
856 856
857QString Addressee::name() const 857QString Addressee::name() const
858{ 858{
859 return mData->name; 859 return mData->name;
860} 860}
861 861
862QString Addressee::nameLabel() 862QString Addressee::nameLabel()
863{ 863{
864 return i18n("Name"); 864 return i18n("Name");
865} 865}
866 866
867 867
868void Addressee::setFormattedName( const QString &formattedName ) 868void Addressee::setFormattedName( const QString &formattedName )
869{ 869{
870 if ( formattedName == mData->formattedName ) return; 870 if ( formattedName == mData->formattedName ) return;
871 detach(); 871 detach();
872 mData->empty = false; 872 mData->empty = false;
873 mData->formattedName = formattedName; 873 mData->formattedName = formattedName;
874} 874}
875 875
876QString Addressee::formattedName() const 876QString Addressee::formattedName() const
877{ 877{
878 return mData->formattedName; 878 return mData->formattedName;
879} 879}
880 880
881QString Addressee::formattedNameLabel() 881QString Addressee::formattedNameLabel()
882{ 882{
883 return i18n("Formatted Name"); 883 return i18n("Formatted Name");
884} 884}
885 885
886 886
887void Addressee::setFamilyName( const QString &familyName ) 887void Addressee::setFamilyName( const QString &familyName )
888{ 888{
889 if ( familyName == mData->familyName ) return; 889 if ( familyName == mData->familyName ) return;
890 detach(); 890 detach();
891 mData->empty = false; 891 mData->empty = false;
892 mData->familyName = familyName; 892 mData->familyName = familyName;
893} 893}
894 894
895QString Addressee::familyName() const 895QString Addressee::familyName() const
896{ 896{
897 return mData->familyName; 897 return mData->familyName;
898} 898}
899 899
900QString Addressee::familyNameLabel() 900QString Addressee::familyNameLabel()
901{ 901{
902 return i18n("Family Name"); 902 return i18n("Family Name");
903} 903}
904 904
905 905
906void Addressee::setGivenName( const QString &givenName ) 906void Addressee::setGivenName( const QString &givenName )
907{ 907{
908 if ( givenName == mData->givenName ) return; 908 if ( givenName == mData->givenName ) return;
909 detach(); 909 detach();
910 mData->empty = false; 910 mData->empty = false;
911 mData->givenName = givenName; 911 mData->givenName = givenName;
912} 912}
913 913
914QString Addressee::givenName() const 914QString Addressee::givenName() const
915{ 915{
916 return mData->givenName; 916 return mData->givenName;
917} 917}
918 918
919QString Addressee::givenNameLabel() 919QString Addressee::givenNameLabel()
920{ 920{
921 return i18n("Given Name"); 921 return i18n("Given Name");
922} 922}
923 923
924 924
925void Addressee::setAdditionalName( const QString &additionalName ) 925void Addressee::setAdditionalName( const QString &additionalName )
926{ 926{
927 if ( additionalName == mData->additionalName ) return; 927 if ( additionalName == mData->additionalName ) return;
928 detach(); 928 detach();
929 mData->empty = false; 929 mData->empty = false;
930 mData->additionalName = additionalName; 930 mData->additionalName = additionalName;
931} 931}
932 932
933QString Addressee::additionalName() const 933QString Addressee::additionalName() const
934{ 934{
935 return mData->additionalName; 935 return mData->additionalName;
936} 936}
937 937
938QString Addressee::additionalNameLabel() 938QString Addressee::additionalNameLabel()
939{ 939{
940 return i18n("Additional Names"); 940 return i18n("Additional Names");
941} 941}
942 942
943 943
944void Addressee::setPrefix( const QString &prefix ) 944void Addressee::setPrefix( const QString &prefix )
945{ 945{
946 if ( prefix == mData->prefix ) return; 946 if ( prefix == mData->prefix ) return;
947 detach(); 947 detach();
948 mData->empty = false; 948 mData->empty = false;
949 mData->prefix = prefix; 949 mData->prefix = prefix;
950} 950}
951 951
952QString Addressee::prefix() const 952QString Addressee::prefix() const
953{ 953{
954 return mData->prefix; 954 return mData->prefix;
955} 955}
956 956
957QString Addressee::prefixLabel() 957QString Addressee::prefixLabel()
958{ 958{
959 return i18n("Honorific Prefixes"); 959 return i18n("Honorific Prefixes");
960} 960}
961 961
962 962
963void Addressee::setSuffix( const QString &suffix ) 963void Addressee::setSuffix( const QString &suffix )
964{ 964{
965 if ( suffix == mData->suffix ) return; 965 if ( suffix == mData->suffix ) return;
966 detach(); 966 detach();
967 mData->empty = false; 967 mData->empty = false;
968 mData->suffix = suffix; 968 mData->suffix = suffix;
969} 969}
970 970
971QString Addressee::suffix() const 971QString Addressee::suffix() const
972{ 972{
973 return mData->suffix; 973 return mData->suffix;
974} 974}
975 975
976QString Addressee::suffixLabel() 976QString Addressee::suffixLabel()
977{ 977{
978 return i18n("Honorific Suffixes"); 978 return i18n("Honorific Suffixes");
979} 979}
980 980
981 981
982void Addressee::setNickName( const QString &nickName ) 982void Addressee::setNickName( const QString &nickName )
983{ 983{
984 if ( nickName == mData->nickName ) return; 984 if ( nickName == mData->nickName ) return;
985 detach(); 985 detach();
986 mData->empty = false; 986 mData->empty = false;
987 mData->nickName = nickName; 987 mData->nickName = nickName;
988} 988}
989 989
990QString Addressee::nickName() const 990QString Addressee::nickName() const
991{ 991{
992 return mData->nickName; 992 return mData->nickName;
993} 993}
994 994
995QString Addressee::nickNameLabel() 995QString Addressee::nickNameLabel()
996{ 996{
997 return i18n("Nick Name"); 997 return i18n("Nick Name");
998} 998}
999 999
1000 1000
1001void Addressee::setBirthday( const QDateTime &birthday ) 1001void Addressee::setBirthday( const QDateTime &birthday )
1002{ 1002{
1003 if ( birthday == mData->birthday ) return; 1003 if ( birthday == mData->birthday ) return;
1004 detach(); 1004 detach();
1005 mData->empty = false; 1005 mData->empty = false;
1006 mData->birthday = birthday; 1006 mData->birthday = birthday;
1007} 1007}
1008 1008
1009QDateTime Addressee::birthday() const 1009QDateTime Addressee::birthday() const
1010{ 1010{
1011 return mData->birthday; 1011 return mData->birthday;
1012} 1012}
1013 1013
1014QString Addressee::birthdayLabel() 1014QString Addressee::birthdayLabel()
1015{ 1015{
1016 return i18n("Birthday"); 1016 return i18n("Birthday");
1017} 1017}
1018 1018
1019 1019
1020QString Addressee::homeAddressStreetLabel() 1020QString Addressee::homeAddressStreetLabel()
1021{ 1021{
1022 return i18n("Home Address Street"); 1022 return i18n("Home Address Street");
1023} 1023}
1024 1024
1025 1025
1026QString Addressee::homeAddressLocalityLabel() 1026QString Addressee::homeAddressLocalityLabel()
1027{ 1027{
1028 return i18n("Home Address Locality"); 1028 return i18n("Home Address Locality");
1029} 1029}
1030 1030
1031 1031
1032QString Addressee::homeAddressRegionLabel() 1032QString Addressee::homeAddressRegionLabel()
1033{ 1033{
1034 return i18n("Home Address Region"); 1034 return i18n("Home Address Region");
1035} 1035}
1036 1036
1037 1037
1038QString Addressee::homeAddressPostalCodeLabel() 1038QString Addressee::homeAddressPostalCodeLabel()
1039{ 1039{
1040 return i18n("Home Address Postal Code"); 1040 return i18n("Home Address Postal Code");
1041} 1041}
1042 1042
1043 1043
1044QString Addressee::homeAddressCountryLabel() 1044QString Addressee::homeAddressCountryLabel()
1045{ 1045{
1046 return i18n("Home Address Country"); 1046 return i18n("Home Address Country");
1047} 1047}
1048 1048
1049 1049
1050QString Addressee::homeAddressLabelLabel() 1050QString Addressee::homeAddressLabelLabel()
1051{ 1051{
1052 return i18n("Home Address Label"); 1052 return i18n("Home Address Label");
1053} 1053}
1054 1054
1055 1055
1056QString Addressee::businessAddressStreetLabel() 1056QString Addressee::businessAddressStreetLabel()
1057{ 1057{
1058 return i18n("Business Address Street"); 1058 return i18n("Business Address Street");
1059} 1059}
1060 1060
1061 1061
1062QString Addressee::businessAddressLocalityLabel() 1062QString Addressee::businessAddressLocalityLabel()
1063{ 1063{
1064 return i18n("Business Address Locality"); 1064 return i18n("Business Address Locality");
1065} 1065}
1066 1066
1067 1067
1068QString Addressee::businessAddressRegionLabel() 1068QString Addressee::businessAddressRegionLabel()
1069{ 1069{
1070 return i18n("Business Address Region"); 1070 return i18n("Business Address Region");
1071} 1071}
1072 1072
1073 1073
1074QString Addressee::businessAddressPostalCodeLabel() 1074QString Addressee::businessAddressPostalCodeLabel()
1075{ 1075{
1076 return i18n("Business Address Postal Code"); 1076 return i18n("Business Address Postal Code");
1077} 1077}
1078 1078
1079 1079
1080QString Addressee::businessAddressCountryLabel() 1080QString Addressee::businessAddressCountryLabel()
1081{ 1081{
1082 return i18n("Business Address Country"); 1082 return i18n("Business Address Country");
1083} 1083}
1084 1084
1085 1085
1086QString Addressee::businessAddressLabelLabel() 1086QString Addressee::businessAddressLabelLabel()
1087{ 1087{
1088 return i18n("Business Address Label"); 1088 return i18n("Business Address Label");
1089} 1089}
1090 1090
1091 1091
1092QString Addressee::homePhoneLabel() 1092QString Addressee::homePhoneLabel()
1093{ 1093{
1094 return i18n("Home Phone"); 1094 return i18n("Home Phone");
1095} 1095}
1096 1096
1097 1097
1098QString Addressee::businessPhoneLabel() 1098QString Addressee::businessPhoneLabel()
1099{ 1099{
1100 return i18n("Work Phone"); 1100 return i18n("Work Phone");
1101} 1101}
1102 1102
1103 1103
1104QString Addressee::mobilePhoneLabel() 1104QString Addressee::mobilePhoneLabel()
1105{ 1105{
1106 return i18n("Mobile"); 1106 return i18n("Mobile");
1107} 1107}
1108QString Addressee::mobileWorkPhoneLabel() 1108QString Addressee::mobileWorkPhoneLabel()
1109{ 1109{
1110 return i18n("Mobile2"); 1110 return i18n("Mobile2");
1111} 1111}
1112 1112
1113 1113
1114QString Addressee::homeFaxLabel() 1114QString Addressee::homeFaxLabel()
1115{ 1115{
1116 return i18n("Fax (Home)"); 1116 return i18n("Fax (Home)");
1117} 1117}
1118 1118
1119 1119
1120QString Addressee::businessFaxLabel() 1120QString Addressee::businessFaxLabel()
1121{ 1121{
1122 return i18n("Fax (Work)"); 1122 return i18n("Fax (Work)");
1123} 1123}
1124 1124
1125 1125
1126QString Addressee::isdnLabel() 1126QString Addressee::isdnLabel()
1127{ 1127{
1128 return i18n("ISDN"); 1128 return i18n("ISDN");
1129} 1129}
1130 1130
1131 1131
1132QString Addressee::pagerLabel() 1132QString Addressee::pagerLabel()
1133{ 1133{
1134 return i18n("Pager"); 1134 return i18n("Pager");
1135} 1135}
1136QString Addressee::otherPhoneLabel() 1136QString Addressee::otherPhoneLabel()
1137{ 1137{
1138 return i18n("Other Phone"); 1138 return i18n("Other Phone");
1139} 1139}
1140 1140
1141QString Addressee::sipLabel() 1141QString Addressee::sipLabel()
1142{ 1142{
1143 return i18n("SiP"); 1143 return i18n("SiP");
1144} 1144}
1145 1145
1146QString Addressee::emailLabel() 1146QString Addressee::emailLabel()
1147{ 1147{
1148 return i18n("Email Address"); 1148 return i18n("Email Address");
1149} 1149}
1150 1150
1151 1151
1152void Addressee::setMailer( const QString &mailer ) 1152void Addressee::setMailer( const QString &mailer )
1153{ 1153{
1154 if ( mailer == mData->mailer ) return; 1154 if ( mailer == mData->mailer ) return;
1155 detach(); 1155 detach();
1156 mData->empty = false; 1156 mData->empty = false;
1157 mData->mailer = mailer; 1157 mData->mailer = mailer;
1158} 1158}
1159 1159
1160QString Addressee::mailer() const 1160QString Addressee::mailer() const
1161{ 1161{
1162 return mData->mailer; 1162 return mData->mailer;
1163} 1163}
1164 1164
1165QString Addressee::mailerLabel() 1165QString Addressee::mailerLabel()
1166{ 1166{
1167 return i18n("Mail Client"); 1167 return i18n("Mail Client");
1168} 1168}
1169 1169
1170 1170
1171void Addressee::setTimeZone( const TimeZone &timeZone ) 1171void Addressee::setTimeZone( const TimeZone &timeZone )
1172{ 1172{
1173 if ( timeZone == mData->timeZone ) return; 1173 if ( timeZone == mData->timeZone ) return;
1174 detach(); 1174 detach();
1175 mData->empty = false; 1175 mData->empty = false;
1176 mData->timeZone = timeZone; 1176 mData->timeZone = timeZone;
1177} 1177}
1178 1178
1179TimeZone Addressee::timeZone() const 1179TimeZone Addressee::timeZone() const
1180{ 1180{
1181 return mData->timeZone; 1181 return mData->timeZone;
1182} 1182}
1183 1183
1184QString Addressee::timeZoneLabel() 1184QString Addressee::timeZoneLabel()
1185{ 1185{
1186 return i18n("Time Zone"); 1186 return i18n("Time Zone");
1187} 1187}
1188 1188
1189 1189
1190void Addressee::setGeo( const Geo &geo ) 1190void Addressee::setGeo( const Geo &geo )
1191{ 1191{
1192 if ( geo == mData->geo ) return; 1192 if ( geo == mData->geo ) return;
1193 detach(); 1193 detach();
1194 mData->empty = false; 1194 mData->empty = false;
1195 mData->geo = geo; 1195 mData->geo = geo;
1196} 1196}
1197 1197
1198Geo Addressee::geo() const 1198Geo Addressee::geo() const
1199{ 1199{
1200 return mData->geo; 1200 return mData->geo;
1201} 1201}
1202 1202
1203QString Addressee::geoLabel() 1203QString Addressee::geoLabel()
1204{ 1204{
1205 return i18n("Geographic Position"); 1205 return i18n("Geographic Position");
1206} 1206}
1207 1207
1208 1208
1209void Addressee::setTitle( const QString &title ) 1209void Addressee::setTitle( const QString &title )
1210{ 1210{
1211 if ( title == mData->title ) return; 1211 if ( title == mData->title ) return;
1212 detach(); 1212 detach();
1213 mData->empty = false; 1213 mData->empty = false;
1214 mData->title = title; 1214 mData->title = title;
1215} 1215}
1216 1216
1217QString Addressee::title() const 1217QString Addressee::title() const
1218{ 1218{
1219 return mData->title; 1219 return mData->title;
1220} 1220}
1221 1221
1222QString Addressee::titleLabel() 1222QString Addressee::titleLabel()
1223{ 1223{
1224 return i18n("Title"); 1224 return i18n("Title");
1225} 1225}
1226 1226
1227 1227
1228void Addressee::setRole( const QString &role ) 1228void Addressee::setRole( const QString &role )
1229{ 1229{
1230 if ( role == mData->role ) return; 1230 if ( role == mData->role ) return;
1231 detach(); 1231 detach();
1232 mData->empty = false; 1232 mData->empty = false;
1233 mData->role = role; 1233 mData->role = role;
1234} 1234}
1235 1235
1236QString Addressee::role() const 1236QString Addressee::role() const
1237{ 1237{
1238 return mData->role; 1238 return mData->role;
1239} 1239}
1240 1240
1241QString Addressee::roleLabel() 1241QString Addressee::roleLabel()
1242{ 1242{
1243 return i18n("Role"); 1243 return i18n("Role");
1244} 1244}
1245 1245
1246 1246
1247void Addressee::setOrganization( const QString &organization ) 1247void Addressee::setOrganization( const QString &organization )
1248{ 1248{
1249 if ( organization == mData->organization ) return; 1249 if ( organization == mData->organization ) return;
1250 detach(); 1250 detach();
1251 mData->empty = false; 1251 mData->empty = false;
1252 mData->organization = organization; 1252 mData->organization = organization;
1253} 1253}
1254 1254
1255QString Addressee::organization() const 1255QString Addressee::organization() const
1256{ 1256{
1257 return mData->organization; 1257 return mData->organization;
1258} 1258}
1259 1259
1260QString Addressee::organizationLabel() 1260QString Addressee::organizationLabel()
1261{ 1261{
1262 return i18n("Organization"); 1262 return i18n("Organization");
1263} 1263}
1264 1264
1265 1265
1266void Addressee::setNote( const QString &note ) 1266void Addressee::setNote( const QString &note )
1267{ 1267{
1268 if ( note == mData->note ) return; 1268 if ( note == mData->note ) return;
1269 detach(); 1269 detach();
1270 mData->empty = false; 1270 mData->empty = false;
1271 mData->note = note; 1271 mData->note = note;
1272} 1272}
1273 1273
1274QString Addressee::note() const 1274QString Addressee::note() const
1275{ 1275{
1276 return mData->note; 1276 return mData->note;
1277} 1277}
1278 1278
1279QString Addressee::noteLabel() 1279QString Addressee::noteLabel()
1280{ 1280{
1281 return i18n("Note"); 1281 return i18n("Note");
1282} 1282}
1283 1283
1284 1284
1285void Addressee::setProductId( const QString &productId ) 1285void Addressee::setProductId( const QString &productId )
1286{ 1286{
1287 if ( productId == mData->productId ) return; 1287 if ( productId == mData->productId ) return;
1288 detach(); 1288 detach();
1289 mData->empty = false; 1289 mData->empty = false;
1290 mData->productId = productId; 1290 mData->productId = productId;
1291} 1291}
1292 1292
1293QString Addressee::productId() const 1293QString Addressee::productId() const
1294{ 1294{
1295 return mData->productId; 1295 return mData->productId;
1296} 1296}
1297 1297
1298QString Addressee::productIdLabel() 1298QString Addressee::productIdLabel()
1299{ 1299{
1300 return i18n("Product Identifier"); 1300 return i18n("Product Identifier");
1301} 1301}
1302 1302
1303 1303
1304void Addressee::setRevision( const QDateTime &revision ) 1304void Addressee::setRevision( const QDateTime &revision )
1305{ 1305{
1306 if ( revision == mData->revision ) return; 1306 if ( revision == mData->revision ) return;
1307 detach(); 1307 detach();
1308 mData->empty = false; 1308 mData->empty = false;
1309 mData->revision = QDateTime( revision.date(), 1309 mData->revision = QDateTime( revision.date(),
1310 QTime (revision.time().hour(), 1310 QTime (revision.time().hour(),
1311 revision.time().minute(), 1311 revision.time().minute(),
1312 revision.time().second())); 1312 revision.time().second()));
1313} 1313}
1314 1314
1315QDateTime Addressee::revision() const 1315QDateTime Addressee::revision() const
1316{ 1316{
1317 return mData->revision; 1317 return mData->revision;
1318} 1318}
1319 1319
1320QString Addressee::revisionLabel() 1320QString Addressee::revisionLabel()
1321{ 1321{
1322 return i18n("Revision Date"); 1322 return i18n("Revision Date");
1323} 1323}
1324 1324
1325 1325
1326void Addressee::setSortString( const QString &sortString ) 1326void Addressee::setSortString( const QString &sortString )
1327{ 1327{
1328 if ( sortString == mData->sortString ) return; 1328 if ( sortString == mData->sortString ) return;
1329 detach(); 1329 detach();
1330 mData->empty = false; 1330 mData->empty = false;
1331 mData->sortString = sortString; 1331 mData->sortString = sortString;
1332} 1332}
1333 1333
1334QString Addressee::sortString() const 1334QString Addressee::sortString() const
1335{ 1335{
1336 return mData->sortString; 1336 return mData->sortString;
1337} 1337}
1338 1338
1339QString Addressee::sortStringLabel() 1339QString Addressee::sortStringLabel()
1340{ 1340{
1341 return i18n("Sort String"); 1341 return i18n("Sort String");
1342} 1342}
1343 1343
1344 1344
1345void Addressee::setUrl( const KURL &url ) 1345void Addressee::setUrl( const KURL &url )
1346{ 1346{
1347 if ( url == mData->url ) return; 1347 if ( url == mData->url ) return;
1348 detach(); 1348 detach();
1349 mData->empty = false; 1349 mData->empty = false;
1350 mData->url = url; 1350 mData->url = url;
1351} 1351}
1352 1352
1353KURL Addressee::url() const 1353KURL Addressee::url() const
1354{ 1354{
1355 return mData->url; 1355 return mData->url;
1356} 1356}
1357 1357
1358QString Addressee::urlLabel() 1358QString Addressee::urlLabel()
1359{ 1359{
1360 return i18n("URL"); 1360 return i18n("URL");
1361} 1361}
1362 1362
1363 1363
1364void Addressee::setSecrecy( const Secrecy &secrecy ) 1364void Addressee::setSecrecy( const Secrecy &secrecy )
1365{ 1365{
1366 if ( secrecy == mData->secrecy ) return; 1366 if ( secrecy == mData->secrecy ) return;
1367 detach(); 1367 detach();
1368 mData->empty = false; 1368 mData->empty = false;
1369 mData->secrecy = secrecy; 1369 mData->secrecy = secrecy;
1370} 1370}
1371 1371
1372Secrecy Addressee::secrecy() const 1372Secrecy Addressee::secrecy() const
1373{ 1373{
1374 return mData->secrecy; 1374 return mData->secrecy;
1375} 1375}
1376 1376
1377QString Addressee::secrecyLabel() 1377QString Addressee::secrecyLabel()
1378{ 1378{
1379 return i18n("Security Class"); 1379 return i18n("Security Class");
1380} 1380}
1381 1381
1382 1382
1383void Addressee::setLogo( const Picture &logo ) 1383void Addressee::setLogo( const Picture &logo )
1384{ 1384{
1385 if ( logo == mData->logo ) return; 1385 if ( logo == mData->logo ) return;
1386 detach(); 1386 detach();
1387 mData->empty = false; 1387 mData->empty = false;
1388 mData->logo = logo; 1388 mData->logo = logo;
1389} 1389}
1390 1390
1391Picture Addressee::logo() const 1391Picture Addressee::logo() const
1392{ 1392{
1393 return mData->logo; 1393 return mData->logo;
1394} 1394}
1395 1395
1396QString Addressee::logoLabel() 1396QString Addressee::logoLabel()
1397{ 1397{
1398 return i18n("Logo"); 1398 return i18n("Logo");
1399} 1399}
1400 1400
1401 1401
1402void Addressee::setPhoto( const Picture &photo ) 1402void Addressee::setPhoto( const Picture &photo )
1403{ 1403{
1404 if ( photo == mData->photo ) return; 1404 if ( photo == mData->photo ) return;
1405 detach(); 1405 detach();
1406 mData->empty = false; 1406 mData->empty = false;
1407 mData->photo = photo; 1407 mData->photo = photo;
1408} 1408}
1409 1409
1410Picture Addressee::photo() const 1410Picture Addressee::photo() const
1411{ 1411{
1412 return mData->photo; 1412 return mData->photo;
1413} 1413}
1414 1414
1415QString Addressee::photoLabel() 1415QString Addressee::photoLabel()
1416{ 1416{
1417 return i18n("Photo"); 1417 return i18n("Photo");
1418} 1418}
1419 1419
1420 1420
1421void Addressee::setSound( const Sound &sound ) 1421void Addressee::setSound( const Sound &sound )
1422{ 1422{
1423 if ( sound == mData->sound ) return; 1423 if ( sound == mData->sound ) return;
1424 detach(); 1424 detach();
1425 mData->empty = false; 1425 mData->empty = false;
1426 mData->sound = sound; 1426 mData->sound = sound;
1427} 1427}
1428 1428
1429Sound Addressee::sound() const 1429Sound Addressee::sound() const
1430{ 1430{
1431 return mData->sound; 1431 return mData->sound;
1432} 1432}
1433 1433
1434QString Addressee::soundLabel() 1434QString Addressee::soundLabel()
1435{ 1435{
1436 return i18n("Sound"); 1436 return i18n("Sound");
1437} 1437}
1438 1438
1439 1439
1440void Addressee::setAgent( const Agent &agent ) 1440void Addressee::setAgent( const Agent &agent )
1441{ 1441{
1442 if ( agent == mData->agent ) return; 1442 if ( agent == mData->agent ) return;
1443 detach(); 1443 detach();
1444 mData->empty = false; 1444 mData->empty = false;
1445 mData->agent = agent; 1445 mData->agent = agent;
1446} 1446}
1447 1447
1448Agent Addressee::agent() const 1448Agent Addressee::agent() const
1449{ 1449{
1450 return mData->agent; 1450 return mData->agent;
1451} 1451}
1452 1452
1453QString Addressee::agentLabel() 1453QString Addressee::agentLabel()
1454{ 1454{
1455 return i18n("Agent"); 1455 return i18n("Agent");
1456} 1456}
1457 1457
1458 1458
1459 1459
1460void Addressee::setNameFromString( const QString &str ) 1460void Addressee::setNameFromString( const QString &str )
1461{ 1461{
1462 setFormattedName( str ); 1462 setFormattedName( str );
1463 setName( str ); 1463 setName( str );
1464 1464
1465 static bool first = true; 1465 static bool first = true;
1466 static QStringList titles; 1466 static QStringList titles;
1467 static QStringList suffixes; 1467 static QStringList suffixes;
1468 static QStringList prefixes; 1468 static QStringList prefixes;
1469 1469
1470 if ( first ) { 1470 if ( first ) {
1471 first = false; 1471 first = false;
1472 titles += i18n( "Dr." ); 1472 titles += i18n( "Dr." );
1473 titles += i18n( "Miss" ); 1473 titles += i18n( "Miss" );
1474 titles += i18n( "Mr." ); 1474 titles += i18n( "Mr." );
1475 titles += i18n( "Mrs." ); 1475 titles += i18n( "Mrs." );
1476 titles += i18n( "Ms." ); 1476 titles += i18n( "Ms." );
1477 titles += i18n( "Prof." ); 1477 titles += i18n( "Prof." );
1478 1478
1479 suffixes += i18n( "I" ); 1479 suffixes += i18n( "I" );
1480 suffixes += i18n( "II" ); 1480 suffixes += i18n( "II" );
1481 suffixes += i18n( "III" ); 1481 suffixes += i18n( "III" );
1482 suffixes += i18n( "Jr." ); 1482 suffixes += i18n( "Jr." );
1483 suffixes += i18n( "Sr." ); 1483 suffixes += i18n( "Sr." );
1484 1484
1485 prefixes += "van"; 1485 prefixes += "van";
1486 prefixes += "von"; 1486 prefixes += "von";
1487 prefixes += "de"; 1487 prefixes += "de";
1488 1488
1489 KConfig config( locateLocal( "config", "kabcrc") ); 1489 KConfig config( locateLocal( "config", "kabcrc") );
1490 config.setGroup( "General" ); 1490 config.setGroup( "General" );
1491 titles += config.readListEntry( "Prefixes" ); 1491 titles += config.readListEntry( "Prefixes" );
1492 titles.remove( "" ); 1492 titles.remove( "" );
1493 prefixes += config.readListEntry( "Inclusions" ); 1493 prefixes += config.readListEntry( "Inclusions" );
1494 prefixes.remove( "" ); 1494 prefixes.remove( "" );
1495 suffixes += config.readListEntry( "Suffixes" ); 1495 suffixes += config.readListEntry( "Suffixes" );
1496 suffixes.remove( "" ); 1496 suffixes.remove( "" );
1497 } 1497 }
1498 1498
1499 // clear all name parts 1499 // clear all name parts
1500 setPrefix( "" ); 1500 setPrefix( "" );
1501 setGivenName( "" ); 1501 setGivenName( "" );
1502 setAdditionalName( "" ); 1502 setAdditionalName( "" );
1503 setFamilyName( "" ); 1503 setFamilyName( "" );
1504 setSuffix( "" ); 1504 setSuffix( "" );
1505 1505
1506 if ( str.isEmpty() ) 1506 if ( str.isEmpty() )
1507 return; 1507 return;
1508 1508
1509 int i = str.find(','); 1509 int i = str.find(',');
1510 if( i < 0 ) { 1510 if( i < 0 ) {
1511 QStringList parts = QStringList::split( " ", str ); 1511 QStringList parts = QStringList::split( " ", str );
1512 int leftOffset = 0; 1512 int leftOffset = 0;
1513 int rightOffset = parts.count() - 1; 1513 int rightOffset = parts.count() - 1;
1514 1514
1515 QString suffix; 1515 QString suffix;
1516 while ( rightOffset >= 0 ) { 1516 while ( rightOffset >= 0 ) {
1517 if ( suffixes.contains( parts[ rightOffset ] ) ) { 1517 if ( suffixes.contains( parts[ rightOffset ] ) ) {
1518 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); 1518 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " "));
1519 rightOffset--; 1519 rightOffset--;
1520 } else 1520 } else
1521 break; 1521 break;
1522 } 1522 }
1523 setSuffix( suffix ); 1523 setSuffix( suffix );
1524 1524
1525 if ( rightOffset < 0 ) 1525 if ( rightOffset < 0 )
1526 return; 1526 return;
1527 1527
1528 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { 1528 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) {
1529 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); 1529 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] );
1530 rightOffset--; 1530 rightOffset--;
1531 } else 1531 } else
1532 setFamilyName( parts[ rightOffset ] ); 1532 setFamilyName( parts[ rightOffset ] );
1533 1533
1534 QString prefix; 1534 QString prefix;
1535 while ( leftOffset < rightOffset ) { 1535 while ( leftOffset < rightOffset ) {
1536 if ( titles.contains( parts[ leftOffset ] ) ) { 1536 if ( titles.contains( parts[ leftOffset ] ) ) {
1537 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 1537 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] );
1538 leftOffset++; 1538 leftOffset++;
1539 } else 1539 } else
1540 break; 1540 break;
1541 } 1541 }
1542 setPrefix( prefix ); 1542 setPrefix( prefix );
1543 1543
1544 if ( leftOffset < rightOffset ) { 1544 if ( leftOffset < rightOffset ) {
1545 setGivenName( parts[ leftOffset ] ); 1545 setGivenName( parts[ leftOffset ] );
1546 leftOffset++; 1546 leftOffset++;
1547 } 1547 }
1548 1548
1549 QString additionalName; 1549 QString additionalName;
1550 while ( leftOffset < rightOffset ) { 1550 while ( leftOffset < rightOffset ) {
1551 additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 1551 additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] );
1552 leftOffset++; 1552 leftOffset++;
1553 } 1553 }
1554 setAdditionalName( additionalName ); 1554 setAdditionalName( additionalName );
1555 } else { 1555 } else {
1556 QString part1 = str.left( i ); 1556 QString part1 = str.left( i );
1557 QString part2 = str.mid( i + 1 ); 1557 QString part2 = str.mid( i + 1 );
1558 1558
1559 QStringList parts = QStringList::split( " ", part1 ); 1559 QStringList parts = QStringList::split( " ", part1 );
1560 int leftOffset = 0; 1560 int leftOffset = 0;
1561 int rightOffset = parts.count() - 1; 1561 int rightOffset = parts.count() - 1;
1562 1562
1563 QString suffix; 1563 QString suffix;
1564 while ( rightOffset >= 0 ) { 1564 while ( rightOffset >= 0 ) {
1565 if ( suffixes.contains( parts[ rightOffset ] ) ) { 1565 if ( suffixes.contains( parts[ rightOffset ] ) ) {
1566 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); 1566 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " "));
1567 rightOffset--; 1567 rightOffset--;
1568 } else 1568 } else
1569 break; 1569 break;
1570 } 1570 }
1571 setSuffix( suffix ); 1571 setSuffix( suffix );
1572 1572
1573 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { 1573 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) {
1574 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); 1574 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] );
1575 rightOffset--; 1575 rightOffset--;
1576 } else 1576 } else
1577 setFamilyName( parts[ rightOffset ] ); 1577 setFamilyName( parts[ rightOffset ] );
1578 1578
1579 QString prefix; 1579 QString prefix;
1580 while ( leftOffset < rightOffset ) { 1580 while ( leftOffset < rightOffset ) {
1581 if ( titles.contains( parts[ leftOffset ] ) ) { 1581 if ( titles.contains( parts[ leftOffset ] ) ) {
1582 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 1582 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] );
1583 leftOffset++; 1583 leftOffset++;
1584 } else 1584 } else
1585 break; 1585 break;
1586 } 1586 }
1587 1587
1588 parts = QStringList::split( " ", part2 ); 1588 parts = QStringList::split( " ", part2 );
1589 1589
1590 leftOffset = 0; 1590 leftOffset = 0;
1591 rightOffset = parts.count(); 1591 rightOffset = parts.count();
1592 1592
1593 while ( leftOffset < rightOffset ) { 1593 while ( leftOffset < rightOffset ) {
1594 if ( titles.contains( parts[ leftOffset ] ) ) { 1594 if ( titles.contains( parts[ leftOffset ] ) ) {
1595 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 1595 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] );
1596 leftOffset++; 1596 leftOffset++;
1597 } else 1597 } else
1598 break; 1598 break;
1599 } 1599 }
1600 setPrefix( prefix ); 1600 setPrefix( prefix );
1601 1601
1602 if ( leftOffset < rightOffset ) { 1602 if ( leftOffset < rightOffset ) {
1603 setGivenName( parts[ leftOffset ] ); 1603 setGivenName( parts[ leftOffset ] );
1604 leftOffset++; 1604 leftOffset++;
1605 } 1605 }
1606 1606
1607 QString additionalName; 1607 QString additionalName;
1608 while ( leftOffset < rightOffset ) { 1608 while ( leftOffset < rightOffset ) {
1609 additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 1609 additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] );
1610 leftOffset++; 1610 leftOffset++;
1611 } 1611 }
1612 setAdditionalName( additionalName ); 1612 setAdditionalName( additionalName );
1613 } 1613 }
1614} 1614}
1615 1615
1616QString Addressee::realName() const 1616QString Addressee::realName() const
1617{ 1617{
1618 if ( !formattedName().isEmpty() ) 1618 if ( !formattedName().isEmpty() )
1619 return formattedName(); 1619 return formattedName();
1620 1620
1621 QString n = assembledName(); 1621 QString n = assembledName();
1622 1622
1623 if ( n.isEmpty() ) 1623 if ( n.isEmpty() )
1624 n = name(); 1624 n = name();
1625 if ( n.isEmpty() ) 1625 if ( n.isEmpty() )
1626 n = organization(); 1626 n = organization();
1627 return n; 1627 return n;
1628} 1628}
1629 1629
1630QString Addressee::assembledName() const 1630QString Addressee::assembledName() const
1631{ 1631{
1632 QString name = prefix() + " " + givenName() + " " + additionalName() + " " + 1632 QString name = prefix() + " " + givenName() + " " + additionalName() + " " +
1633 familyName() + " " + suffix(); 1633 familyName() + " " + suffix();
1634 1634
1635 return name.simplifyWhiteSpace(); 1635 return name.simplifyWhiteSpace();
1636} 1636}
1637 1637
1638QString Addressee::fullEmail( const QString &email ) const 1638QString Addressee::fullEmail( const QString &email ) const
1639{ 1639{
1640 QString e; 1640 QString e;
1641 if ( email.isNull() ) { 1641 if ( email.isNull() ) {
1642 e = preferredEmail(); 1642 e = preferredEmail();
1643 } else { 1643 } else {
1644 e = email; 1644 e = email;
1645 } 1645 }
1646 if ( e.isEmpty() ) return QString::null; 1646 if ( e.isEmpty() ) return QString::null;
1647 1647
1648 QString text; 1648 QString text;
1649 if ( realName().isEmpty() ) 1649 if ( realName().isEmpty() )
1650 text = e; 1650 text = e;
1651 else 1651 else
1652 text = assembledName() + " <" + e + ">"; 1652 text = assembledName() + " <" + e + ">";
1653 1653
1654 return text; 1654 return text;
1655} 1655}
1656 1656
1657void Addressee::insertEmail( const QString &email, bool preferred ) 1657void Addressee::insertEmail( const QString &email, bool preferred )
1658{ 1658{
1659 detach(); 1659 detach();
1660 1660
1661 QStringList::Iterator it = mData->emails.find( email ); 1661 QStringList::Iterator it = mData->emails.find( email );
1662 1662
1663 if ( it != mData->emails.end() ) { 1663 if ( it != mData->emails.end() ) {
1664 if ( !preferred || it == mData->emails.begin() ) return; 1664 if ( !preferred || it == mData->emails.begin() ) return;
1665 mData->emails.remove( it ); 1665 mData->emails.remove( it );
1666 mData->emails.prepend( email ); 1666 mData->emails.prepend( email );
1667 } else { 1667 } else {
1668 if ( preferred ) { 1668 if ( preferred ) {
1669 mData->emails.prepend( email ); 1669 mData->emails.prepend( email );
1670 } else { 1670 } else {
1671 mData->emails.append( email ); 1671 mData->emails.append( email );
1672 } 1672 }
1673 } 1673 }
1674} 1674}
1675 1675
1676void Addressee::removeEmail( const QString &email ) 1676void Addressee::removeEmail( const QString &email )
1677{ 1677{
1678 detach(); 1678 detach();
1679 1679
1680 QStringList::Iterator it = mData->emails.find( email ); 1680 QStringList::Iterator it = mData->emails.find( email );
1681 if ( it == mData->emails.end() ) return; 1681 if ( it == mData->emails.end() ) return;
1682 1682
1683 mData->emails.remove( it ); 1683 mData->emails.remove( it );
1684} 1684}
1685 1685
1686QString Addressee::preferredEmail() const 1686QString Addressee::preferredEmail() const
1687{ 1687{
1688 if ( mData->emails.count() == 0 ) return QString::null; 1688 if ( mData->emails.count() == 0 ) return QString::null;
1689 else return mData->emails.first(); 1689 else return mData->emails.first();
1690} 1690}
1691 1691
1692QStringList Addressee::emails() const 1692QStringList Addressee::emails() const
1693{ 1693{
1694 return mData->emails; 1694 return mData->emails;
1695} 1695}
1696void Addressee::setEmails( const QStringList& emails ) { 1696void Addressee::setEmails( const QStringList& emails ) {
1697 detach(); 1697 detach();
1698 mData->emails = emails; 1698 mData->emails = emails;
1699} 1699}
1700void Addressee::insertPhoneNumber( const PhoneNumber &phoneNumber ) 1700void Addressee::insertPhoneNumber( const PhoneNumber &phoneNumber )
1701{ 1701{
1702 detach(); 1702 detach();
1703 mData->empty = false; 1703 mData->empty = false;
1704 PhoneNumber::List::Iterator it; 1704 PhoneNumber::List::Iterator it;
1705 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1705 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1706 if ( (*it).id() == phoneNumber.id() ) { 1706 if ( (*it).id() == phoneNumber.id() ) {
1707 *it = phoneNumber; 1707 *it = phoneNumber;
1708 return; 1708 return;
1709 } 1709 }
1710 } 1710 }
1711 mData->phoneNumbers.append( phoneNumber ); 1711 mData->phoneNumbers.append( phoneNumber );
1712} 1712}
1713 1713
1714void Addressee::removePhoneNumber( const PhoneNumber &phoneNumber ) 1714void Addressee::removePhoneNumber( const PhoneNumber &phoneNumber )
1715{ 1715{
1716 detach(); 1716 detach();
1717 1717
1718 PhoneNumber::List::Iterator it; 1718 PhoneNumber::List::Iterator it;
1719 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1719 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1720 if ( (*it).id() == phoneNumber.id() ) { 1720 if ( (*it).id() == phoneNumber.id() ) {
1721 mData->phoneNumbers.remove( it ); 1721 mData->phoneNumbers.remove( it );
1722 return; 1722 return;
1723 } 1723 }
1724 } 1724 }
1725} 1725}
1726 1726
1727PhoneNumber Addressee::phoneNumber( int type ) const 1727PhoneNumber Addressee::phoneNumber( int type ) const
1728{ 1728{
1729 PhoneNumber phoneNumber( "", type ); 1729 PhoneNumber phoneNumber( "", type );
1730 PhoneNumber::List::ConstIterator it; 1730 PhoneNumber::List::ConstIterator it;
1731 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1731 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1732 if ( matchBinaryPatternP( (*it).type(), type ) ) { 1732 if ( matchBinaryPatternP( (*it).type(), type ) ) {
1733 if ( (*it).type() & PhoneNumber::Pref ) 1733 if ( (*it).type() & PhoneNumber::Pref )
1734 return (*it); 1734 return (*it);
1735 else if ( phoneNumber.number().isEmpty() ) 1735 else if ( phoneNumber.number().isEmpty() )
1736 phoneNumber = (*it); 1736 phoneNumber = (*it);
1737 } 1737 }
1738 } 1738 }
1739 1739
1740 return phoneNumber; 1740 return phoneNumber;
1741} 1741}
1742 1742
1743PhoneNumber::List Addressee::phoneNumbers() const 1743PhoneNumber::List Addressee::phoneNumbers() const
1744{ 1744{
1745 return mData->phoneNumbers; 1745 return mData->phoneNumbers;
1746} 1746}
1747 1747
1748int Addressee::hasPhoneNumberType( int type ) 1748int Addressee::hasPhoneNumberType( int type )
1749{ 1749{
1750 int retval = 0; 1750 int retval = 0;
1751 PhoneNumber::List::ConstIterator it; 1751 PhoneNumber::List::ConstIterator it;
1752 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1752 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1753 if ( (*it).type() == type ) 1753 if ( (*it).type() == type )
1754 ++retval; 1754 ++retval;
1755 } 1755 }
1756 return retval; 1756 return retval;
1757} 1757}
1758PhoneNumber::List Addressee::phoneNumbers( int type ) const 1758PhoneNumber::List Addressee::phoneNumbers( int type ) const
1759{ 1759{
1760 PhoneNumber::List list; 1760 PhoneNumber::List list;
1761 1761
1762 PhoneNumber::List::ConstIterator it; 1762 PhoneNumber::List::ConstIterator it;
1763 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1763 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1764 if ( matchBinaryPattern( (*it).type(), type ) ) { 1764 if ( matchBinaryPattern( (*it).type(), type ) ) {
1765 list.append( *it ); 1765 list.append( *it );
1766 } 1766 }
1767 } 1767 }
1768 return list; 1768 return list;
1769} 1769}
1770QString Addressee::phoneNumberString( int type ) const 1770QString Addressee::phoneNumberString( int type ) const
1771{ 1771{
1772 1772
1773 PhoneNumber::List::ConstIterator it; 1773 PhoneNumber::List::ConstIterator it;
1774 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1774 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1775 if ((*it).type() == type ) { 1775 if ((*it).type() == type ) {
1776 return ( *it ).number(); 1776 return ( *it ).number();
1777 } 1777 }
1778 } 1778 }
1779 return ""; 1779 return "";
1780} 1780}
1781 1781
1782PhoneNumber Addressee::findPhoneNumber( const QString &id ) const 1782PhoneNumber Addressee::findPhoneNumber( const QString &id ) const
1783{ 1783{
1784 PhoneNumber::List::ConstIterator it; 1784 PhoneNumber::List::ConstIterator it;
1785 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 1785 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
1786 if ( (*it).id() == id ) { 1786 if ( (*it).id() == id ) {
1787 return *it; 1787 return *it;
1788 } 1788 }
1789 } 1789 }
1790 return PhoneNumber(); 1790 return PhoneNumber();
1791} 1791}
1792 1792
1793void Addressee::insertKey( const Key &key ) 1793void Addressee::insertKey( const Key &key )
1794{ 1794{
1795 detach(); 1795 detach();
1796 mData->empty = false; 1796 mData->empty = false;
1797 1797
1798 Key::List::Iterator it; 1798 Key::List::Iterator it;
1799 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 1799 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
1800 if ( (*it).id() == key.id() ) { 1800 if ( (*it).id() == key.id() ) {
1801 *it = key; 1801 *it = key;
1802 return; 1802 return;
1803 } 1803 }
1804 } 1804 }
1805 mData->keys.append( key ); 1805 mData->keys.append( key );
1806} 1806}
1807 1807
1808void Addressee::removeKey( const Key &key ) 1808void Addressee::removeKey( const Key &key )
1809{ 1809{
1810 detach(); 1810 detach();
1811 1811
1812 Key::List::Iterator it; 1812 Key::List::Iterator it;
1813 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 1813 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
1814 if ( (*it).id() == key.id() ) { 1814 if ( (*it).id() == key.id() ) {
1815 mData->keys.remove( key ); 1815 mData->keys.remove( key );
1816 return; 1816 return;
1817 } 1817 }
1818 } 1818 }
1819} 1819}
1820 1820
1821Key Addressee::key( int type, QString customTypeString ) const 1821Key Addressee::key( int type, QString customTypeString ) const
1822{ 1822{
1823 Key::List::ConstIterator it; 1823 Key::List::ConstIterator it;
1824 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 1824 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
1825 if ( (*it).type() == type ) { 1825 if ( (*it).type() == type ) {
1826 if ( type == Key::Custom ) { 1826 if ( type == Key::Custom ) {
1827 if ( customTypeString.isEmpty() ) { 1827 if ( customTypeString.isEmpty() ) {
1828 return *it; 1828 return *it;
1829 } else { 1829 } else {
1830 if ( (*it).customTypeString() == customTypeString ) 1830 if ( (*it).customTypeString() == customTypeString )
1831 return (*it); 1831 return (*it);
1832 } 1832 }
1833 } else { 1833 } else {
1834 return *it; 1834 return *it;
1835 } 1835 }
1836 } 1836 }
1837 } 1837 }
1838 return Key( QString(), type ); 1838 return Key( QString(), type );
1839} 1839}
1840void Addressee::setKeys( const Key::List& list ) { 1840void Addressee::setKeys( const Key::List& list ) {
1841 detach(); 1841 detach();
1842 mData->keys = list; 1842 mData->keys = list;
1843} 1843}
1844 1844
1845Key::List Addressee::keys() const 1845Key::List Addressee::keys() const
1846{ 1846{
1847 return mData->keys; 1847 return mData->keys;
1848} 1848}
1849 1849
1850Key::List Addressee::keys( int type, QString customTypeString ) const 1850Key::List Addressee::keys( int type, QString customTypeString ) const
1851{ 1851{
1852 Key::List list; 1852 Key::List list;
1853 1853
1854 Key::List::ConstIterator it; 1854 Key::List::ConstIterator it;
1855 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 1855 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
1856 if ( (*it).type() == type ) { 1856 if ( (*it).type() == type ) {
1857 if ( type == Key::Custom ) { 1857 if ( type == Key::Custom ) {
1858 if ( customTypeString.isEmpty() ) { 1858 if ( customTypeString.isEmpty() ) {
1859 list.append(*it); 1859 list.append(*it);
1860 } else { 1860 } else {
1861 if ( (*it).customTypeString() == customTypeString ) 1861 if ( (*it).customTypeString() == customTypeString )
1862 list.append(*it); 1862 list.append(*it);
1863 } 1863 }
1864 } else { 1864 } else {
1865 list.append(*it); 1865 list.append(*it);
1866 } 1866 }
1867 } 1867 }
1868 } 1868 }
1869 return list; 1869 return list;
1870} 1870}
1871 1871
1872Key Addressee::findKey( const QString &id ) const 1872Key Addressee::findKey( const QString &id ) const
1873{ 1873{
1874 Key::List::ConstIterator it; 1874 Key::List::ConstIterator it;
1875 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 1875 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
1876 if ( (*it).id() == id ) { 1876 if ( (*it).id() == id ) {
1877 return *it; 1877 return *it;
1878 } 1878 }
1879 } 1879 }
1880 return Key(); 1880 return Key();
1881} 1881}
1882 1882
1883QString Addressee::asString() const 1883QString Addressee::asString() const
1884{ 1884{
1885 return "Smith, agent Smith..."; 1885 return "Smith, agent Smith...";
1886} 1886}
1887 1887
1888void Addressee::dump() const 1888void Addressee::dump() const
1889{ 1889{
1890 return; 1890 return;
1891#if 0 1891#if 0
1892 kdDebug(5700) << "Addressee {" << endl; 1892 kdDebug(5700) << "Addressee {" << endl;
1893 1893
1894 kdDebug(5700) << " Uid: '" << uid() << "'" << endl; 1894 kdDebug(5700) << " Uid: '" << uid() << "'" << endl;
1895 1895
1896 kdDebug(5700) << " Name: '" << name() << "'" << endl; 1896 kdDebug(5700) << " Name: '" << name() << "'" << endl;
1897 kdDebug(5700) << " FormattedName: '" << formattedName() << "'" << endl; 1897 kdDebug(5700) << " FormattedName: '" << formattedName() << "'" << endl;
1898 kdDebug(5700) << " FamilyName: '" << familyName() << "'" << endl; 1898 kdDebug(5700) << " FamilyName: '" << familyName() << "'" << endl;
1899 kdDebug(5700) << " GivenName: '" << givenName() << "'" << endl; 1899 kdDebug(5700) << " GivenName: '" << givenName() << "'" << endl;
1900 kdDebug(5700) << " AdditionalName: '" << additionalName() << "'" << endl; 1900 kdDebug(5700) << " AdditionalName: '" << additionalName() << "'" << endl;
1901 kdDebug(5700) << " Prefix: '" << prefix() << "'" << endl; 1901 kdDebug(5700) << " Prefix: '" << prefix() << "'" << endl;
1902 kdDebug(5700) << " Suffix: '" << suffix() << "'" << endl; 1902 kdDebug(5700) << " Suffix: '" << suffix() << "'" << endl;
1903 kdDebug(5700) << " NickName: '" << nickName() << "'" << endl; 1903 kdDebug(5700) << " NickName: '" << nickName() << "'" << endl;
1904 kdDebug(5700) << " Birthday: '" << birthday().toString() << "'" << endl; 1904 kdDebug(5700) << " Birthday: '" << birthday().toString() << "'" << endl;
1905 kdDebug(5700) << " Mailer: '" << mailer() << "'" << endl; 1905 kdDebug(5700) << " Mailer: '" << mailer() << "'" << endl;
1906 kdDebug(5700) << " TimeZone: '" << timeZone().asString() << "'" << endl; 1906 kdDebug(5700) << " TimeZone: '" << timeZone().asString() << "'" << endl;
1907 kdDebug(5700) << " Geo: '" << geo().asString() << "'" << endl; 1907 kdDebug(5700) << " Geo: '" << geo().asString() << "'" << endl;
1908 kdDebug(5700) << " Title: '" << title() << "'" << endl; 1908 kdDebug(5700) << " Title: '" << title() << "'" << endl;
1909 kdDebug(5700) << " Role: '" << role() << "'" << endl; 1909 kdDebug(5700) << " Role: '" << role() << "'" << endl;
1910 kdDebug(5700) << " Organization: '" << organization() << "'" << endl; 1910 kdDebug(5700) << " Organization: '" << organization() << "'" << endl;
1911 kdDebug(5700) << " Note: '" << note() << "'" << endl; 1911 kdDebug(5700) << " Note: '" << note() << "'" << endl;
1912 kdDebug(5700) << " ProductId: '" << productId() << "'" << endl; 1912 kdDebug(5700) << " ProductId: '" << productId() << "'" << endl;
1913 kdDebug(5700) << " Revision: '" << revision().toString() << "'" << endl; 1913 kdDebug(5700) << " Revision: '" << revision().toString() << "'" << endl;
1914 kdDebug(5700) << " SortString: '" << sortString() << "'" << endl; 1914 kdDebug(5700) << " SortString: '" << sortString() << "'" << endl;
1915 kdDebug(5700) << " Url: '" << url().url() << "'" << endl; 1915 kdDebug(5700) << " Url: '" << url().url() << "'" << endl;
1916 kdDebug(5700) << " Secrecy: '" << secrecy().asString() << "'" << endl; 1916 kdDebug(5700) << " Secrecy: '" << secrecy().asString() << "'" << endl;
1917 kdDebug(5700) << " Logo: '" << logo().asString() << "'" << endl; 1917 kdDebug(5700) << " Logo: '" << logo().asString() << "'" << endl;
1918 kdDebug(5700) << " Photo: '" << photo().asString() << "'" << endl; 1918 kdDebug(5700) << " Photo: '" << photo().asString() << "'" << endl;
1919 kdDebug(5700) << " Sound: '" << sound().asString() << "'" << endl; 1919 kdDebug(5700) << " Sound: '" << sound().asString() << "'" << endl;
1920 kdDebug(5700) << " Agent: '" << agent().asString() << "'" << endl; 1920 kdDebug(5700) << " Agent: '" << agent().asString() << "'" << endl;
1921 1921
1922 kdDebug(5700) << " Emails {" << endl; 1922 kdDebug(5700) << " Emails {" << endl;
1923 QStringList e = emails(); 1923 QStringList e = emails();
1924 QStringList::ConstIterator it; 1924 QStringList::ConstIterator it;
1925 for( it = e.begin(); it != e.end(); ++it ) { 1925 for( it = e.begin(); it != e.end(); ++it ) {
1926 kdDebug(5700) << " " << (*it) << endl; 1926 kdDebug(5700) << " " << (*it) << endl;
1927 } 1927 }
1928 kdDebug(5700) << " }" << endl; 1928 kdDebug(5700) << " }" << endl;
1929 1929
1930 kdDebug(5700) << " PhoneNumbers {" << endl; 1930 kdDebug(5700) << " PhoneNumbers {" << endl;