summaryrefslogtreecommitdiffabout
path: root/kabc/addressee.cpp
Unidiff
Diffstat (limited to 'kabc/addressee.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index c34f671..711c261 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -1,837 +1,876 @@
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 QString externalUID;
69 KURL url; 70 KURL url;
70 Secrecy secrecy; 71 Secrecy secrecy;
71 Picture logo; 72 Picture logo;
72 Picture photo; 73 Picture photo;
73 Sound sound; 74 Sound sound;
74 Agent agent; 75 Agent agent;
75 QString mExternalId; 76 QString mExternalId;
76 PhoneNumber::List phoneNumbers; 77 PhoneNumber::List phoneNumbers;
77 Address::List addresses; 78 Address::List addresses;
78 Key::List keys; 79 Key::List keys;
79 QStringList emails; 80 QStringList emails;
80 QStringList categories; 81 QStringList categories;
81 QStringList custom; 82 QStringList custom;
82 int mTempSyncStat; 83 int mTempSyncStat;
83 Resource *resource; 84 Resource *resource;
84 85
85 bool empty :1; 86 bool empty :1;
86 bool changed :1; 87 bool changed :1;
87}; 88};
88 89
89Addressee::Addressee() 90Addressee::Addressee()
90{ 91{
91 mData = new AddresseeData; 92 mData = new AddresseeData;
92 mData->empty = true; 93 mData->empty = true;
93 mData->changed = false; 94 mData->changed = false;
94 mData->resource = 0; 95 mData->resource = 0;
95 mData->mExternalId = ":"; 96 mData->mExternalId = ":";
96 mData->revision = QDateTime ( QDate( 2004,1,1)); 97 mData->revision = QDateTime ( QDate( 2004,1,1));
97 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; 98 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
98} 99}
99 100
100Addressee::~Addressee() 101Addressee::~Addressee()
101{ 102{
102} 103}
103 104
104Addressee::Addressee( const Addressee &a ) 105Addressee::Addressee( const Addressee &a )
105{ 106{
106 mData = a.mData; 107 mData = a.mData;
107} 108}
108 109
109Addressee &Addressee::operator=( const Addressee &a ) 110Addressee &Addressee::operator=( const Addressee &a )
110{ 111{
111 mData = a.mData; 112 mData = a.mData;
112 return (*this); 113 return (*this);
113} 114}
114 115
115Addressee Addressee::copy() 116Addressee Addressee::copy()
116{ 117{
117 Addressee a; 118 Addressee a;
118 *(a.mData) = *mData; 119 *(a.mData) = *mData;
119 return a; 120 return a;
120} 121}
121 122
122void Addressee::detach() 123void Addressee::detach()
123{ 124{
124 if ( mData.count() == 1 ) return; 125 if ( mData.count() == 1 ) return;
125 *this = copy(); 126 *this = copy();
126} 127}
127 128
128bool Addressee::operator==( const Addressee &a ) const 129bool Addressee::operator==( const Addressee &a ) const
129{ 130{
130 if ( uid() != a.uid() ) return false; 131 if ( uid() != a.uid() ) return false;
131 if ( mData->name != a.mData->name ) return false; 132 if ( mData->name != a.mData->name ) return false;
132 if ( mData->formattedName != a.mData->formattedName ) return false; 133 if ( mData->formattedName != a.mData->formattedName ) return false;
133 if ( mData->familyName != a.mData->familyName ) return false; 134 if ( mData->familyName != a.mData->familyName ) return false;
134 if ( mData->givenName != a.mData->givenName ) return false; 135 if ( mData->givenName != a.mData->givenName ) return false;
135 if ( mData->additionalName != a.mData->additionalName ) return false; 136 if ( mData->additionalName != a.mData->additionalName ) return false;
136 if ( mData->prefix != a.mData->prefix ) return false; 137 if ( mData->prefix != a.mData->prefix ) return false;
137 if ( mData->suffix != a.mData->suffix ) return false; 138 if ( mData->suffix != a.mData->suffix ) return false;
138 if ( mData->nickName != a.mData->nickName ) return false; 139 if ( mData->nickName != a.mData->nickName ) return false;
139 if ( mData->birthday != a.mData->birthday ) return false; 140 if ( mData->birthday != a.mData->birthday ) return false;
140 if ( mData->mailer != a.mData->mailer ) return false; 141 if ( mData->mailer != a.mData->mailer ) return false;
141 if ( mData->timeZone != a.mData->timeZone ) return false; 142 if ( mData->timeZone != a.mData->timeZone ) return false;
142 if ( mData->geo != a.mData->geo ) return false; 143 if ( mData->geo != a.mData->geo ) return false;
143 if ( mData->title != a.mData->title ) return false; 144 if ( mData->title != a.mData->title ) return false;
144 if ( mData->role != a.mData->role ) return false; 145 if ( mData->role != a.mData->role ) return false;
145 if ( mData->organization != a.mData->organization ) return false; 146 if ( mData->organization != a.mData->organization ) return false;
146 if ( mData->note != a.mData->note ) return false; 147 if ( mData->note != a.mData->note ) return false;
147 if ( mData->productId != a.mData->productId ) return false; 148 if ( mData->productId != a.mData->productId ) return false;
148 if ( mData->revision != a.mData->revision ) return false; 149 if ( mData->revision != a.mData->revision ) return false;
149 if ( mData->sortString != a.mData->sortString ) return false; 150 if ( mData->sortString != a.mData->sortString ) return false;
150 if ( mData->secrecy != a.mData->secrecy ) return false; 151 if ( mData->secrecy != a.mData->secrecy ) return false;
151 if ( mData->logo != a.mData->logo ) return false; 152 if ( mData->logo != a.mData->logo ) return false;
152 if ( mData->photo != a.mData->photo ) return false; 153 if ( mData->photo != a.mData->photo ) return false;
153 if ( mData->sound != a.mData->sound ) return false; 154 if ( mData->sound != a.mData->sound ) return false;
154 if ( mData->agent != a.mData->agent ) return false; 155 if ( mData->agent != a.mData->agent ) return false;
155 if ( ( mData->url.isValid() || a.mData->url.isValid() ) && 156 if ( ( mData->url.isValid() || a.mData->url.isValid() ) &&
156 ( mData->url != a.mData->url ) ) return false; 157 ( mData->url != a.mData->url ) ) return false;
157 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; 158 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false;
158 if ( mData->addresses != a.mData->addresses ) return false; 159 if ( mData->addresses != a.mData->addresses ) return false;
159 if ( mData->keys != a.mData->keys ) return false; 160 if ( mData->keys != a.mData->keys ) return false;
160 if ( mData->emails != a.mData->emails ) return false; 161 if ( mData->emails != a.mData->emails ) return false;
161 if ( mData->categories != a.mData->categories ) return false; 162 if ( mData->categories != a.mData->categories ) return false;
162 if ( mData->custom != a.mData->custom ) return false; 163 if ( mData->custom != a.mData->custom ) return false;
163 164
164 return true; 165 return true;
165} 166}
166 167
167bool Addressee::operator!=( const Addressee &a ) const 168bool Addressee::operator!=( const Addressee &a ) const
168{ 169{
169 return !( a == *this ); 170 return !( a == *this );
170} 171}
171 172
172bool Addressee::isEmpty() const 173bool Addressee::isEmpty() const
173{ 174{
174 return mData->empty; 175 return mData->empty;
175} 176}
176ulong Addressee::getCsum4List( const QStringList & attList) 177ulong Addressee::getCsum4List( const QStringList & attList)
177{ 178{
178 int max = attList.count(); 179 int max = attList.count();
179 ulong cSum = 0; 180 ulong cSum = 0;
180 int j,k,i; 181 int j,k,i;
181 int add; 182 int add;
182 for ( i = 0; i < max ; ++i ) { 183 for ( i = 0; i < max ; ++i ) {
183 QString s = attList[i]; 184 QString s = attList[i];
184 if ( ! s.isEmpty() ){ 185 if ( ! s.isEmpty() ){
185 j = s.length(); 186 j = s.length();
186 for ( k = 0; k < j; ++k ) { 187 for ( k = 0; k < j; ++k ) {
187 int mul = k +1; 188 int mul = k +1;
188 add = s[k].unicode (); 189 add = s[k].unicode ();
189 if ( k < 16 ) 190 if ( k < 16 )
190 mul = mul * mul; 191 mul = mul * mul;
191 int ii = i+1; 192 int ii = i+1;
192 add = add * mul *ii*ii*ii; 193 add = add * mul *ii*ii*ii;
193 cSum += add; 194 cSum += add;
194 } 195 }
195 } 196 }
196 197
197 } 198 }
198 //QString dump = attList.join(","); 199 //QString dump = attList.join(",");
199 //qDebug("csum: %d %s", cSum,dump.latin1()); 200 //qDebug("csum: %d %s", cSum,dump.latin1());
200 201
201 return cSum; 202 return cSum;
202 203
203} 204}
204void Addressee::computeCsum(const QString &dev) 205void Addressee::computeCsum(const QString &dev)
205{ 206{
206 QStringList l; 207 QStringList l;
207 if ( !mData->name.isEmpty() ) l.append(mData->name); 208 if ( !mData->name.isEmpty() ) l.append(mData->name);
208 if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); 209 if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName );
209 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); 210 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName );
210 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); 211 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName );
211 if ( !mData->additionalName ) l.append( mData->additionalName ); 212 if ( !mData->additionalName ) l.append( mData->additionalName );
212 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); 213 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix );
213 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); 214 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix );
214 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); 215 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName );
215 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); 216 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() );
216 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); 217 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer );
217 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); 218 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
218 if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); 219 if ( mData->geo.isValid() ) l.append( mData->geo.asString() );
219 if ( !mData->title .isEmpty() ) l.append( mData->title ); 220 if ( !mData->title .isEmpty() ) l.append( mData->title );
220 if ( !mData->role.isEmpty() ) l.append( mData->role ); 221 if ( !mData->role.isEmpty() ) l.append( mData->role );
221 if ( !mData->organization.isEmpty() ) l.append( mData->organization ); 222 if ( !mData->organization.isEmpty() ) l.append( mData->organization );
222 if ( !mData->note.isEmpty() ) l.append( mData->note ); 223 if ( !mData->note.isEmpty() ) l.append( mData->note );
223 if ( !mData->productId.isEmpty() ) l.append(mData->productId ); 224 if ( !mData->productId.isEmpty() ) l.append(mData->productId );
224 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); 225 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString );
225 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); 226 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString());
226 // if ( !mData->logo.isEmpty() ) l.append( ); 227 // if ( !mData->logo.isEmpty() ) l.append( );
227 //if ( !mData->photo.isEmpty() ) l.append( ); 228 //if ( !mData->photo.isEmpty() ) l.append( );
228 //if ( !mData->sound.isEmpty() ) l.append( ); 229 //if ( !mData->sound.isEmpty() ) l.append( );
229 //if ( !mData->agent.isEmpty() ) l.append( ); 230 //if ( !mData->agent.isEmpty() ) l.append( );
230 //if ( mData->url.isValid() ) l.append( ); 231 //if ( mData->url.isValid() ) l.append( );
231#if 0 232#if 0
232 if ( !mData->phoneNumbers.isEmpty() ) l.append( ); 233 if ( !mData->phoneNumbers.isEmpty() ) l.append( );
233 if ( !mData->addresses.isEmpty() ) l.append( ); 234 if ( !mData->addresses.isEmpty() ) l.append( );
234 //if ( !mData->keys.isEmpty() ) l.append( ); 235 //if ( !mData->keys.isEmpty() ) l.append( );
235 if ( !mData->emails.isEmpty() ) l.append( ); 236 if ( !mData->emails.isEmpty() ) l.append( );
236 if ( !mData->categories .isEmpty() ) l.append( ); 237 if ( !mData->categories .isEmpty() ) l.append( );
237 if ( !mData->custom.isEmpty() ) l.append( ); 238 if ( !mData->custom.isEmpty() ) l.append( );
238#endif 239#endif
239 KABC::PhoneNumber::List phoneNumbers; 240 KABC::PhoneNumber::List phoneNumbers;
240 KABC::PhoneNumber::List::Iterator phoneIter; 241 KABC::PhoneNumber::List::Iterator phoneIter;
241 242
242 QStringList t; 243 QStringList t;
243 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 244 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
244 ++phoneIter ) 245 ++phoneIter )
245 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); 246 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) );
246 t.sort(); 247 t.sort();
247 uint iii; 248 uint iii;
248 for ( iii = 0; iii < t.count(); ++iii) 249 for ( iii = 0; iii < t.count(); ++iii)
249 l.append( t[iii] ); 250 l.append( t[iii] );
250 t = mData->emails; 251 t = mData->emails;
251 t.sort(); 252 t.sort();
252 for ( iii = 0; iii < t.count(); ++iii) 253 for ( iii = 0; iii < t.count(); ++iii)
253 l.append( t[iii] ); 254 l.append( t[iii] );
254 t = mData->categories; 255 t = mData->categories;
255 t.sort(); 256 t.sort();
256 for ( iii = 0; iii < t.count(); ++iii) 257 for ( iii = 0; iii < t.count(); ++iii)
257 l.append( t[iii] ); 258 l.append( t[iii] );
258 t = mData->custom; 259 t = mData->custom;
259 t.sort(); 260 t.sort();
260 for ( iii = 0; iii < t.count(); ++iii) 261 for ( iii = 0; iii < t.count(); ++iii)
261 l.append( t[iii] ); 262 l.append( t[iii] );
262 KABC::Address::List::Iterator addressIter; 263 KABC::Address::List::Iterator addressIter;
263 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 264 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
264 ++addressIter ) { 265 ++addressIter ) {
265 t = (*addressIter).asList(); 266 t = (*addressIter).asList();
266 t.sort(); 267 t.sort();
267 for ( iii = 0; iii < t.count(); ++iii) 268 for ( iii = 0; iii < t.count(); ++iii)
268 l.append( t[iii] ); 269 l.append( t[iii] );
269 } 270 }
270 uint cs = getCsum4List(l); 271 uint cs = getCsum4List(l);
271 // 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() );
272 setCsum( dev, QString::number (cs )); 273 setCsum( dev, QString::number (cs ));
273} 274}
275
276void Addressee::mergeContact( Addressee ad )
277{
278#if 0
279 if ( !mData->name.isEmpty() ) l.append(mData->name);
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() );
291 if ( !mData->title .isEmpty() ) l.append( mData->title );
292 if ( !mData->role.isEmpty() ) l.append( mData->role );
293 if ( !mData->organization.isEmpty() ) l.append( mData->organization );
294 if ( !mData->note.isEmpty() ) l.append( mData->note );
295 if ( !mData->productId.isEmpty() ) l.append(mData->productId );
296 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString );
297 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString());
298#endif
299}
300
274void Addressee::removeID(const QString &prof) 301void Addressee::removeID(const QString &prof)
275{ 302{
276 detach(); 303 detach();
277 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 304 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
278 305
279} 306}
280void Addressee::setID( const QString & prof , const QString & id ) 307void Addressee::setID( const QString & prof , const QString & id )
281{ 308{
282 detach(); 309 detach();
283 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 310 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
284 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 311 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
285} 312}
286void Addressee::setTempSyncStat( int id ) 313void Addressee::setTempSyncStat( int id )
287{ 314{
288 if ( mData->mTempSyncStat == id ) return; 315 if ( mData->mTempSyncStat == id ) return;
289 detach(); 316 detach();
290 mData->mTempSyncStat = id; 317 mData->mTempSyncStat = id;
291} 318}
292int Addressee::tempSyncStat() const 319int Addressee::tempSyncStat() const
293{ 320{
294 return mData->mTempSyncStat; 321 return mData->mTempSyncStat;
295} 322}
296 323
297QString Addressee::getID( const QString & prof) 324QString Addressee::getID( const QString & prof)
298{ 325{
299 return KIdManager::getId ( mData->mExternalId, prof ); 326 return KIdManager::getId ( mData->mExternalId, prof );
300} 327}
301 328
302void Addressee::setCsum( const QString & prof , const QString & id ) 329void Addressee::setCsum( const QString & prof , const QString & id )
303{ 330{
304 detach(); 331 detach();
305 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 332 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
306 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); 333 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
307 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); 334 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
308} 335}
309 336
310QString Addressee::getCsum( const QString & prof) 337QString Addressee::getCsum( const QString & prof)
311{ 338{
312 return KIdManager::getCsum ( mData->mExternalId, prof ); 339 return KIdManager::getCsum ( mData->mExternalId, prof );
313} 340}
314 341
315void Addressee::setIDStr( const QString & s ) 342void Addressee::setIDStr( const QString & s )
316{ 343{
317 detach(); 344 detach();
318 mData->mExternalId = s; 345 mData->mExternalId = s;
319} 346}
320 347
321QString Addressee::IDStr() const 348QString Addressee::IDStr() const
322{ 349{
323 return mData->mExternalId; 350 return mData->mExternalId;
324} 351}
325 352
353void Addressee::setExternalUID( const QString &id )
354{
355 if ( id == mData->externalUID ) return;
356 detach();
357 mData->empty = false;
358 mData->externalUID = id;
359}
360
361QString Addressee::externalUID() const
362{
363 return mData->externalUID;
364}
326 365
327void Addressee::setUid( const QString &id ) 366void Addressee::setUid( const QString &id )
328{ 367{
329 if ( id == mData->uid ) return; 368 if ( id == mData->uid ) return;
330 detach(); 369 detach();
331 mData->empty = false; 370 mData->empty = false;
332 mData->uid = id; 371 mData->uid = id;
333} 372}
334 373
335QString Addressee::uid() const 374QString Addressee::uid() const
336{ 375{
337 if ( mData->uid.isEmpty() ) 376 if ( mData->uid.isEmpty() )
338 mData->uid = KApplication::randomString( 10 ); 377 mData->uid = KApplication::randomString( 10 );
339 378
340 return mData->uid; 379 return mData->uid;
341} 380}
342 381
343QString Addressee::uidLabel() 382QString Addressee::uidLabel()
344{ 383{
345 return i18n("Unique Identifier"); 384 return i18n("Unique Identifier");
346} 385}
347 386
348void Addressee::setName( const QString &name ) 387void Addressee::setName( const QString &name )
349{ 388{
350 if ( name == mData->name ) return; 389 if ( name == mData->name ) return;
351 detach(); 390 detach();
352 mData->empty = false; 391 mData->empty = false;
353 mData->name = name; 392 mData->name = name;
354} 393}
355 394
356QString Addressee::name() const 395QString Addressee::name() const
357{ 396{
358 return mData->name; 397 return mData->name;
359} 398}
360 399
361QString Addressee::nameLabel() 400QString Addressee::nameLabel()
362{ 401{
363 return i18n("Name"); 402 return i18n("Name");
364} 403}
365 404
366 405
367void Addressee::setFormattedName( const QString &formattedName ) 406void Addressee::setFormattedName( const QString &formattedName )
368{ 407{
369 if ( formattedName == mData->formattedName ) return; 408 if ( formattedName == mData->formattedName ) return;
370 detach(); 409 detach();
371 mData->empty = false; 410 mData->empty = false;
372 mData->formattedName = formattedName; 411 mData->formattedName = formattedName;
373} 412}
374 413
375QString Addressee::formattedName() const 414QString Addressee::formattedName() const
376{ 415{
377 return mData->formattedName; 416 return mData->formattedName;
378} 417}
379 418
380QString Addressee::formattedNameLabel() 419QString Addressee::formattedNameLabel()
381{ 420{
382 return i18n("Formatted Name"); 421 return i18n("Formatted Name");
383} 422}
384 423
385 424
386void Addressee::setFamilyName( const QString &familyName ) 425void Addressee::setFamilyName( const QString &familyName )
387{ 426{
388 if ( familyName == mData->familyName ) return; 427 if ( familyName == mData->familyName ) return;
389 detach(); 428 detach();
390 mData->empty = false; 429 mData->empty = false;
391 mData->familyName = familyName; 430 mData->familyName = familyName;
392} 431}
393 432
394QString Addressee::familyName() const 433QString Addressee::familyName() const
395{ 434{
396 return mData->familyName; 435 return mData->familyName;
397} 436}
398 437
399QString Addressee::familyNameLabel() 438QString Addressee::familyNameLabel()
400{ 439{
401 return i18n("Family Name"); 440 return i18n("Family Name");
402} 441}
403 442
404 443
405void Addressee::setGivenName( const QString &givenName ) 444void Addressee::setGivenName( const QString &givenName )
406{ 445{
407 if ( givenName == mData->givenName ) return; 446 if ( givenName == mData->givenName ) return;
408 detach(); 447 detach();
409 mData->empty = false; 448 mData->empty = false;
410 mData->givenName = givenName; 449 mData->givenName = givenName;
411} 450}
412 451
413QString Addressee::givenName() const 452QString Addressee::givenName() const
414{ 453{
415 return mData->givenName; 454 return mData->givenName;
416} 455}
417 456
418QString Addressee::givenNameLabel() 457QString Addressee::givenNameLabel()
419{ 458{
420 return i18n("Given Name"); 459 return i18n("Given Name");
421} 460}
422 461
423 462
424void Addressee::setAdditionalName( const QString &additionalName ) 463void Addressee::setAdditionalName( const QString &additionalName )
425{ 464{
426 if ( additionalName == mData->additionalName ) return; 465 if ( additionalName == mData->additionalName ) return;
427 detach(); 466 detach();
428 mData->empty = false; 467 mData->empty = false;
429 mData->additionalName = additionalName; 468 mData->additionalName = additionalName;
430} 469}
431 470
432QString Addressee::additionalName() const 471QString Addressee::additionalName() const
433{ 472{
434 return mData->additionalName; 473 return mData->additionalName;
435} 474}
436 475
437QString Addressee::additionalNameLabel() 476QString Addressee::additionalNameLabel()
438{ 477{
439 return i18n("Additional Names"); 478 return i18n("Additional Names");
440} 479}
441 480
442 481
443void Addressee::setPrefix( const QString &prefix ) 482void Addressee::setPrefix( const QString &prefix )
444{ 483{
445 if ( prefix == mData->prefix ) return; 484 if ( prefix == mData->prefix ) return;
446 detach(); 485 detach();
447 mData->empty = false; 486 mData->empty = false;
448 mData->prefix = prefix; 487 mData->prefix = prefix;
449} 488}
450 489
451QString Addressee::prefix() const 490QString Addressee::prefix() const
452{ 491{
453 return mData->prefix; 492 return mData->prefix;
454} 493}
455 494
456QString Addressee::prefixLabel() 495QString Addressee::prefixLabel()
457{ 496{
458 return i18n("Honorific Prefixes"); 497 return i18n("Honorific Prefixes");
459} 498}
460 499
461 500
462void Addressee::setSuffix( const QString &suffix ) 501void Addressee::setSuffix( const QString &suffix )
463{ 502{
464 if ( suffix == mData->suffix ) return; 503 if ( suffix == mData->suffix ) return;
465 detach(); 504 detach();
466 mData->empty = false; 505 mData->empty = false;
467 mData->suffix = suffix; 506 mData->suffix = suffix;
468} 507}
469 508
470QString Addressee::suffix() const 509QString Addressee::suffix() const
471{ 510{
472 return mData->suffix; 511 return mData->suffix;
473} 512}
474 513
475QString Addressee::suffixLabel() 514QString Addressee::suffixLabel()
476{ 515{
477 return i18n("Honorific Suffixes"); 516 return i18n("Honorific Suffixes");
478} 517}
479 518
480 519
481void Addressee::setNickName( const QString &nickName ) 520void Addressee::setNickName( const QString &nickName )
482{ 521{
483 if ( nickName == mData->nickName ) return; 522 if ( nickName == mData->nickName ) return;
484 detach(); 523 detach();
485 mData->empty = false; 524 mData->empty = false;
486 mData->nickName = nickName; 525 mData->nickName = nickName;
487} 526}
488 527
489QString Addressee::nickName() const 528QString Addressee::nickName() const
490{ 529{
491 return mData->nickName; 530 return mData->nickName;
492} 531}
493 532
494QString Addressee::nickNameLabel() 533QString Addressee::nickNameLabel()
495{ 534{
496 return i18n("Nick Name"); 535 return i18n("Nick Name");
497} 536}
498 537
499 538
500void Addressee::setBirthday( const QDateTime &birthday ) 539void Addressee::setBirthday( const QDateTime &birthday )
501{ 540{
502 if ( birthday == mData->birthday ) return; 541 if ( birthday == mData->birthday ) return;
503 detach(); 542 detach();
504 mData->empty = false; 543 mData->empty = false;
505 mData->birthday = birthday; 544 mData->birthday = birthday;
506} 545}
507 546
508QDateTime Addressee::birthday() const 547QDateTime Addressee::birthday() const
509{ 548{
510 return mData->birthday; 549 return mData->birthday;
511} 550}
512 551
513QString Addressee::birthdayLabel() 552QString Addressee::birthdayLabel()
514{ 553{
515 return i18n("Birthday"); 554 return i18n("Birthday");
516} 555}
517 556
518 557
519QString Addressee::homeAddressStreetLabel() 558QString Addressee::homeAddressStreetLabel()
520{ 559{
521 return i18n("Home Address Street"); 560 return i18n("Home Address Street");
522} 561}
523 562
524 563
525QString Addressee::homeAddressLocalityLabel() 564QString Addressee::homeAddressLocalityLabel()
526{ 565{
527 return i18n("Home Address Locality"); 566 return i18n("Home Address Locality");
528} 567}
529 568
530 569
531QString Addressee::homeAddressRegionLabel() 570QString Addressee::homeAddressRegionLabel()
532{ 571{
533 return i18n("Home Address Region"); 572 return i18n("Home Address Region");
534} 573}
535 574
536 575
537QString Addressee::homeAddressPostalCodeLabel() 576QString Addressee::homeAddressPostalCodeLabel()
538{ 577{
539 return i18n("Home Address Postal Code"); 578 return i18n("Home Address Postal Code");
540} 579}
541 580
542 581
543QString Addressee::homeAddressCountryLabel() 582QString Addressee::homeAddressCountryLabel()
544{ 583{
545 return i18n("Home Address Country"); 584 return i18n("Home Address Country");
546} 585}
547 586
548 587
549QString Addressee::homeAddressLabelLabel() 588QString Addressee::homeAddressLabelLabel()
550{ 589{
551 return i18n("Home Address Label"); 590 return i18n("Home Address Label");
552} 591}
553 592
554 593
555QString Addressee::businessAddressStreetLabel() 594QString Addressee::businessAddressStreetLabel()
556{ 595{
557 return i18n("Business Address Street"); 596 return i18n("Business Address Street");
558} 597}
559 598
560 599
561QString Addressee::businessAddressLocalityLabel() 600QString Addressee::businessAddressLocalityLabel()
562{ 601{
563 return i18n("Business Address Locality"); 602 return i18n("Business Address Locality");
564} 603}
565 604
566 605
567QString Addressee::businessAddressRegionLabel() 606QString Addressee::businessAddressRegionLabel()
568{ 607{
569 return i18n("Business Address Region"); 608 return i18n("Business Address Region");
570} 609}
571 610
572 611
573QString Addressee::businessAddressPostalCodeLabel() 612QString Addressee::businessAddressPostalCodeLabel()
574{ 613{
575 return i18n("Business Address Postal Code"); 614 return i18n("Business Address Postal Code");
576} 615}
577 616
578 617
579QString Addressee::businessAddressCountryLabel() 618QString Addressee::businessAddressCountryLabel()
580{ 619{
581 return i18n("Business Address Country"); 620 return i18n("Business Address Country");
582} 621}
583 622
584 623
585QString Addressee::businessAddressLabelLabel() 624QString Addressee::businessAddressLabelLabel()
586{ 625{
587 return i18n("Business Address Label"); 626 return i18n("Business Address Label");
588} 627}
589 628
590 629
591QString Addressee::homePhoneLabel() 630QString Addressee::homePhoneLabel()
592{ 631{
593 return i18n("Home Phone"); 632 return i18n("Home Phone");
594} 633}
595 634
596 635
597QString Addressee::businessPhoneLabel() 636QString Addressee::businessPhoneLabel()
598{ 637{
599 return i18n("Business Phone"); 638 return i18n("Business Phone");
600} 639}
601 640
602 641
603QString Addressee::mobilePhoneLabel() 642QString Addressee::mobilePhoneLabel()
604{ 643{
605 return i18n("Mobile Phone"); 644 return i18n("Mobile Phone");
606} 645}
607 646
608 647
609QString Addressee::homeFaxLabel() 648QString Addressee::homeFaxLabel()
610{ 649{
611 return i18n("Home Fax"); 650 return i18n("Home Fax");
612} 651}
613 652
614 653
615QString Addressee::businessFaxLabel() 654QString Addressee::businessFaxLabel()
616{ 655{
617 return i18n("Business Fax"); 656 return i18n("Business Fax");
618} 657}
619 658
620 659
621QString Addressee::carPhoneLabel() 660QString Addressee::carPhoneLabel()
622{ 661{
623 return i18n("Car Phone"); 662 return i18n("Car Phone");
624} 663}
625 664
626 665
627QString Addressee::isdnLabel() 666QString Addressee::isdnLabel()
628{ 667{
629 return i18n("ISDN"); 668 return i18n("ISDN");
630} 669}
631 670
632 671
633QString Addressee::pagerLabel() 672QString Addressee::pagerLabel()
634{ 673{
635 return i18n("Pager"); 674 return i18n("Pager");
636} 675}
637 676
638QString Addressee::sipLabel() 677QString Addressee::sipLabel()
639{ 678{
640 return i18n("SIP"); 679 return i18n("SIP");
641} 680}
642 681
643QString Addressee::emailLabel() 682QString Addressee::emailLabel()
644{ 683{
645 return i18n("Email Address"); 684 return i18n("Email Address");
646} 685}
647 686
648 687
649void Addressee::setMailer( const QString &mailer ) 688void Addressee::setMailer( const QString &mailer )
650{ 689{
651 if ( mailer == mData->mailer ) return; 690 if ( mailer == mData->mailer ) return;
652 detach(); 691 detach();
653 mData->empty = false; 692 mData->empty = false;
654 mData->mailer = mailer; 693 mData->mailer = mailer;
655} 694}
656 695
657QString Addressee::mailer() const 696QString Addressee::mailer() const
658{ 697{
659 return mData->mailer; 698 return mData->mailer;
660} 699}
661 700
662QString Addressee::mailerLabel() 701QString Addressee::mailerLabel()
663{ 702{
664 return i18n("Mail Client"); 703 return i18n("Mail Client");
665} 704}
666 705
667 706
668void Addressee::setTimeZone( const TimeZone &timeZone ) 707void Addressee::setTimeZone( const TimeZone &timeZone )
669{ 708{
670 if ( timeZone == mData->timeZone ) return; 709 if ( timeZone == mData->timeZone ) return;
671 detach(); 710 detach();
672 mData->empty = false; 711 mData->empty = false;
673 mData->timeZone = timeZone; 712 mData->timeZone = timeZone;
674} 713}
675 714
676TimeZone Addressee::timeZone() const 715TimeZone Addressee::timeZone() const
677{ 716{
678 return mData->timeZone; 717 return mData->timeZone;
679} 718}
680 719
681QString Addressee::timeZoneLabel() 720QString Addressee::timeZoneLabel()
682{ 721{
683 return i18n("Time Zone"); 722 return i18n("Time Zone");
684} 723}
685 724
686 725
687void Addressee::setGeo( const Geo &geo ) 726void Addressee::setGeo( const Geo &geo )
688{ 727{
689 if ( geo == mData->geo ) return; 728 if ( geo == mData->geo ) return;
690 detach(); 729 detach();
691 mData->empty = false; 730 mData->empty = false;
692 mData->geo = geo; 731 mData->geo = geo;
693} 732}
694 733
695Geo Addressee::geo() const 734Geo Addressee::geo() const
696{ 735{
697 return mData->geo; 736 return mData->geo;
698} 737}
699 738
700QString Addressee::geoLabel() 739QString Addressee::geoLabel()
701{ 740{
702 return i18n("Geographic Position"); 741 return i18n("Geographic Position");
703} 742}
704 743
705 744
706void Addressee::setTitle( const QString &title ) 745void Addressee::setTitle( const QString &title )
707{ 746{
708 if ( title == mData->title ) return; 747 if ( title == mData->title ) return;
709 detach(); 748 detach();
710 mData->empty = false; 749 mData->empty = false;
711 mData->title = title; 750 mData->title = title;
712} 751}
713 752
714QString Addressee::title() const 753QString Addressee::title() const
715{ 754{
716 return mData->title; 755 return mData->title;
717} 756}
718 757
719QString Addressee::titleLabel() 758QString Addressee::titleLabel()
720{ 759{
721 return i18n("Title"); 760 return i18n("Title");
722} 761}
723 762
724 763
725void Addressee::setRole( const QString &role ) 764void Addressee::setRole( const QString &role )
726{ 765{
727 if ( role == mData->role ) return; 766 if ( role == mData->role ) return;
728 detach(); 767 detach();
729 mData->empty = false; 768 mData->empty = false;
730 mData->role = role; 769 mData->role = role;
731} 770}
732 771
733QString Addressee::role() const 772QString Addressee::role() const
734{ 773{
735 return mData->role; 774 return mData->role;
736} 775}
737 776
738QString Addressee::roleLabel() 777QString Addressee::roleLabel()
739{ 778{
740 return i18n("Role"); 779 return i18n("Role");
741} 780}
742 781
743 782
744void Addressee::setOrganization( const QString &organization ) 783void Addressee::setOrganization( const QString &organization )
745{ 784{
746 if ( organization == mData->organization ) return; 785 if ( organization == mData->organization ) return;
747 detach(); 786 detach();
748 mData->empty = false; 787 mData->empty = false;
749 mData->organization = organization; 788 mData->organization = organization;
750} 789}
751 790
752QString Addressee::organization() const 791QString Addressee::organization() const
753{ 792{
754 return mData->organization; 793 return mData->organization;
755} 794}
756 795
757QString Addressee::organizationLabel() 796QString Addressee::organizationLabel()
758{ 797{
759 return i18n("Organization"); 798 return i18n("Organization");
760} 799}
761 800
762 801
763void Addressee::setNote( const QString &note ) 802void Addressee::setNote( const QString &note )
764{ 803{
765 if ( note == mData->note ) return; 804 if ( note == mData->note ) return;
766 detach(); 805 detach();
767 mData->empty = false; 806 mData->empty = false;
768 mData->note = note; 807 mData->note = note;
769} 808}
770 809
771QString Addressee::note() const 810QString Addressee::note() const
772{ 811{
773 return mData->note; 812 return mData->note;
774} 813}
775 814
776QString Addressee::noteLabel() 815QString Addressee::noteLabel()
777{ 816{
778 return i18n("Note"); 817 return i18n("Note");
779} 818}
780 819
781 820
782void Addressee::setProductId( const QString &productId ) 821void Addressee::setProductId( const QString &productId )
783{ 822{
784 if ( productId == mData->productId ) return; 823 if ( productId == mData->productId ) return;
785 detach(); 824 detach();
786 mData->empty = false; 825 mData->empty = false;
787 mData->productId = productId; 826 mData->productId = productId;
788} 827}
789 828
790QString Addressee::productId() const 829QString Addressee::productId() const
791{ 830{
792 return mData->productId; 831 return mData->productId;
793} 832}
794 833
795QString Addressee::productIdLabel() 834QString Addressee::productIdLabel()
796{ 835{
797 return i18n("Product Identifier"); 836 return i18n("Product Identifier");
798} 837}
799 838
800 839
801void Addressee::setRevision( const QDateTime &revision ) 840void Addressee::setRevision( const QDateTime &revision )
802{ 841{
803 if ( revision == mData->revision ) return; 842 if ( revision == mData->revision ) return;
804 detach(); 843 detach();
805 mData->empty = false; 844 mData->empty = false;
806 mData->revision = revision; 845 mData->revision = revision;
807} 846}
808 847
809QDateTime Addressee::revision() const 848QDateTime Addressee::revision() const
810{ 849{
811 return mData->revision; 850 return mData->revision;
812} 851}
813 852
814QString Addressee::revisionLabel() 853QString Addressee::revisionLabel()
815{ 854{
816 return i18n("Revision Date"); 855 return i18n("Revision Date");
817} 856}
818 857
819 858
820void Addressee::setSortString( const QString &sortString ) 859void Addressee::setSortString( const QString &sortString )
821{ 860{
822 if ( sortString == mData->sortString ) return; 861 if ( sortString == mData->sortString ) return;
823 detach(); 862 detach();
824 mData->empty = false; 863 mData->empty = false;
825 mData->sortString = sortString; 864 mData->sortString = sortString;
826} 865}
827 866
828QString Addressee::sortString() const 867QString Addressee::sortString() const
829{ 868{
830 return mData->sortString; 869 return mData->sortString;
831} 870}
832 871
833QString Addressee::sortStringLabel() 872QString Addressee::sortStringLabel()
834{ 873{
835 return i18n("Sort String"); 874 return i18n("Sort String");
836} 875}
837 876