summaryrefslogtreecommitdiffabout
path: root/kabc/addressee.cpp
authorzautrix <zautrix>2004-10-29 14:01:58 (UTC)
committer zautrix <zautrix>2004-10-29 14:01:58 (UTC)
commit102cc4a711e303372efea9797623ee2d9f27f63c (patch) (unidiff)
tree32e56b436e52b5b1bab701839a24fc175288d57c /kabc/addressee.cpp
parent8c55eb6afe84ef69bb284d384a0c9f1ef1484ad8 (diff)
downloadkdepimpi-102cc4a711e303372efea9797623ee2d9f27f63c.zip
kdepimpi-102cc4a711e303372efea9797623ee2d9f27f63c.tar.gz
kdepimpi-102cc4a711e303372efea9797623ee2d9f27f63c.tar.bz2
removed debug output
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 3d4992c..028d3bb 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -1,659 +1,659 @@
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 <kidmanager.h> 35#include <kidmanager.h>
36//US 36//US
37#include <kstandarddirs.h> 37#include <kstandarddirs.h>
38#include <libkcal/syncdefines.h> 38#include <libkcal/syncdefines.h>
39 39
40//US #include "resource.h" 40//US #include "resource.h"
41#include "addressee.h" 41#include "addressee.h"
42 42
43using namespace KABC; 43using namespace KABC;
44 44
45static bool matchBinaryPattern( int value, int pattern ); 45static bool matchBinaryPattern( int value, int pattern );
46static bool matchBinaryPatternA( int value, int pattern ); 46static bool matchBinaryPatternA( int value, int pattern );
47static bool matchBinaryPatternP( int value, int pattern ); 47static bool matchBinaryPatternP( int value, int pattern );
48 48
49struct Addressee::AddresseeData : public KShared 49struct Addressee::AddresseeData : public KShared
50{ 50{
51 QString uid; 51 QString uid;
52 QString name; 52 QString name;
53 QString formattedName; 53 QString formattedName;
54 QString familyName; 54 QString familyName;
55 QString givenName; 55 QString givenName;
56 QString additionalName; 56 QString additionalName;
57 QString prefix; 57 QString prefix;
58 QString suffix; 58 QString suffix;
59 QString nickName; 59 QString nickName;
60 QDateTime birthday; 60 QDateTime birthday;
61 QString mailer; 61 QString mailer;
62 TimeZone timeZone; 62 TimeZone timeZone;
63 Geo geo; 63 Geo geo;
64 QString title; 64 QString title;
65 QString role; 65 QString role;
66 QString organization; 66 QString organization;
67 QString note; 67 QString note;
68 QString productId; 68 QString productId;
69 QDateTime revision; 69 QDateTime revision;
70 QString sortString; 70 QString sortString;
71 QString externalUID; 71 QString externalUID;
72 QString originalExternalUID; 72 QString originalExternalUID;
73 KURL url; 73 KURL url;
74 Secrecy secrecy; 74 Secrecy secrecy;
75 Picture logo; 75 Picture logo;
76 Picture photo; 76 Picture photo;
77 Sound sound; 77 Sound sound;
78 Agent agent; 78 Agent agent;
79 QString mExternalId; 79 QString mExternalId;
80 PhoneNumber::List phoneNumbers; 80 PhoneNumber::List phoneNumbers;
81 Address::List addresses; 81 Address::List addresses;
82 Key::List keys; 82 Key::List keys;
83 QStringList emails; 83 QStringList emails;
84 QStringList categories; 84 QStringList categories;
85 QStringList custom; 85 QStringList custom;
86 int mTempSyncStat; 86 int mTempSyncStat;
87 Resource *resource; 87 Resource *resource;
88 88
89 bool empty :1; 89 bool empty :1;
90 bool changed :1; 90 bool changed :1;
91 bool tagged :1; 91 bool tagged :1;
92}; 92};
93 93
94Addressee::Addressee() 94Addressee::Addressee()
95{ 95{
96 mData = new AddresseeData; 96 mData = new AddresseeData;
97 mData->empty = true; 97 mData->empty = true;
98 mData->changed = false; 98 mData->changed = false;
99 mData->resource = 0; 99 mData->resource = 0;
100 mData->mExternalId = ":"; 100 mData->mExternalId = ":";
101 mData->revision = QDateTime ( QDate( 2003,1,1)); 101 mData->revision = QDateTime ( QDate( 2003,1,1));
102 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; 102 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
103} 103}
104 104
105Addressee::~Addressee() 105Addressee::~Addressee()
106{ 106{
107} 107}
108 108
109Addressee::Addressee( const Addressee &a ) 109Addressee::Addressee( const Addressee &a )
110{ 110{
111 mData = a.mData; 111 mData = a.mData;
112} 112}
113 113
114Addressee &Addressee::operator=( const Addressee &a ) 114Addressee &Addressee::operator=( const Addressee &a )
115{ 115{
116 mData = a.mData; 116 mData = a.mData;
117 return (*this); 117 return (*this);
118} 118}
119 119
120Addressee Addressee::copy() 120Addressee Addressee::copy()
121{ 121{
122 Addressee a; 122 Addressee a;
123 *(a.mData) = *mData; 123 *(a.mData) = *mData;
124 return a; 124 return a;
125} 125}
126 126
127void Addressee::detach() 127void Addressee::detach()
128{ 128{
129 if ( mData.count() == 1 ) return; 129 if ( mData.count() == 1 ) return;
130 *this = copy(); 130 *this = copy();
131} 131}
132 132
133bool Addressee::operator==( const Addressee &a ) const 133bool Addressee::operator==( const Addressee &a ) const
134{ 134{
135 if ( uid() != a.uid() ) return false; 135 if ( uid() != a.uid() ) return false;
136 if ( mData->name != a.mData->name ) return false; 136 if ( mData->name != a.mData->name ) return false;
137 if ( mData->formattedName != a.mData->formattedName ) return false; 137 if ( mData->formattedName != a.mData->formattedName ) return false;
138 if ( mData->familyName != a.mData->familyName ) return false; 138 if ( mData->familyName != a.mData->familyName ) return false;
139 if ( mData->givenName != a.mData->givenName ) return false; 139 if ( mData->givenName != a.mData->givenName ) return false;
140 if ( mData->additionalName != a.mData->additionalName ) return false; 140 if ( mData->additionalName != a.mData->additionalName ) return false;
141 if ( mData->prefix != a.mData->prefix ) return false; 141 if ( mData->prefix != a.mData->prefix ) return false;
142 if ( mData->suffix != a.mData->suffix ) return false; 142 if ( mData->suffix != a.mData->suffix ) return false;
143 if ( mData->nickName != a.mData->nickName ) return false; 143 if ( mData->nickName != a.mData->nickName ) return false;
144 if ( mData->birthday != a.mData->birthday ) return false; 144 if ( mData->birthday != a.mData->birthday ) return false;
145 if ( mData->mailer != a.mData->mailer ) return false; 145 if ( mData->mailer != a.mData->mailer ) return false;
146 if ( mData->timeZone != a.mData->timeZone ) return false; 146 if ( mData->timeZone != a.mData->timeZone ) return false;
147 if ( mData->geo != a.mData->geo ) return false; 147 if ( mData->geo != a.mData->geo ) return false;
148 if ( mData->title != a.mData->title ) return false; 148 if ( mData->title != a.mData->title ) return false;
149 if ( mData->role != a.mData->role ) return false; 149 if ( mData->role != a.mData->role ) return false;
150 if ( mData->organization != a.mData->organization ) return false; 150 if ( mData->organization != a.mData->organization ) return false;
151 if ( mData->note != a.mData->note ) return false; 151 if ( mData->note != a.mData->note ) return false;
152 if ( mData->productId != a.mData->productId ) return false; 152 if ( mData->productId != a.mData->productId ) return false;
153 //if ( mData->revision != a.mData->revision ) return false; 153 //if ( mData->revision != a.mData->revision ) return false;
154 if ( mData->sortString != a.mData->sortString ) return false; 154 if ( mData->sortString != a.mData->sortString ) return false;
155 if ( mData->secrecy != a.mData->secrecy ) return false; 155 if ( mData->secrecy != a.mData->secrecy ) return false;
156 if ( mData->logo != a.mData->logo ) return false; 156 if ( mData->logo != a.mData->logo ) return false;
157 if ( mData->photo != a.mData->photo ) return false; 157 if ( mData->photo != a.mData->photo ) return false;
158 if ( mData->sound != a.mData->sound ) return false; 158 if ( mData->sound != a.mData->sound ) return false;
159 if ( mData->agent != a.mData->agent ) return false; 159 if ( mData->agent != a.mData->agent ) return false;
160 if ( ( mData->url.isValid() || a.mData->url.isValid() ) && 160 if ( ( mData->url.isValid() || a.mData->url.isValid() ) &&
161 ( mData->url != a.mData->url ) ) return false; 161 ( mData->url != a.mData->url ) ) return false;
162 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; 162 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false;
163 if ( mData->addresses != a.mData->addresses ) return false; 163 if ( mData->addresses != a.mData->addresses ) return false;
164 if ( mData->keys != a.mData->keys ) return false; 164 if ( mData->keys != a.mData->keys ) return false;
165 if ( mData->emails != a.mData->emails ) return false; 165 if ( mData->emails != a.mData->emails ) return false;
166 if ( mData->categories != a.mData->categories ) return false; 166 if ( mData->categories != a.mData->categories ) return false;
167 if ( mData->custom != a.mData->custom ) return false; 167 if ( mData->custom != a.mData->custom ) return false;
168 168
169 return true; 169 return true;
170} 170}
171 171
172bool Addressee::operator!=( const Addressee &a ) const 172bool Addressee::operator!=( const Addressee &a ) const
173{ 173{
174 return !( a == *this ); 174 return !( a == *this );
175} 175}
176 176
177bool Addressee::isEmpty() const 177bool Addressee::isEmpty() const
178{ 178{
179 return mData->empty; 179 return mData->empty;
180} 180}
181ulong Addressee::getCsum4List( const QStringList & attList) 181ulong Addressee::getCsum4List( const QStringList & attList)
182{ 182{
183 int max = attList.count(); 183 int max = attList.count();
184 ulong cSum = 0; 184 ulong cSum = 0;
185 int j,k,i; 185 int j,k,i;
186 int add; 186 int add;
187 for ( i = 0; i < max ; ++i ) { 187 for ( i = 0; i < max ; ++i ) {
188 QString s = attList[i]; 188 QString s = attList[i];
189 if ( ! s.isEmpty() ){ 189 if ( ! s.isEmpty() ){
190 j = s.length(); 190 j = s.length();
191 for ( k = 0; k < j; ++k ) { 191 for ( k = 0; k < j; ++k ) {
192 int mul = k +1; 192 int mul = k +1;
193 add = s[k].unicode (); 193 add = s[k].unicode ();
194 if ( k < 16 ) 194 if ( k < 16 )
195 mul = mul * mul; 195 mul = mul * mul;
196 int ii = i+1; 196 int ii = i+1;
197 add = add * mul *ii*ii*ii; 197 add = add * mul *ii*ii*ii;
198 cSum += add; 198 cSum += add;
199 } 199 }
200 } 200 }
201 201
202 } 202 }
203 //QString dump = attList.join(","); 203 //QString dump = attList.join(",");
204 //qDebug("csum: %d %s", cSum,dump.latin1()); 204 //qDebug("csum: %d %s", cSum,dump.latin1());
205 205
206 return cSum; 206 return cSum;
207 207
208} 208}
209void Addressee::computeCsum(const QString &dev) 209void Addressee::computeCsum(const QString &dev)
210{ 210{
211 QStringList l; 211 QStringList l;
212 //if ( !mData->name.isEmpty() ) l.append(mData->name); 212 //if ( !mData->name.isEmpty() ) l.append(mData->name);
213 //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); 213 //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName );
214 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); 214 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName );
215 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); 215 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName );
216 if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); 216 if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName );
217 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); 217 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix );
218 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); 218 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix );
219 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); 219 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName );
220 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); 220 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() );
221 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); 221 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer );
222 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); 222 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
223 if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); 223 if ( mData->geo.isValid() ) l.append( mData->geo.asString() );
224 if ( !mData->title .isEmpty() ) l.append( mData->title ); 224 if ( !mData->title .isEmpty() ) l.append( mData->title );
225 if ( !mData->role.isEmpty() ) l.append( mData->role ); 225 if ( !mData->role.isEmpty() ) l.append( mData->role );
226 if ( !mData->organization.isEmpty() ) l.append( mData->organization ); 226 if ( !mData->organization.isEmpty() ) l.append( mData->organization );
227 if ( !mData->note.isEmpty() ) l.append( mData->note ); 227 if ( !mData->note.isEmpty() ) l.append( mData->note );
228 if ( !mData->productId.isEmpty() ) l.append(mData->productId ); 228 if ( !mData->productId.isEmpty() ) l.append(mData->productId );
229 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); 229 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString );
230 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); 230 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString());
231 // if ( !mData->logo.isEmpty() ) l.append( ); 231 // if ( !mData->logo.isEmpty() ) l.append( );
232 //if ( !mData->photo.isEmpty() ) l.append( ); 232 //if ( !mData->photo.isEmpty() ) l.append( );
233 //if ( !mData->sound.isEmpty() ) l.append( ); 233 //if ( !mData->sound.isEmpty() ) l.append( );
234 //if ( !mData->agent.isEmpty() ) l.append( ); 234 //if ( !mData->agent.isEmpty() ) l.append( );
235 if ( mData->url.isValid() ) 235 if ( mData->url.isValid() )
236 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); 236 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() );
237 KABC::PhoneNumber::List phoneNumbers; 237 KABC::PhoneNumber::List phoneNumbers;
238 KABC::PhoneNumber::List::Iterator phoneIter; 238 KABC::PhoneNumber::List::Iterator phoneIter;
239 239
240 QStringList t; 240 QStringList t;
241 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 241 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
242 ++phoneIter ) 242 ++phoneIter )
243 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); 243 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) );
244 t.sort(); 244 t.sort();
245 uint iii; 245 uint iii;
246 for ( iii = 0; iii < t.count(); ++iii) 246 for ( iii = 0; iii < t.count(); ++iii)
247 l.append( t[iii] ); 247 l.append( t[iii] );
248 t = mData->emails; 248 t = mData->emails;
249 t.sort(); 249 t.sort();
250 for ( iii = 0; iii < t.count(); ++iii) 250 for ( iii = 0; iii < t.count(); ++iii)
251 l.append( t[iii] ); 251 l.append( t[iii] );
252 t = mData->categories; 252 t = mData->categories;
253 t.sort(); 253 t.sort();
254 for ( iii = 0; iii < t.count(); ++iii) 254 for ( iii = 0; iii < t.count(); ++iii)
255 l.append( t[iii] ); 255 l.append( t[iii] );
256 t = mData->custom; 256 t = mData->custom;
257 t.sort(); 257 t.sort();
258 for ( iii = 0; iii < t.count(); ++iii) 258 for ( iii = 0; iii < t.count(); ++iii)
259 if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) { 259 if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) {
260 int find = t[iii].find (':')+1; 260 int find = t[iii].find (':')+1;
261 //qDebug("lennnn %d %d ", find, t[iii].length()); 261 //qDebug("lennnn %d %d ", find, t[iii].length());
262 if ( find < t[iii].length()) 262 if ( find < t[iii].length())
263 l.append( t[iii] ); 263 l.append( t[iii] );
264 264
265 } 265 }
266 KABC::Address::List::Iterator addressIter; 266 KABC::Address::List::Iterator addressIter;
267 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 267 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
268 ++addressIter ) { 268 ++addressIter ) {
269 t = (*addressIter).asList(); 269 t = (*addressIter).asList();
270 t.sort(); 270 t.sort();
271 for ( iii = 0; iii < t.count(); ++iii) 271 for ( iii = 0; iii < t.count(); ++iii)
272 l.append( t[iii] ); 272 l.append( t[iii] );
273 } 273 }
274 uint cs = getCsum4List(l); 274 uint cs = getCsum4List(l);
275#if 1 275#if 0
276 for ( iii = 0; iii < l.count(); ++iii) 276 for ( iii = 0; iii < l.count(); ++iii)
277 qDebug("%d***%s***",iii,l[iii].latin1()); 277 qDebug("%d***%s***",iii,l[iii].latin1());
278 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); 278 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
279#endif 279#endif
280 setCsum( dev, QString::number (cs )); 280 setCsum( dev, QString::number (cs ));
281} 281}
282 282
283void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) 283void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
284{ 284{
285 285
286 detach(); 286 detach();
287 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 287 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
288 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 288 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
289 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 289 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
290 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 290 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
291 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 291 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
292 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; 292 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
293 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; 293 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
294 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; 294 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
295 if ( !mData->birthday.isValid() ) 295 if ( !mData->birthday.isValid() )
296 if ( ad.mData->birthday.isValid()) 296 if ( ad.mData->birthday.isValid())
297 mData->birthday = ad.mData->birthday; 297 mData->birthday = ad.mData->birthday;
298 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 298 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
299 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 299 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
300 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 300 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
301 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 301 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
302 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 302 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
303 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 303 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
304 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; 304 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
305 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; 305 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
306 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; 306 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
307 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; 307 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
308 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; 308 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
309 QStringList t; 309 QStringList t;
310 QStringList tAD; 310 QStringList tAD;
311 uint iii; 311 uint iii;
312 312
313 // ********** phone numbers 313 // ********** phone numbers
314 PhoneNumber::List phoneAD = ad.phoneNumbers(); 314 PhoneNumber::List phoneAD = ad.phoneNumbers();
315 PhoneNumber::List::Iterator phoneItAD; 315 PhoneNumber::List::Iterator phoneItAD;
316 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { 316 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
317 bool found = false; 317 bool found = false;
318 PhoneNumber::List::Iterator it; 318 PhoneNumber::List::Iterator it;
319 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 319 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
320 if ( ( *phoneItAD ).contains( (*it) ) ) { 320 if ( ( *phoneItAD ).contains( (*it) ) ) {
321 found = true; 321 found = true;
322 (*it).setType( ( *phoneItAD ).type() ); 322 (*it).setType( ( *phoneItAD ).type() );
323 (*it).setNumber( ( *phoneItAD ).number() ); 323 (*it).setNumber( ( *phoneItAD ).number() );
324 break; 324 break;
325 } 325 }
326 } 326 }
327 if ( isSubSet && ! found ) 327 if ( isSubSet && ! found )
328 mData->phoneNumbers.append( *phoneItAD ); 328 mData->phoneNumbers.append( *phoneItAD );
329 } 329 }
330 if ( isSubSet ) { 330 if ( isSubSet ) {
331 // ************* emails; 331 // ************* emails;
332 t = mData->emails; 332 t = mData->emails;
333 tAD = ad.mData->emails; 333 tAD = ad.mData->emails;
334 for ( iii = 0; iii < tAD.count(); ++iii) 334 for ( iii = 0; iii < tAD.count(); ++iii)
335 if ( !t.contains(tAD[iii] ) ) 335 if ( !t.contains(tAD[iii] ) )
336 mData->emails.append( tAD[iii] ); 336 mData->emails.append( tAD[iii] );
337 } 337 }
338 338
339 // ************* categories; 339 // ************* categories;
340 t = mData->categories; 340 t = mData->categories;
341 tAD = ad.mData->categories; 341 tAD = ad.mData->categories;
342 for ( iii = 0; iii < tAD.count(); ++iii) 342 for ( iii = 0; iii < tAD.count(); ++iii)
343 if ( !t.contains(tAD[iii] ) ) 343 if ( !t.contains(tAD[iii] ) )
344 mData->categories.append( tAD[iii] ); 344 mData->categories.append( tAD[iii] );
345 QStringList::ConstIterator it; 345 QStringList::ConstIterator it;
346 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { 346 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) {
347 QString qualifiedName = (*it).left( (*it).find( ":" )); 347 QString qualifiedName = (*it).left( (*it).find( ":" ));
348 bool found = false; 348 bool found = false;
349 QStringList::ConstIterator itL; 349 QStringList::ConstIterator itL;
350 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { 350 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) {
351 if ( (*itL).startsWith( qualifiedName ) ) { 351 if ( (*itL).startsWith( qualifiedName ) ) {
352 found = true; 352 found = true;
353 break; 353 break;
354 } 354 }
355 } 355 }
356 if ( ! found ) { 356 if ( ! found ) {
357 mData->custom.append( *it ); 357 mData->custom.append( *it );
358 } 358 }
359 } 359 }
360 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; 360 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo;
361 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; 361 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo;
362 if ( !mData->sound.isIntern() ) { 362 if ( !mData->sound.isIntern() ) {
363 if ( mData->sound.url().isEmpty() ) { 363 if ( mData->sound.url().isEmpty() ) {
364 mData->sound = ad.mData->sound; 364 mData->sound = ad.mData->sound;
365 } 365 }
366 } 366 }
367 if ( !mData->agent.isIntern() ) { 367 if ( !mData->agent.isIntern() ) {
368 if ( mData->agent.url().isEmpty() ) { 368 if ( mData->agent.url().isEmpty() ) {
369 mData->agent = ad.mData->agent; 369 mData->agent = ad.mData->agent;
370 } 370 }
371 } 371 }
372 { 372 {
373 Key::List::Iterator itA; 373 Key::List::Iterator itA;
374 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { 374 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) {
375 bool found = false; 375 bool found = false;
376 Key::List::Iterator it; 376 Key::List::Iterator it;
377 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 377 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
378 if ( (*it) == (*itA)) { 378 if ( (*it) == (*itA)) {
379 found = true; 379 found = true;
380 break; 380 break;
381 381
382 } 382 }
383 } 383 }
384 if ( ! found ) { 384 if ( ! found ) {
385 mData->keys.append( *itA ); 385 mData->keys.append( *itA );
386 } 386 }
387 } 387 }
388 } 388 }
389 KABC::Address::List::Iterator addressIterA; 389 KABC::Address::List::Iterator addressIterA;
390 for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { 390 for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) {
391 bool found = false; 391 bool found = false;
392 KABC::Address::List::Iterator addressIter; 392 KABC::Address::List::Iterator addressIter;
393 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 393 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
394 ++addressIter ) { 394 ++addressIter ) {
395 if ( (*addressIter) == (*addressIterA)) { 395 if ( (*addressIter) == (*addressIterA)) {
396 found = true; 396 found = true;
397 (*addressIter).setType( (*addressIterA).type() ); 397 (*addressIter).setType( (*addressIterA).type() );
398 break; 398 break;
399 } 399 }
400 400
401 } 401 }
402 if ( isSubSet && ! found ) { 402 if ( isSubSet && ! found ) {
403 mData->addresses.append( *addressIterA ); 403 mData->addresses.append( *addressIterA );
404 } 404 }
405 } 405 }
406 //qDebug("merge contact %s ", ad.uid().latin1()); 406 //qDebug("merge contact %s ", ad.uid().latin1());
407 setUid( ad.uid() ); 407 setUid( ad.uid() );
408 setRevision( ad.revision() ); 408 setRevision( ad.revision() );
409} 409}
410 410
411bool Addressee::removeVoice() 411bool Addressee::removeVoice()
412{ 412{
413 PhoneNumber::List phoneN = phoneNumbers(); 413 PhoneNumber::List phoneN = phoneNumbers();
414 PhoneNumber::List::Iterator phoneIt; 414 PhoneNumber::List::Iterator phoneIt;
415 bool found = false; 415 bool found = false;
416 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { 416 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
417 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 417 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
418 if ((*phoneIt).type() - PhoneNumber::Voice ) { 418 if ((*phoneIt).type() - PhoneNumber::Voice ) {
419 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 419 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
420 insertPhoneNumber( (*phoneIt) ); 420 insertPhoneNumber( (*phoneIt) );
421 found = true; 421 found = true;
422 } 422 }
423 } 423 }
424 424
425 } 425 }
426 return found; 426 return found;
427} 427}
428 428
429bool Addressee::containsAdr(const Addressee& ad ) 429bool Addressee::containsAdr(const Addressee& ad )
430{ 430{
431 if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; 431 if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false;
432 if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; 432 if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false;
433 if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; 433 if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ;
434 if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; 434 if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ;
435 if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; 435 if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ;
436 if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; 436 if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ;
437 if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; 437 if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ;
438 438
439 // compare phone numbers 439 // compare phone numbers
440 PhoneNumber::List phoneN = ad.phoneNumbers(); 440 PhoneNumber::List phoneN = ad.phoneNumbers();
441 PhoneNumber::List::Iterator phoneIt; 441 PhoneNumber::List::Iterator phoneIt;
442 bool found = false; 442 bool found = false;
443 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { 443 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
444 bool found = false; 444 bool found = false;
445 PhoneNumber::List phoneL = ad.phoneNumbers(); 445 PhoneNumber::List phoneL = ad.phoneNumbers();
446 PhoneNumber::List::Iterator phoneItL; 446 PhoneNumber::List::Iterator phoneItL;
447 for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { 447 for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) {
448 if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { 448 if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) {
449 found = true; 449 found = true;
450 break; 450 break;
451 } 451 }
452 } 452 }
453 if ( ! found ) 453 if ( ! found )
454 return false; 454 return false;
455 } 455 }
456 return true; 456 return true;
457 457
458} 458}
459void Addressee::simplifyAddresses() 459void Addressee::simplifyAddresses()
460{ 460{
461 461
462 462
463 Address::List list; 463 Address::List list;
464 Address::List::Iterator it; 464 Address::List::Iterator it;
465 Address::List::Iterator it2; 465 Address::List::Iterator it2;
466 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 466 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
467 it2 = it; 467 it2 = it;
468 ++it2; 468 ++it2;
469 for( ; it2 != mData->addresses.end(); ++it2 ) { 469 for( ; it2 != mData->addresses.end(); ++it2 ) {
470 if ( (*it) == (*it2) ) { 470 if ( (*it) == (*it2) ) {
471 list.append( *it ); 471 list.append( *it );
472 break; 472 break;
473 } 473 }
474 } 474 }
475 } 475 }
476 for( it = list.begin(); it != list.end(); ++it ) { 476 for( it = list.begin(); it != list.end(); ++it ) {
477 removeAddress( (*it) ); 477 removeAddress( (*it) );
478 } 478 }
479 479
480 list.clear(); 480 list.clear();
481 int max = 2; 481 int max = 2;
482 if ( mData->url.isValid() ) 482 if ( mData->url.isValid() )
483 max = 1; 483 max = 1;
484 if ( mData->addresses.count() <= max ) return ; 484 if ( mData->addresses.count() <= max ) return ;
485 int count = 0; 485 int count = 0;
486 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 486 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
487 if ( count >= max ) 487 if ( count >= max )
488 list.append( *it ); 488 list.append( *it );
489 ++count; 489 ++count;
490 } 490 }
491 for( it = list.begin(); it != list.end(); ++it ) { 491 for( it = list.begin(); it != list.end(); ++it ) {
492 removeAddress( (*it) ); 492 removeAddress( (*it) );
493 } 493 }
494} 494}
495 495
496// removes all emails but the first 496// removes all emails but the first
497// needed by phone sync 497// needed by phone sync
498void Addressee::simplifyEmails() 498void Addressee::simplifyEmails()
499{ 499{
500 if ( mData->emails.count() == 0 ) return ; 500 if ( mData->emails.count() == 0 ) return ;
501 QString email = mData->emails.first(); 501 QString email = mData->emails.first();
502 detach(); 502 detach();
503 mData->emails.clear(); 503 mData->emails.clear();
504 mData->emails.append( email ); 504 mData->emails.append( email );
505} 505}
506 506
507void Addressee::simplifyPhoneNumbers() 507void Addressee::simplifyPhoneNumbers()
508{ 508{
509 int max = 4; 509 int max = 4;
510 int inList = mData->phoneNumbers.count(); 510 int inList = mData->phoneNumbers.count();
511 KABC::PhoneNumber::List removeNumbers; 511 KABC::PhoneNumber::List removeNumbers;
512 KABC::PhoneNumber::List::Iterator phoneIter; 512 KABC::PhoneNumber::List::Iterator phoneIter;
513 if ( inList > max ) { 513 if ( inList > max ) {
514 // delete non-preferred numbers 514 // delete non-preferred numbers
515 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 515 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
516 ++phoneIter ) { 516 ++phoneIter ) {
517 if ( inList > max ) { 517 if ( inList > max ) {
518 if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { 518 if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) {
519 removeNumbers.append( ( *phoneIter ) ); 519 removeNumbers.append( ( *phoneIter ) );
520 --inList; 520 --inList;
521 } 521 }
522 } else 522 } else
523 break; 523 break;
524 } 524 }
525 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 525 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
526 ++phoneIter ) { 526 ++phoneIter ) {
527 removePhoneNumber(( *phoneIter )); 527 removePhoneNumber(( *phoneIter ));
528 } 528 }
529 // delete preferred numbers 529 // delete preferred numbers
530 if ( inList > max ) { 530 if ( inList > max ) {
531 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 531 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
532 ++phoneIter ) { 532 ++phoneIter ) {
533 if ( inList > max ) { 533 if ( inList > max ) {
534 removeNumbers.append( ( *phoneIter ) ); 534 removeNumbers.append( ( *phoneIter ) );
535 --inList; 535 --inList;
536 } else 536 } else
537 break; 537 break;
538 } 538 }
539 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 539 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
540 ++phoneIter ) { 540 ++phoneIter ) {
541 removePhoneNumber(( *phoneIter )); 541 removePhoneNumber(( *phoneIter ));
542 } 542 }
543 } 543 }
544 } 544 }
545 // remove non-numeric characters 545 // remove non-numeric characters
546 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 546 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
547 ++phoneIter ) { 547 ++phoneIter ) {
548 if ( ! ( *phoneIter ).simplifyNumber() ) 548 if ( ! ( *phoneIter ).simplifyNumber() )
549 removeNumbers.append( ( *phoneIter ) ); 549 removeNumbers.append( ( *phoneIter ) );
550 } 550 }
551 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 551 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
552 ++phoneIter ) { 552 ++phoneIter ) {
553 removePhoneNumber(( *phoneIter )); 553 removePhoneNumber(( *phoneIter ));
554 } 554 }
555} 555}
556void Addressee::simplifyPhoneNumberTypes() 556void Addressee::simplifyPhoneNumberTypes()
557{ 557{
558 KABC::PhoneNumber::List::Iterator phoneIter; 558 KABC::PhoneNumber::List::Iterator phoneIter;
559 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 559 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
560 ++phoneIter ) 560 ++phoneIter )
561 ( *phoneIter ).simplifyType(); 561 ( *phoneIter ).simplifyType();
562} 562}
563void Addressee::removeID(const QString &prof) 563void Addressee::removeID(const QString &prof)
564{ 564{
565 detach(); 565 detach();
566 if ( prof.isEmpty() ) 566 if ( prof.isEmpty() )
567 mData->mExternalId = ":"; 567 mData->mExternalId = ":";
568 else 568 else
569 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 569 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
570 570
571} 571}
572void Addressee::setID( const QString & prof , const QString & id ) 572void Addressee::setID( const QString & prof , const QString & id )
573{ 573{
574 detach(); 574 detach();
575 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 575 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
576 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 576 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
577} 577}
578void Addressee::setTempSyncStat( int id ) 578void Addressee::setTempSyncStat( int id )
579{ 579{
580 if ( mData->mTempSyncStat == id ) return; 580 if ( mData->mTempSyncStat == id ) return;
581 detach(); 581 detach();
582 mData->mTempSyncStat = id; 582 mData->mTempSyncStat = id;
583} 583}
584int Addressee::tempSyncStat() const 584int Addressee::tempSyncStat() const
585{ 585{
586 return mData->mTempSyncStat; 586 return mData->mTempSyncStat;
587} 587}
588 588
589QString Addressee::getID( const QString & prof) 589QString Addressee::getID( const QString & prof)
590{ 590{
591 return KIdManager::getId ( mData->mExternalId, prof ); 591 return KIdManager::getId ( mData->mExternalId, prof );
592} 592}
593 593
594void Addressee::setCsum( const QString & prof , const QString & id ) 594void Addressee::setCsum( const QString & prof , const QString & id )
595{ 595{
596 detach(); 596 detach();
597 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 597 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
598 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); 598 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
599 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); 599 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
600} 600}
601 601
602QString Addressee::getCsum( const QString & prof) 602QString Addressee::getCsum( const QString & prof)
603{ 603{
604 return KIdManager::getCsum ( mData->mExternalId, prof ); 604 return KIdManager::getCsum ( mData->mExternalId, prof );
605} 605}
606 606
607void Addressee::setIDStr( const QString & s ) 607void Addressee::setIDStr( const QString & s )
608{ 608{
609 detach(); 609 detach();
610 mData->mExternalId = s; 610 mData->mExternalId = s;
611} 611}
612 612
613QString Addressee::IDStr() const 613QString Addressee::IDStr() const
614{ 614{
615 return mData->mExternalId; 615 return mData->mExternalId;
616} 616}
617 617
618void Addressee::setExternalUID( const QString &id ) 618void Addressee::setExternalUID( const QString &id )
619{ 619{
620 if ( id == mData->externalUID ) return; 620 if ( id == mData->externalUID ) return;
621 detach(); 621 detach();
622 mData->empty = false; 622 mData->empty = false;
623 mData->externalUID = id; 623 mData->externalUID = id;
624} 624}
625 625
626QString Addressee::externalUID() const 626QString Addressee::externalUID() const
627{ 627{
628 return mData->externalUID; 628 return mData->externalUID;
629} 629}
630void Addressee::setOriginalExternalUID( const QString &id ) 630void Addressee::setOriginalExternalUID( const QString &id )
631{ 631{
632 if ( id == mData->originalExternalUID ) return; 632 if ( id == mData->originalExternalUID ) return;
633 detach(); 633 detach();
634 mData->empty = false; 634 mData->empty = false;
635 //qDebug("*******Set orig uid %s ", id.latin1()); 635 //qDebug("*******Set orig uid %s ", id.latin1());
636 mData->originalExternalUID = id; 636 mData->originalExternalUID = id;
637} 637}
638 638
639QString Addressee::originalExternalUID() const 639QString Addressee::originalExternalUID() const
640{ 640{
641 return mData->originalExternalUID; 641 return mData->originalExternalUID;
642} 642}
643 643
644void Addressee::setUid( const QString &id ) 644void Addressee::setUid( const QString &id )
645{ 645{
646 if ( id == mData->uid ) return; 646 if ( id == mData->uid ) return;
647 detach(); 647 detach();
648 //qDebug("****setuid %s ", id.latin1()); 648 //qDebug("****setuid %s ", id.latin1());
649 mData->empty = false; 649 mData->empty = false;
650 mData->uid = id; 650 mData->uid = id;
651} 651}
652 652
653QString Addressee::uid() const 653QString Addressee::uid() const
654{ 654{
655 if ( mData->uid.isEmpty() ) 655 if ( mData->uid.isEmpty() )
656 mData->uid = KApplication::randomString( 10 ); 656 mData->uid = KApplication::randomString( 10 );
657 657
658 return mData->uid; 658 return mData->uid;
659} 659}