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