-rw-r--r-- | kabc/addressee.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 711c261..0157721 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -84,398 +84,402 @@ struct Addressee::AddresseeData : public KShared | |||
84 | Resource *resource; | 84 | Resource *resource; |
85 | 85 | ||
86 | bool empty :1; | 86 | bool empty :1; |
87 | bool changed :1; | 87 | bool changed :1; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | Addressee::Addressee() | 90 | Addressee::Addressee() |
91 | { | 91 | { |
92 | mData = new AddresseeData; | 92 | mData = new AddresseeData; |
93 | mData->empty = true; | 93 | mData->empty = true; |
94 | mData->changed = false; | 94 | mData->changed = false; |
95 | mData->resource = 0; | 95 | mData->resource = 0; |
96 | mData->mExternalId = ":"; | 96 | mData->mExternalId = ":"; |
97 | mData->revision = QDateTime ( QDate( 2004,1,1)); | 97 | mData->revision = QDateTime ( QDate( 2004,1,1)); |
98 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 98 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
99 | } | 99 | } |
100 | 100 | ||
101 | Addressee::~Addressee() | 101 | Addressee::~Addressee() |
102 | { | 102 | { |
103 | } | 103 | } |
104 | 104 | ||
105 | Addressee::Addressee( const Addressee &a ) | 105 | Addressee::Addressee( const Addressee &a ) |
106 | { | 106 | { |
107 | mData = a.mData; | 107 | mData = a.mData; |
108 | } | 108 | } |
109 | 109 | ||
110 | Addressee &Addressee::operator=( const Addressee &a ) | 110 | Addressee &Addressee::operator=( const Addressee &a ) |
111 | { | 111 | { |
112 | mData = a.mData; | 112 | mData = a.mData; |
113 | return (*this); | 113 | return (*this); |
114 | } | 114 | } |
115 | 115 | ||
116 | Addressee Addressee::copy() | 116 | Addressee Addressee::copy() |
117 | { | 117 | { |
118 | Addressee a; | 118 | Addressee a; |
119 | *(a.mData) = *mData; | 119 | *(a.mData) = *mData; |
120 | return a; | 120 | return a; |
121 | } | 121 | } |
122 | 122 | ||
123 | void Addressee::detach() | 123 | void Addressee::detach() |
124 | { | 124 | { |
125 | if ( mData.count() == 1 ) return; | 125 | if ( mData.count() == 1 ) return; |
126 | *this = copy(); | 126 | *this = copy(); |
127 | } | 127 | } |
128 | 128 | ||
129 | bool Addressee::operator==( const Addressee &a ) const | 129 | bool Addressee::operator==( const Addressee &a ) const |
130 | { | 130 | { |
131 | if ( uid() != a.uid() ) return false; | 131 | if ( uid() != a.uid() ) return false; |
132 | if ( mData->name != a.mData->name ) return false; | 132 | if ( mData->name != a.mData->name ) return false; |
133 | if ( mData->formattedName != a.mData->formattedName ) return false; | 133 | if ( mData->formattedName != a.mData->formattedName ) return false; |
134 | if ( mData->familyName != a.mData->familyName ) return false; | 134 | if ( mData->familyName != a.mData->familyName ) return false; |
135 | if ( mData->givenName != a.mData->givenName ) return false; | 135 | if ( mData->givenName != a.mData->givenName ) return false; |
136 | if ( mData->additionalName != a.mData->additionalName ) return false; | 136 | if ( mData->additionalName != a.mData->additionalName ) return false; |
137 | if ( mData->prefix != a.mData->prefix ) return false; | 137 | if ( mData->prefix != a.mData->prefix ) return false; |
138 | if ( mData->suffix != a.mData->suffix ) return false; | 138 | if ( mData->suffix != a.mData->suffix ) return false; |
139 | if ( mData->nickName != a.mData->nickName ) return false; | 139 | if ( mData->nickName != a.mData->nickName ) return false; |
140 | if ( mData->birthday != a.mData->birthday ) return false; | 140 | if ( mData->birthday != a.mData->birthday ) return false; |
141 | if ( mData->mailer != a.mData->mailer ) return false; | 141 | if ( mData->mailer != a.mData->mailer ) return false; |
142 | if ( mData->timeZone != a.mData->timeZone ) return false; | 142 | if ( mData->timeZone != a.mData->timeZone ) return false; |
143 | if ( mData->geo != a.mData->geo ) return false; | 143 | if ( mData->geo != a.mData->geo ) return false; |
144 | if ( mData->title != a.mData->title ) return false; | 144 | if ( mData->title != a.mData->title ) return false; |
145 | if ( mData->role != a.mData->role ) return false; | 145 | if ( mData->role != a.mData->role ) return false; |
146 | if ( mData->organization != a.mData->organization ) return false; | 146 | if ( mData->organization != a.mData->organization ) return false; |
147 | if ( mData->note != a.mData->note ) return false; | 147 | if ( mData->note != a.mData->note ) return false; |
148 | if ( mData->productId != a.mData->productId ) return false; | 148 | if ( mData->productId != a.mData->productId ) return false; |
149 | if ( mData->revision != a.mData->revision ) return false; | 149 | if ( mData->revision != a.mData->revision ) return false; |
150 | if ( mData->sortString != a.mData->sortString ) return false; | 150 | if ( mData->sortString != a.mData->sortString ) return false; |
151 | if ( mData->secrecy != a.mData->secrecy ) return false; | 151 | if ( mData->secrecy != a.mData->secrecy ) return false; |
152 | if ( mData->logo != a.mData->logo ) return false; | 152 | if ( mData->logo != a.mData->logo ) return false; |
153 | if ( mData->photo != a.mData->photo ) return false; | 153 | if ( mData->photo != a.mData->photo ) return false; |
154 | if ( mData->sound != a.mData->sound ) return false; | 154 | if ( mData->sound != a.mData->sound ) return false; |
155 | if ( mData->agent != a.mData->agent ) return false; | 155 | if ( mData->agent != a.mData->agent ) return false; |
156 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && | 156 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && |
157 | ( mData->url != a.mData->url ) ) return false; | 157 | ( mData->url != a.mData->url ) ) return false; |
158 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; | 158 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; |
159 | if ( mData->addresses != a.mData->addresses ) return false; | 159 | if ( mData->addresses != a.mData->addresses ) return false; |
160 | if ( mData->keys != a.mData->keys ) return false; | 160 | if ( mData->keys != a.mData->keys ) return false; |
161 | if ( mData->emails != a.mData->emails ) return false; | 161 | if ( mData->emails != a.mData->emails ) return false; |
162 | if ( mData->categories != a.mData->categories ) return false; | 162 | if ( mData->categories != a.mData->categories ) return false; |
163 | if ( mData->custom != a.mData->custom ) return false; | 163 | if ( mData->custom != a.mData->custom ) return false; |
164 | 164 | ||
165 | return true; | 165 | return true; |
166 | } | 166 | } |
167 | 167 | ||
168 | bool Addressee::operator!=( const Addressee &a ) const | 168 | bool Addressee::operator!=( const Addressee &a ) const |
169 | { | 169 | { |
170 | return !( a == *this ); | 170 | return !( a == *this ); |
171 | } | 171 | } |
172 | 172 | ||
173 | bool Addressee::isEmpty() const | 173 | bool Addressee::isEmpty() const |
174 | { | 174 | { |
175 | return mData->empty; | 175 | return mData->empty; |
176 | } | 176 | } |
177 | ulong Addressee::getCsum4List( const QStringList & attList) | 177 | ulong Addressee::getCsum4List( const QStringList & attList) |
178 | { | 178 | { |
179 | int max = attList.count(); | 179 | int max = attList.count(); |
180 | ulong cSum = 0; | 180 | ulong cSum = 0; |
181 | int j,k,i; | 181 | int j,k,i; |
182 | int add; | 182 | int add; |
183 | for ( i = 0; i < max ; ++i ) { | 183 | for ( i = 0; i < max ; ++i ) { |
184 | QString s = attList[i]; | 184 | QString s = attList[i]; |
185 | if ( ! s.isEmpty() ){ | 185 | if ( ! s.isEmpty() ){ |
186 | j = s.length(); | 186 | j = s.length(); |
187 | for ( k = 0; k < j; ++k ) { | 187 | for ( k = 0; k < j; ++k ) { |
188 | int mul = k +1; | 188 | int mul = k +1; |
189 | add = s[k].unicode (); | 189 | add = s[k].unicode (); |
190 | if ( k < 16 ) | 190 | if ( k < 16 ) |
191 | mul = mul * mul; | 191 | mul = mul * mul; |
192 | int ii = i+1; | 192 | int ii = i+1; |
193 | add = add * mul *ii*ii*ii; | 193 | add = add * mul *ii*ii*ii; |
194 | cSum += add; | 194 | cSum += add; |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | } | 198 | } |
199 | //QString dump = attList.join(","); | 199 | //QString dump = attList.join(","); |
200 | //qDebug("csum: %d %s", cSum,dump.latin1()); | 200 | //qDebug("csum: %d %s", cSum,dump.latin1()); |
201 | 201 | ||
202 | return cSum; | 202 | return cSum; |
203 | 203 | ||
204 | } | 204 | } |
205 | void Addressee::computeCsum(const QString &dev) | 205 | void Addressee::computeCsum(const QString &dev) |
206 | { | 206 | { |
207 | QStringList l; | 207 | QStringList l; |
208 | if ( !mData->name.isEmpty() ) l.append(mData->name); | 208 | if ( !mData->name.isEmpty() ) l.append(mData->name); |
209 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | 209 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); |
210 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | 210 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); |
211 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | 211 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); |
212 | if ( !mData->additionalName ) l.append( mData->additionalName ); | 212 | if ( !mData->additionalName ) l.append( mData->additionalName ); |
213 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | 213 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); |
214 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | 214 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); |
215 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | 215 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); |
216 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | 216 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); |
217 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | 217 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); |
218 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | 218 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); |
219 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | 219 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); |
220 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | 220 | if ( !mData->title .isEmpty() ) l.append( mData->title ); |
221 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | 221 | if ( !mData->role.isEmpty() ) l.append( mData->role ); |
222 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | 222 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); |
223 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | 223 | if ( !mData->note.isEmpty() ) l.append( mData->note ); |
224 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | 224 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); |
225 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | 225 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); |
226 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | 226 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); |
227 | // if ( !mData->logo.isEmpty() ) l.append( ); | 227 | // if ( !mData->logo.isEmpty() ) l.append( ); |
228 | //if ( !mData->photo.isEmpty() ) l.append( ); | 228 | //if ( !mData->photo.isEmpty() ) l.append( ); |
229 | //if ( !mData->sound.isEmpty() ) l.append( ); | 229 | //if ( !mData->sound.isEmpty() ) l.append( ); |
230 | //if ( !mData->agent.isEmpty() ) l.append( ); | 230 | //if ( !mData->agent.isEmpty() ) l.append( ); |
231 | //if ( mData->url.isValid() ) l.append( ); | 231 | //if ( mData->url.isValid() ) l.append( ); |
232 | #if 0 | 232 | #if 0 |
233 | if ( !mData->phoneNumbers.isEmpty() ) l.append( ); | 233 | if ( !mData->phoneNumbers.isEmpty() ) l.append( ); |
234 | if ( !mData->addresses.isEmpty() ) l.append( ); | 234 | if ( !mData->addresses.isEmpty() ) l.append( ); |
235 | //if ( !mData->keys.isEmpty() ) l.append( ); | 235 | //if ( !mData->keys.isEmpty() ) l.append( ); |
236 | if ( !mData->emails.isEmpty() ) l.append( ); | 236 | if ( !mData->emails.isEmpty() ) l.append( ); |
237 | if ( !mData->categories .isEmpty() ) l.append( ); | 237 | if ( !mData->categories .isEmpty() ) l.append( ); |
238 | if ( !mData->custom.isEmpty() ) l.append( ); | 238 | if ( !mData->custom.isEmpty() ) l.append( ); |
239 | #endif | 239 | #endif |
240 | KABC::PhoneNumber::List phoneNumbers; | 240 | KABC::PhoneNumber::List phoneNumbers; |
241 | KABC::PhoneNumber::List::Iterator phoneIter; | 241 | KABC::PhoneNumber::List::Iterator phoneIter; |
242 | 242 | ||
243 | QStringList t; | 243 | QStringList t; |
244 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 244 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
245 | ++phoneIter ) | 245 | ++phoneIter ) |
246 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); | 246 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); |
247 | t.sort(); | 247 | t.sort(); |
248 | uint iii; | 248 | uint iii; |
249 | for ( iii = 0; iii < t.count(); ++iii) | 249 | for ( iii = 0; iii < t.count(); ++iii) |
250 | l.append( t[iii] ); | 250 | l.append( t[iii] ); |
251 | t = mData->emails; | 251 | t = mData->emails; |
252 | t.sort(); | 252 | t.sort(); |
253 | for ( iii = 0; iii < t.count(); ++iii) | 253 | for ( iii = 0; iii < t.count(); ++iii) |
254 | l.append( t[iii] ); | 254 | l.append( t[iii] ); |
255 | t = mData->categories; | 255 | t = mData->categories; |
256 | t.sort(); | 256 | t.sort(); |
257 | for ( iii = 0; iii < t.count(); ++iii) | 257 | for ( iii = 0; iii < t.count(); ++iii) |
258 | l.append( t[iii] ); | 258 | l.append( t[iii] ); |
259 | t = mData->custom; | 259 | t = mData->custom; |
260 | t.sort(); | 260 | t.sort(); |
261 | for ( iii = 0; iii < t.count(); ++iii) | 261 | for ( iii = 0; iii < t.count(); ++iii) |
262 | l.append( t[iii] ); | 262 | l.append( t[iii] ); |
263 | KABC::Address::List::Iterator addressIter; | 263 | KABC::Address::List::Iterator addressIter; |
264 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 264 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
265 | ++addressIter ) { | 265 | ++addressIter ) { |
266 | t = (*addressIter).asList(); | 266 | t = (*addressIter).asList(); |
267 | t.sort(); | 267 | t.sort(); |
268 | for ( iii = 0; iii < t.count(); ++iii) | 268 | for ( iii = 0; iii < t.count(); ++iii) |
269 | l.append( t[iii] ); | 269 | l.append( t[iii] ); |
270 | } | 270 | } |
271 | uint cs = getCsum4List(l); | 271 | uint cs = getCsum4List(l); |
272 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 272 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
273 | setCsum( dev, QString::number (cs )); | 273 | setCsum( dev, QString::number (cs )); |
274 | } | 274 | } |
275 | 275 | ||
276 | void Addressee::mergeContact( Addressee ad ) | 276 | void Addressee::mergeContact( const Addressee& ad ) |
277 | { | 277 | { |
278 | |||
279 | detach(); | ||
280 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | ||
281 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | ||
282 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | ||
283 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; | ||
284 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | ||
285 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | ||
286 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | ||
287 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | ||
288 | if ( !mData->birthday.isValid() ) | ||
289 | if ( ad.mData->birthday.isValid()) | ||
290 | mData->birthday = ad.mData->birthday; | ||
291 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | ||
278 | #if 0 | 292 | #if 0 |
279 | if ( !mData->name.isEmpty() ) l.append(mData->name); | 293 | if ( !mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); |
280 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | ||
281 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | ||
282 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | ||
283 | if ( !mData->additionalName ) l.append( mData->additionalName ); | ||
284 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | ||
285 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | ||
286 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | ||
287 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | ||
288 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | ||
289 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | ||
290 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | 294 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); |
291 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | 295 | if ( !mData->title .isEmpty() ) l.append( mData->title ); |
292 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | 296 | if ( !mData->role.isEmpty() ) l.append( mData->role ); |
293 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | 297 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); |
294 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | 298 | if ( !mData->note.isEmpty() ) l.append( mData->note ); |
295 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | 299 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); |
296 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | 300 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); |
297 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | 301 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); |
298 | #endif | 302 | #endif |
299 | } | 303 | } |
300 | 304 | ||
301 | void Addressee::removeID(const QString &prof) | 305 | void Addressee::removeID(const QString &prof) |
302 | { | 306 | { |
303 | detach(); | 307 | detach(); |
304 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 308 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
305 | 309 | ||
306 | } | 310 | } |
307 | void Addressee::setID( const QString & prof , const QString & id ) | 311 | void Addressee::setID( const QString & prof , const QString & id ) |
308 | { | 312 | { |
309 | detach(); | 313 | detach(); |
310 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 314 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
311 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 315 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
312 | } | 316 | } |
313 | void Addressee::setTempSyncStat( int id ) | 317 | void Addressee::setTempSyncStat( int id ) |
314 | { | 318 | { |
315 | if ( mData->mTempSyncStat == id ) return; | 319 | if ( mData->mTempSyncStat == id ) return; |
316 | detach(); | 320 | detach(); |
317 | mData->mTempSyncStat = id; | 321 | mData->mTempSyncStat = id; |
318 | } | 322 | } |
319 | int Addressee::tempSyncStat() const | 323 | int Addressee::tempSyncStat() const |
320 | { | 324 | { |
321 | return mData->mTempSyncStat; | 325 | return mData->mTempSyncStat; |
322 | } | 326 | } |
323 | 327 | ||
324 | QString Addressee::getID( const QString & prof) | 328 | QString Addressee::getID( const QString & prof) |
325 | { | 329 | { |
326 | return KIdManager::getId ( mData->mExternalId, prof ); | 330 | return KIdManager::getId ( mData->mExternalId, prof ); |
327 | } | 331 | } |
328 | 332 | ||
329 | void Addressee::setCsum( const QString & prof , const QString & id ) | 333 | void Addressee::setCsum( const QString & prof , const QString & id ) |
330 | { | 334 | { |
331 | detach(); | 335 | detach(); |
332 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 336 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
333 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 337 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
334 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 338 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
335 | } | 339 | } |
336 | 340 | ||
337 | QString Addressee::getCsum( const QString & prof) | 341 | QString Addressee::getCsum( const QString & prof) |
338 | { | 342 | { |
339 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 343 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
340 | } | 344 | } |
341 | 345 | ||
342 | void Addressee::setIDStr( const QString & s ) | 346 | void Addressee::setIDStr( const QString & s ) |
343 | { | 347 | { |
344 | detach(); | 348 | detach(); |
345 | mData->mExternalId = s; | 349 | mData->mExternalId = s; |
346 | } | 350 | } |
347 | 351 | ||
348 | QString Addressee::IDStr() const | 352 | QString Addressee::IDStr() const |
349 | { | 353 | { |
350 | return mData->mExternalId; | 354 | return mData->mExternalId; |
351 | } | 355 | } |
352 | 356 | ||
353 | void Addressee::setExternalUID( const QString &id ) | 357 | void Addressee::setExternalUID( const QString &id ) |
354 | { | 358 | { |
355 | if ( id == mData->externalUID ) return; | 359 | if ( id == mData->externalUID ) return; |
356 | detach(); | 360 | detach(); |
357 | mData->empty = false; | 361 | mData->empty = false; |
358 | mData->externalUID = id; | 362 | mData->externalUID = id; |
359 | } | 363 | } |
360 | 364 | ||
361 | QString Addressee::externalUID() const | 365 | QString Addressee::externalUID() const |
362 | { | 366 | { |
363 | return mData->externalUID; | 367 | return mData->externalUID; |
364 | } | 368 | } |
365 | 369 | ||
366 | void Addressee::setUid( const QString &id ) | 370 | void Addressee::setUid( const QString &id ) |
367 | { | 371 | { |
368 | if ( id == mData->uid ) return; | 372 | if ( id == mData->uid ) return; |
369 | detach(); | 373 | detach(); |
370 | mData->empty = false; | 374 | mData->empty = false; |
371 | mData->uid = id; | 375 | mData->uid = id; |
372 | } | 376 | } |
373 | 377 | ||
374 | QString Addressee::uid() const | 378 | QString Addressee::uid() const |
375 | { | 379 | { |
376 | if ( mData->uid.isEmpty() ) | 380 | if ( mData->uid.isEmpty() ) |
377 | mData->uid = KApplication::randomString( 10 ); | 381 | mData->uid = KApplication::randomString( 10 ); |
378 | 382 | ||
379 | return mData->uid; | 383 | return mData->uid; |
380 | } | 384 | } |
381 | 385 | ||
382 | QString Addressee::uidLabel() | 386 | QString Addressee::uidLabel() |
383 | { | 387 | { |
384 | return i18n("Unique Identifier"); | 388 | return i18n("Unique Identifier"); |
385 | } | 389 | } |
386 | 390 | ||
387 | void Addressee::setName( const QString &name ) | 391 | void Addressee::setName( const QString &name ) |
388 | { | 392 | { |
389 | if ( name == mData->name ) return; | 393 | if ( name == mData->name ) return; |
390 | detach(); | 394 | detach(); |
391 | mData->empty = false; | 395 | mData->empty = false; |
392 | mData->name = name; | 396 | mData->name = name; |
393 | } | 397 | } |
394 | 398 | ||
395 | QString Addressee::name() const | 399 | QString Addressee::name() const |
396 | { | 400 | { |
397 | return mData->name; | 401 | return mData->name; |
398 | } | 402 | } |
399 | 403 | ||
400 | QString Addressee::nameLabel() | 404 | QString Addressee::nameLabel() |
401 | { | 405 | { |
402 | return i18n("Name"); | 406 | return i18n("Name"); |
403 | } | 407 | } |
404 | 408 | ||
405 | 409 | ||
406 | void Addressee::setFormattedName( const QString &formattedName ) | 410 | void Addressee::setFormattedName( const QString &formattedName ) |
407 | { | 411 | { |
408 | if ( formattedName == mData->formattedName ) return; | 412 | if ( formattedName == mData->formattedName ) return; |
409 | detach(); | 413 | detach(); |
410 | mData->empty = false; | 414 | mData->empty = false; |
411 | mData->formattedName = formattedName; | 415 | mData->formattedName = formattedName; |
412 | } | 416 | } |
413 | 417 | ||
414 | QString Addressee::formattedName() const | 418 | QString Addressee::formattedName() const |
415 | { | 419 | { |
416 | return mData->formattedName; | 420 | return mData->formattedName; |
417 | } | 421 | } |
418 | 422 | ||
419 | QString Addressee::formattedNameLabel() | 423 | QString Addressee::formattedNameLabel() |
420 | { | 424 | { |
421 | return i18n("Formatted Name"); | 425 | return i18n("Formatted Name"); |
422 | } | 426 | } |
423 | 427 | ||
424 | 428 | ||
425 | void Addressee::setFamilyName( const QString &familyName ) | 429 | void Addressee::setFamilyName( const QString &familyName ) |
426 | { | 430 | { |
427 | if ( familyName == mData->familyName ) return; | 431 | if ( familyName == mData->familyName ) return; |
428 | detach(); | 432 | detach(); |
429 | mData->empty = false; | 433 | mData->empty = false; |
430 | mData->familyName = familyName; | 434 | mData->familyName = familyName; |
431 | } | 435 | } |
432 | 436 | ||
433 | QString Addressee::familyName() const | 437 | QString Addressee::familyName() const |
434 | { | 438 | { |
435 | return mData->familyName; | 439 | return mData->familyName; |
436 | } | 440 | } |
437 | 441 | ||
438 | QString Addressee::familyNameLabel() | 442 | QString Addressee::familyNameLabel() |
439 | { | 443 | { |
440 | return i18n("Family Name"); | 444 | return i18n("Family Name"); |
441 | } | 445 | } |
442 | 446 | ||
443 | 447 | ||
444 | void Addressee::setGivenName( const QString &givenName ) | 448 | void Addressee::setGivenName( const QString &givenName ) |
445 | { | 449 | { |
446 | if ( givenName == mData->givenName ) return; | 450 | if ( givenName == mData->givenName ) return; |
447 | detach(); | 451 | detach(); |
448 | mData->empty = false; | 452 | mData->empty = false; |
449 | mData->givenName = givenName; | 453 | mData->givenName = givenName; |
450 | } | 454 | } |
451 | 455 | ||
452 | QString Addressee::givenName() const | 456 | QString Addressee::givenName() const |
453 | { | 457 | { |
454 | return mData->givenName; | 458 | return mData->givenName; |
455 | } | 459 | } |
456 | 460 | ||
457 | QString Addressee::givenNameLabel() | 461 | QString Addressee::givenNameLabel() |
458 | { | 462 | { |
459 | return i18n("Given Name"); | 463 | return i18n("Given Name"); |
460 | } | 464 | } |
461 | 465 | ||
462 | 466 | ||
463 | void Addressee::setAdditionalName( const QString &additionalName ) | 467 | void Addressee::setAdditionalName( const QString &additionalName ) |
464 | { | 468 | { |
465 | if ( additionalName == mData->additionalName ) return; | 469 | if ( additionalName == mData->additionalName ) return; |
466 | detach(); | 470 | detach(); |
467 | mData->empty = false; | 471 | mData->empty = false; |
468 | mData->additionalName = additionalName; | 472 | mData->additionalName = additionalName; |
469 | } | 473 | } |
470 | 474 | ||
471 | QString Addressee::additionalName() const | 475 | QString Addressee::additionalName() const |
472 | { | 476 | { |
473 | return mData->additionalName; | 477 | return mData->additionalName; |
474 | } | 478 | } |
475 | 479 | ||
476 | QString Addressee::additionalNameLabel() | 480 | QString Addressee::additionalNameLabel() |
477 | { | 481 | { |
478 | return i18n("Additional Names"); | 482 | return i18n("Additional Names"); |
479 | } | 483 | } |
480 | 484 | ||
481 | 485 | ||