summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 0157721..3a2dc5f 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -1,1070 +1,1077 @@
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 QString externalUID;
70 KURL url; 70 KURL url;
71 Secrecy secrecy; 71 Secrecy secrecy;
72 Picture logo; 72 Picture logo;
73 Picture photo; 73 Picture photo;
74 Sound sound; 74 Sound sound;
75 Agent agent; 75 Agent agent;
76 QString mExternalId; 76 QString mExternalId;
77 PhoneNumber::List phoneNumbers; 77 PhoneNumber::List phoneNumbers;
78 Address::List addresses; 78 Address::List addresses;
79 Key::List keys; 79 Key::List keys;
80 QStringList emails; 80 QStringList emails;
81 QStringList categories; 81 QStringList categories;
82 QStringList custom; 82 QStringList custom;
83 int mTempSyncStat; 83 int mTempSyncStat;
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
90Addressee::Addressee() 90Addressee::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
101Addressee::~Addressee() 101Addressee::~Addressee()
102{ 102{
103} 103}
104 104
105Addressee::Addressee( const Addressee &a ) 105Addressee::Addressee( const Addressee &a )
106{ 106{
107 mData = a.mData; 107 mData = a.mData;
108} 108}
109 109
110Addressee &Addressee::operator=( const Addressee &a ) 110Addressee &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
116Addressee Addressee::copy() 116Addressee 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
123void Addressee::detach() 123void 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
129bool Addressee::operator==( const Addressee &a ) const 129bool 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
168bool Addressee::operator!=( const Addressee &a ) const 168bool Addressee::operator!=( const Addressee &a ) const
169{ 169{
170 return !( a == *this ); 170 return !( a == *this );
171} 171}
172 172
173bool Addressee::isEmpty() const 173bool Addressee::isEmpty() const
174{ 174{
175 return mData->empty; 175 return mData->empty;
176} 176}
177ulong Addressee::getCsum4List( const QStringList & attList) 177ulong 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}
205void Addressee::computeCsum(const QString &dev) 205void 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
276void Addressee::mergeContact( const Addressee& ad ) 276void Addressee::mergeContact( const Addressee& ad )
277{ 277{
278 278
279 detach(); 279 detach();
280 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 280 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
281 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 281 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
282 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 282 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
283 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 283 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
284 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 284 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
285 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; 285 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
286 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; 286 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
287 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; 287 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
288 if ( !mData->birthday.isValid() ) 288 if ( !mData->birthday.isValid() )
289 if ( ad.mData->birthday.isValid()) 289 if ( ad.mData->birthday.isValid())
290 mData->birthday = ad.mData->birthday; 290 mData->birthday = ad.mData->birthday;
291 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 291 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
292#if 0 292 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
293 if ( !mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); 293 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
294 if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); 294 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
295 if ( !mData->title .isEmpty() ) l.append( mData->title ); 295 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
296 if ( !mData->role.isEmpty() ) l.append( mData->role ); 296 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
297 if ( !mData->organization.isEmpty() ) l.append( mData->organization ); 297 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
298 if ( !mData->note.isEmpty() ) l.append( mData->note ); 298 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
299 if ( !mData->productId.isEmpty() ) l.append(mData->productId ); 299 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
300 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); 300 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
301 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); 301 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
302#endif 302
303 // pending:
304 // merging phonenumbers
305 // merging addresses
306 // merging emails;
307 // merging categories;
308 // merging custom;
309 // merging keys
303} 310}
304 311
305void Addressee::removeID(const QString &prof) 312void Addressee::removeID(const QString &prof)
306{ 313{
307 detach(); 314 detach();
308 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 315 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
309 316
310} 317}
311void Addressee::setID( const QString & prof , const QString & id ) 318void Addressee::setID( const QString & prof , const QString & id )
312{ 319{
313 detach(); 320 detach();
314 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 321 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
315 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 322 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
316} 323}
317void Addressee::setTempSyncStat( int id ) 324void Addressee::setTempSyncStat( int id )
318{ 325{
319 if ( mData->mTempSyncStat == id ) return; 326 if ( mData->mTempSyncStat == id ) return;
320 detach(); 327 detach();
321 mData->mTempSyncStat = id; 328 mData->mTempSyncStat = id;
322} 329}
323int Addressee::tempSyncStat() const 330int Addressee::tempSyncStat() const
324{ 331{
325 return mData->mTempSyncStat; 332 return mData->mTempSyncStat;
326} 333}
327 334
328QString Addressee::getID( const QString & prof) 335QString Addressee::getID( const QString & prof)
329{ 336{
330 return KIdManager::getId ( mData->mExternalId, prof ); 337 return KIdManager::getId ( mData->mExternalId, prof );
331} 338}
332 339
333void Addressee::setCsum( const QString & prof , const QString & id ) 340void Addressee::setCsum( const QString & prof , const QString & id )
334{ 341{
335 detach(); 342 detach();
336 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 343 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
337 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); 344 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
338 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); 345 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
339} 346}
340 347
341QString Addressee::getCsum( const QString & prof) 348QString Addressee::getCsum( const QString & prof)
342{ 349{
343 return KIdManager::getCsum ( mData->mExternalId, prof ); 350 return KIdManager::getCsum ( mData->mExternalId, prof );
344} 351}
345 352
346void Addressee::setIDStr( const QString & s ) 353void Addressee::setIDStr( const QString & s )
347{ 354{
348 detach(); 355 detach();
349 mData->mExternalId = s; 356 mData->mExternalId = s;
350} 357}
351 358
352QString Addressee::IDStr() const 359QString Addressee::IDStr() const
353{ 360{
354 return mData->mExternalId; 361 return mData->mExternalId;
355} 362}
356 363
357void Addressee::setExternalUID( const QString &id ) 364void Addressee::setExternalUID( const QString &id )
358{ 365{
359 if ( id == mData->externalUID ) return; 366 if ( id == mData->externalUID ) return;
360 detach(); 367 detach();
361 mData->empty = false; 368 mData->empty = false;
362 mData->externalUID = id; 369 mData->externalUID = id;
363} 370}
364 371
365QString Addressee::externalUID() const 372QString Addressee::externalUID() const
366{ 373{
367 return mData->externalUID; 374 return mData->externalUID;
368} 375}
369 376
370void Addressee::setUid( const QString &id ) 377void Addressee::setUid( const QString &id )
371{ 378{
372 if ( id == mData->uid ) return; 379 if ( id == mData->uid ) return;
373 detach(); 380 detach();
374 mData->empty = false; 381 mData->empty = false;
375 mData->uid = id; 382 mData->uid = id;
376} 383}
377 384
378QString Addressee::uid() const 385QString Addressee::uid() const
379{ 386{
380 if ( mData->uid.isEmpty() ) 387 if ( mData->uid.isEmpty() )
381 mData->uid = KApplication::randomString( 10 ); 388 mData->uid = KApplication::randomString( 10 );
382 389
383 return mData->uid; 390 return mData->uid;
384} 391}
385 392
386QString Addressee::uidLabel() 393QString Addressee::uidLabel()
387{ 394{
388 return i18n("Unique Identifier"); 395 return i18n("Unique Identifier");
389} 396}
390 397
391void Addressee::setName( const QString &name ) 398void Addressee::setName( const QString &name )
392{ 399{
393 if ( name == mData->name ) return; 400 if ( name == mData->name ) return;
394 detach(); 401 detach();
395 mData->empty = false; 402 mData->empty = false;
396 mData->name = name; 403 mData->name = name;
397} 404}
398 405
399QString Addressee::name() const 406QString Addressee::name() const
400{ 407{
401 return mData->name; 408 return mData->name;
402} 409}
403 410
404QString Addressee::nameLabel() 411QString Addressee::nameLabel()
405{ 412{
406 return i18n("Name"); 413 return i18n("Name");
407} 414}
408 415
409 416
410void Addressee::setFormattedName( const QString &formattedName ) 417void Addressee::setFormattedName( const QString &formattedName )
411{ 418{
412 if ( formattedName == mData->formattedName ) return; 419 if ( formattedName == mData->formattedName ) return;
413 detach(); 420 detach();
414 mData->empty = false; 421 mData->empty = false;
415 mData->formattedName = formattedName; 422 mData->formattedName = formattedName;
416} 423}
417 424
418QString Addressee::formattedName() const 425QString Addressee::formattedName() const
419{ 426{
420 return mData->formattedName; 427 return mData->formattedName;
421} 428}
422 429
423QString Addressee::formattedNameLabel() 430QString Addressee::formattedNameLabel()
424{ 431{
425 return i18n("Formatted Name"); 432 return i18n("Formatted Name");
426} 433}
427 434
428 435
429void Addressee::setFamilyName( const QString &familyName ) 436void Addressee::setFamilyName( const QString &familyName )
430{ 437{
431 if ( familyName == mData->familyName ) return; 438 if ( familyName == mData->familyName ) return;
432 detach(); 439 detach();
433 mData->empty = false; 440 mData->empty = false;
434 mData->familyName = familyName; 441 mData->familyName = familyName;
435} 442}
436 443
437QString Addressee::familyName() const 444QString Addressee::familyName() const
438{ 445{
439 return mData->familyName; 446 return mData->familyName;
440} 447}
441 448
442QString Addressee::familyNameLabel() 449QString Addressee::familyNameLabel()
443{ 450{
444 return i18n("Family Name"); 451 return i18n("Family Name");
445} 452}
446 453
447 454
448void Addressee::setGivenName( const QString &givenName ) 455void Addressee::setGivenName( const QString &givenName )
449{ 456{
450 if ( givenName == mData->givenName ) return; 457 if ( givenName == mData->givenName ) return;
451 detach(); 458 detach();
452 mData->empty = false; 459 mData->empty = false;
453 mData->givenName = givenName; 460 mData->givenName = givenName;
454} 461}
455 462
456QString Addressee::givenName() const 463QString Addressee::givenName() const
457{ 464{
458 return mData->givenName; 465 return mData->givenName;
459} 466}
460 467
461QString Addressee::givenNameLabel() 468QString Addressee::givenNameLabel()
462{ 469{
463 return i18n("Given Name"); 470 return i18n("Given Name");
464} 471}
465 472
466 473
467void Addressee::setAdditionalName( const QString &additionalName ) 474void Addressee::setAdditionalName( const QString &additionalName )
468{ 475{
469 if ( additionalName == mData->additionalName ) return; 476 if ( additionalName == mData->additionalName ) return;
470 detach(); 477 detach();
471 mData->empty = false; 478 mData->empty = false;
472 mData->additionalName = additionalName; 479 mData->additionalName = additionalName;
473} 480}
474 481
475QString Addressee::additionalName() const 482QString Addressee::additionalName() const
476{ 483{
477 return mData->additionalName; 484 return mData->additionalName;
478} 485}
479 486
480QString Addressee::additionalNameLabel() 487QString Addressee::additionalNameLabel()
481{ 488{
482 return i18n("Additional Names"); 489 return i18n("Additional Names");
483} 490}
484 491
485 492
486void Addressee::setPrefix( const QString &prefix ) 493void Addressee::setPrefix( const QString &prefix )
487{ 494{
488 if ( prefix == mData->prefix ) return; 495 if ( prefix == mData->prefix ) return;
489 detach(); 496 detach();
490 mData->empty = false; 497 mData->empty = false;
491 mData->prefix = prefix; 498 mData->prefix = prefix;
492} 499}
493 500
494QString Addressee::prefix() const 501QString Addressee::prefix() const
495{ 502{
496 return mData->prefix; 503 return mData->prefix;
497} 504}
498 505
499QString Addressee::prefixLabel() 506QString Addressee::prefixLabel()
500{ 507{
501 return i18n("Honorific Prefixes"); 508 return i18n("Honorific Prefixes");
502} 509}
503 510
504 511
505void Addressee::setSuffix( const QString &suffix ) 512void Addressee::setSuffix( const QString &suffix )
506{ 513{
507 if ( suffix == mData->suffix ) return; 514 if ( suffix == mData->suffix ) return;
508 detach(); 515 detach();
509 mData->empty = false; 516 mData->empty = false;
510 mData->suffix = suffix; 517 mData->suffix = suffix;
511} 518}
512 519
513QString Addressee::suffix() const 520QString Addressee::suffix() const
514{ 521{
515 return mData->suffix; 522 return mData->suffix;
516} 523}
517 524
518QString Addressee::suffixLabel() 525QString Addressee::suffixLabel()
519{ 526{
520 return i18n("Honorific Suffixes"); 527 return i18n("Honorific Suffixes");
521} 528}
522 529
523 530
524void Addressee::setNickName( const QString &nickName ) 531void Addressee::setNickName( const QString &nickName )
525{ 532{
526 if ( nickName == mData->nickName ) return; 533 if ( nickName == mData->nickName ) return;
527 detach(); 534 detach();
528 mData->empty = false; 535 mData->empty = false;
529 mData->nickName = nickName; 536 mData->nickName = nickName;
530} 537}
531 538
532QString Addressee::nickName() const 539QString Addressee::nickName() const
533{ 540{
534 return mData->nickName; 541 return mData->nickName;
535} 542}
536 543
537QString Addressee::nickNameLabel() 544QString Addressee::nickNameLabel()
538{ 545{
539 return i18n("Nick Name"); 546 return i18n("Nick Name");
540} 547}
541 548
542 549
543void Addressee::setBirthday( const QDateTime &birthday ) 550void Addressee::setBirthday( const QDateTime &birthday )
544{ 551{
545 if ( birthday == mData->birthday ) return; 552 if ( birthday == mData->birthday ) return;
546 detach(); 553 detach();
547 mData->empty = false; 554 mData->empty = false;
548 mData->birthday = birthday; 555 mData->birthday = birthday;
549} 556}
550 557
551QDateTime Addressee::birthday() const 558QDateTime Addressee::birthday() const
552{ 559{
553 return mData->birthday; 560 return mData->birthday;
554} 561}
555 562
556QString Addressee::birthdayLabel() 563QString Addressee::birthdayLabel()
557{ 564{
558 return i18n("Birthday"); 565 return i18n("Birthday");
559} 566}
560 567
561 568
562QString Addressee::homeAddressStreetLabel() 569QString Addressee::homeAddressStreetLabel()
563{ 570{
564 return i18n("Home Address Street"); 571 return i18n("Home Address Street");
565} 572}
566 573
567 574
568QString Addressee::homeAddressLocalityLabel() 575QString Addressee::homeAddressLocalityLabel()
569{ 576{
570 return i18n("Home Address Locality"); 577 return i18n("Home Address Locality");
571} 578}
572 579
573 580
574QString Addressee::homeAddressRegionLabel() 581QString Addressee::homeAddressRegionLabel()
575{ 582{
576 return i18n("Home Address Region"); 583 return i18n("Home Address Region");
577} 584}
578 585
579 586
580QString Addressee::homeAddressPostalCodeLabel() 587QString Addressee::homeAddressPostalCodeLabel()
581{ 588{
582 return i18n("Home Address Postal Code"); 589 return i18n("Home Address Postal Code");
583} 590}
584 591
585 592
586QString Addressee::homeAddressCountryLabel() 593QString Addressee::homeAddressCountryLabel()
587{ 594{
588 return i18n("Home Address Country"); 595 return i18n("Home Address Country");
589} 596}
590 597
591 598
592QString Addressee::homeAddressLabelLabel() 599QString Addressee::homeAddressLabelLabel()
593{ 600{
594 return i18n("Home Address Label"); 601 return i18n("Home Address Label");
595} 602}
596 603
597 604
598QString Addressee::businessAddressStreetLabel() 605QString Addressee::businessAddressStreetLabel()
599{ 606{
600 return i18n("Business Address Street"); 607 return i18n("Business Address Street");
601} 608}
602 609
603 610
604QString Addressee::businessAddressLocalityLabel() 611QString Addressee::businessAddressLocalityLabel()
605{ 612{
606 return i18n("Business Address Locality"); 613 return i18n("Business Address Locality");
607} 614}
608 615
609 616
610QString Addressee::businessAddressRegionLabel() 617QString Addressee::businessAddressRegionLabel()
611{ 618{
612 return i18n("Business Address Region"); 619 return i18n("Business Address Region");
613} 620}
614 621
615 622
616QString Addressee::businessAddressPostalCodeLabel() 623QString Addressee::businessAddressPostalCodeLabel()
617{ 624{
618 return i18n("Business Address Postal Code"); 625 return i18n("Business Address Postal Code");
619} 626}
620 627
621 628
622QString Addressee::businessAddressCountryLabel() 629QString Addressee::businessAddressCountryLabel()
623{ 630{
624 return i18n("Business Address Country"); 631 return i18n("Business Address Country");
625} 632}
626 633
627 634
628QString Addressee::businessAddressLabelLabel() 635QString Addressee::businessAddressLabelLabel()
629{ 636{
630 return i18n("Business Address Label"); 637 return i18n("Business Address Label");
631} 638}
632 639
633 640
634QString Addressee::homePhoneLabel() 641QString Addressee::homePhoneLabel()
635{ 642{
636 return i18n("Home Phone"); 643 return i18n("Home Phone");
637} 644}
638 645
639 646
640QString Addressee::businessPhoneLabel() 647QString Addressee::businessPhoneLabel()
641{ 648{
642 return i18n("Business Phone"); 649 return i18n("Business Phone");
643} 650}
644 651
645 652
646QString Addressee::mobilePhoneLabel() 653QString Addressee::mobilePhoneLabel()
647{ 654{
648 return i18n("Mobile Phone"); 655 return i18n("Mobile Phone");
649} 656}
650 657
651 658
652QString Addressee::homeFaxLabel() 659QString Addressee::homeFaxLabel()
653{ 660{
654 return i18n("Home Fax"); 661 return i18n("Home Fax");
655} 662}
656 663
657 664
658QString Addressee::businessFaxLabel() 665QString Addressee::businessFaxLabel()
659{ 666{
660 return i18n("Business Fax"); 667 return i18n("Business Fax");
661} 668}
662 669
663 670
664QString Addressee::carPhoneLabel() 671QString Addressee::carPhoneLabel()
665{ 672{
666 return i18n("Car Phone"); 673 return i18n("Car Phone");
667} 674}
668 675
669 676
670QString Addressee::isdnLabel() 677QString Addressee::isdnLabel()
671{ 678{
672 return i18n("ISDN"); 679 return i18n("ISDN");
673} 680}
674 681
675 682
676QString Addressee::pagerLabel() 683QString Addressee::pagerLabel()
677{ 684{
678 return i18n("Pager"); 685 return i18n("Pager");
679} 686}
680 687
681QString Addressee::sipLabel() 688QString Addressee::sipLabel()
682{ 689{
683 return i18n("SIP"); 690 return i18n("SIP");
684} 691}
685 692
686QString Addressee::emailLabel() 693QString Addressee::emailLabel()
687{ 694{
688 return i18n("Email Address"); 695 return i18n("Email Address");
689} 696}
690 697
691 698
692void Addressee::setMailer( const QString &mailer ) 699void Addressee::setMailer( const QString &mailer )
693{ 700{
694 if ( mailer == mData->mailer ) return; 701 if ( mailer == mData->mailer ) return;
695 detach(); 702 detach();
696 mData->empty = false; 703 mData->empty = false;
697 mData->mailer = mailer; 704 mData->mailer = mailer;
698} 705}
699 706
700QString Addressee::mailer() const 707QString Addressee::mailer() const
701{ 708{
702 return mData->mailer; 709 return mData->mailer;
703} 710}
704 711
705QString Addressee::mailerLabel() 712QString Addressee::mailerLabel()
706{ 713{
707 return i18n("Mail Client"); 714 return i18n("Mail Client");
708} 715}
709 716
710 717
711void Addressee::setTimeZone( const TimeZone &timeZone ) 718void Addressee::setTimeZone( const TimeZone &timeZone )
712{ 719{
713 if ( timeZone == mData->timeZone ) return; 720 if ( timeZone == mData->timeZone ) return;
714 detach(); 721 detach();
715 mData->empty = false; 722 mData->empty = false;
716 mData->timeZone = timeZone; 723 mData->timeZone = timeZone;
717} 724}
718 725
719TimeZone Addressee::timeZone() const 726TimeZone Addressee::timeZone() const
720{ 727{
721 return mData->timeZone; 728 return mData->timeZone;
722} 729}
723 730
724QString Addressee::timeZoneLabel() 731QString Addressee::timeZoneLabel()
725{ 732{
726 return i18n("Time Zone"); 733 return i18n("Time Zone");
727} 734}
728 735
729 736
730void Addressee::setGeo( const Geo &geo ) 737void Addressee::setGeo( const Geo &geo )
731{ 738{
732 if ( geo == mData->geo ) return; 739 if ( geo == mData->geo ) return;
733 detach(); 740 detach();
734 mData->empty = false; 741 mData->empty = false;
735 mData->geo = geo; 742 mData->geo = geo;
736} 743}
737 744
738Geo Addressee::geo() const 745Geo Addressee::geo() const
739{ 746{
740 return mData->geo; 747 return mData->geo;
741} 748}
742 749
743QString Addressee::geoLabel() 750QString Addressee::geoLabel()
744{ 751{
745 return i18n("Geographic Position"); 752 return i18n("Geographic Position");
746} 753}
747 754
748 755
749void Addressee::setTitle( const QString &title ) 756void Addressee::setTitle( const QString &title )
750{ 757{
751 if ( title == mData->title ) return; 758 if ( title == mData->title ) return;
752 detach(); 759 detach();
753 mData->empty = false; 760 mData->empty = false;
754 mData->title = title; 761 mData->title = title;
755} 762}
756 763
757QString Addressee::title() const 764QString Addressee::title() const
758{ 765{
759 return mData->title; 766 return mData->title;
760} 767}
761 768
762QString Addressee::titleLabel() 769QString Addressee::titleLabel()
763{ 770{
764 return i18n("Title"); 771 return i18n("Title");
765} 772}
766 773
767 774
768void Addressee::setRole( const QString &role ) 775void Addressee::setRole( const QString &role )
769{ 776{
770 if ( role == mData->role ) return; 777 if ( role == mData->role ) return;
771 detach(); 778 detach();
772 mData->empty = false; 779 mData->empty = false;
773 mData->role = role; 780 mData->role = role;
774} 781}
775 782
776QString Addressee::role() const 783QString Addressee::role() const
777{ 784{
778 return mData->role; 785 return mData->role;
779} 786}
780 787
781QString Addressee::roleLabel() 788QString Addressee::roleLabel()
782{ 789{
783 return i18n("Role"); 790 return i18n("Role");
784} 791}
785 792
786 793
787void Addressee::setOrganization( const QString &organization ) 794void Addressee::setOrganization( const QString &organization )
788{ 795{
789 if ( organization == mData->organization ) return; 796 if ( organization == mData->organization ) return;
790 detach(); 797 detach();
791 mData->empty = false; 798 mData->empty = false;
792 mData->organization = organization; 799 mData->organization = organization;
793} 800}
794 801
795QString Addressee::organization() const 802QString Addressee::organization() const
796{ 803{
797 return mData->organization; 804 return mData->organization;
798} 805}
799 806
800QString Addressee::organizationLabel() 807QString Addressee::organizationLabel()
801{ 808{
802 return i18n("Organization"); 809 return i18n("Organization");
803} 810}
804 811
805 812
806void Addressee::setNote( const QString &note ) 813void Addressee::setNote( const QString &note )
807{ 814{
808 if ( note == mData->note ) return; 815 if ( note == mData->note ) return;
809 detach(); 816 detach();
810 mData->empty = false; 817 mData->empty = false;
811 mData->note = note; 818 mData->note = note;
812} 819}
813 820
814QString Addressee::note() const 821QString Addressee::note() const
815{ 822{
816 return mData->note; 823 return mData->note;
817} 824}
818 825
819QString Addressee::noteLabel() 826QString Addressee::noteLabel()
820{ 827{
821 return i18n("Note"); 828 return i18n("Note");
822} 829}
823 830
824 831
825void Addressee::setProductId( const QString &productId ) 832void Addressee::setProductId( const QString &productId )
826{ 833{
827 if ( productId == mData->productId ) return; 834 if ( productId == mData->productId ) return;
828 detach(); 835 detach();
829 mData->empty = false; 836 mData->empty = false;
830 mData->productId = productId; 837 mData->productId = productId;
831} 838}
832 839
833QString Addressee::productId() const 840QString Addressee::productId() const
834{ 841{
835 return mData->productId; 842 return mData->productId;
836} 843}
837 844
838QString Addressee::productIdLabel() 845QString Addressee::productIdLabel()
839{ 846{
840 return i18n("Product Identifier"); 847 return i18n("Product Identifier");
841} 848}
842 849
843 850
844void Addressee::setRevision( const QDateTime &revision ) 851void Addressee::setRevision( const QDateTime &revision )
845{ 852{
846 if ( revision == mData->revision ) return; 853 if ( revision == mData->revision ) return;
847 detach(); 854 detach();
848 mData->empty = false; 855 mData->empty = false;
849 mData->revision = revision; 856 mData->revision = revision;
850} 857}
851 858
852QDateTime Addressee::revision() const 859QDateTime Addressee::revision() const
853{ 860{
854 return mData->revision; 861 return mData->revision;
855} 862}
856 863
857QString Addressee::revisionLabel() 864QString Addressee::revisionLabel()
858{ 865{
859 return i18n("Revision Date"); 866 return i18n("Revision Date");
860} 867}
861 868
862 869
863void Addressee::setSortString( const QString &sortString ) 870void Addressee::setSortString( const QString &sortString )
864{ 871{
865 if ( sortString == mData->sortString ) return; 872 if ( sortString == mData->sortString ) return;
866 detach(); 873 detach();
867 mData->empty = false; 874 mData->empty = false;
868 mData->sortString = sortString; 875 mData->sortString = sortString;
869} 876}
870 877
871QString Addressee::sortString() const 878QString Addressee::sortString() const
872{ 879{
873 return mData->sortString; 880 return mData->sortString;
874} 881}
875 882
876QString Addressee::sortStringLabel() 883QString Addressee::sortStringLabel()
877{ 884{
878 return i18n("Sort String"); 885 return i18n("Sort String");
879} 886}
880 887
881 888
882void Addressee::setUrl( const KURL &url ) 889void Addressee::setUrl( const KURL &url )
883{ 890{
884 if ( url == mData->url ) return; 891 if ( url == mData->url ) return;
885 detach(); 892 detach();
886 mData->empty = false; 893 mData->empty = false;
887 mData->url = url; 894 mData->url = url;
888} 895}
889 896
890KURL Addressee::url() const 897KURL Addressee::url() const
891{ 898{
892 return mData->url; 899 return mData->url;
893} 900}
894 901
895QString Addressee::urlLabel() 902QString Addressee::urlLabel()
896{ 903{
897 return i18n("URL"); 904 return i18n("URL");
898} 905}
899 906
900 907
901void Addressee::setSecrecy( const Secrecy &secrecy ) 908void Addressee::setSecrecy( const Secrecy &secrecy )
902{ 909{
903 if ( secrecy == mData->secrecy ) return; 910 if ( secrecy == mData->secrecy ) return;
904 detach(); 911 detach();
905 mData->empty = false; 912 mData->empty = false;
906 mData->secrecy = secrecy; 913 mData->secrecy = secrecy;
907} 914}
908 915
909Secrecy Addressee::secrecy() const 916Secrecy Addressee::secrecy() const
910{ 917{
911 return mData->secrecy; 918 return mData->secrecy;
912} 919}
913 920
914QString Addressee::secrecyLabel() 921QString Addressee::secrecyLabel()
915{ 922{
916 return i18n("Security Class"); 923 return i18n("Security Class");
917} 924}
918 925
919 926
920void Addressee::setLogo( const Picture &logo ) 927void Addressee::setLogo( const Picture &logo )
921{ 928{
922 if ( logo == mData->logo ) return; 929 if ( logo == mData->logo ) return;
923 detach(); 930 detach();
924 mData->empty = false; 931 mData->empty = false;
925 mData->logo = logo; 932 mData->logo = logo;
926} 933}
927 934
928Picture Addressee::logo() const 935Picture Addressee::logo() const
929{ 936{
930 return mData->logo; 937 return mData->logo;
931} 938}
932 939
933QString Addressee::logoLabel() 940QString Addressee::logoLabel()
934{ 941{
935 return i18n("Logo"); 942 return i18n("Logo");
936} 943}
937 944
938 945
939void Addressee::setPhoto( const Picture &photo ) 946void Addressee::setPhoto( const Picture &photo )
940{ 947{
941 if ( photo == mData->photo ) return; 948 if ( photo == mData->photo ) return;
942 detach(); 949 detach();
943 mData->empty = false; 950 mData->empty = false;
944 mData->photo = photo; 951 mData->photo = photo;
945} 952}
946 953
947Picture Addressee::photo() const 954Picture Addressee::photo() const
948{ 955{
949 return mData->photo; 956 return mData->photo;
950} 957}
951 958
952QString Addressee::photoLabel() 959QString Addressee::photoLabel()
953{ 960{
954 return i18n("Photo"); 961 return i18n("Photo");
955} 962}
956 963
957 964
958void Addressee::setSound( const Sound &sound ) 965void Addressee::setSound( const Sound &sound )
959{ 966{
960 if ( sound == mData->sound ) return; 967 if ( sound == mData->sound ) return;
961 detach(); 968 detach();
962 mData->empty = false; 969 mData->empty = false;
963 mData->sound = sound; 970 mData->sound = sound;
964} 971}
965 972
966Sound Addressee::sound() const 973Sound Addressee::sound() const
967{ 974{
968 return mData->sound; 975 return mData->sound;
969} 976}
970 977
971QString Addressee::soundLabel() 978QString Addressee::soundLabel()
972{ 979{
973 return i18n("Sound"); 980 return i18n("Sound");
974} 981}
975 982
976 983
977void Addressee::setAgent( const Agent &agent ) 984void Addressee::setAgent( const Agent &agent )
978{ 985{
979 if ( agent == mData->agent ) return; 986 if ( agent == mData->agent ) return;
980 detach(); 987 detach();
981 mData->empty = false; 988 mData->empty = false;
982 mData->agent = agent; 989 mData->agent = agent;
983} 990}
984 991
985Agent Addressee::agent() const 992Agent Addressee::agent() const
986{ 993{
987 return mData->agent; 994 return mData->agent;
988} 995}
989 996
990QString Addressee::agentLabel() 997QString Addressee::agentLabel()
991{ 998{
992 return i18n("Agent"); 999 return i18n("Agent");
993} 1000}
994 1001
995 1002
996 1003
997void Addressee::setNameFromString( const QString &str ) 1004void Addressee::setNameFromString( const QString &str )
998{ 1005{
999 setFormattedName( str ); 1006 setFormattedName( str );
1000 setName( str ); 1007 setName( str );
1001 1008
1002 static bool first = true; 1009 static bool first = true;
1003 static QStringList titles; 1010 static QStringList titles;
1004 static QStringList suffixes; 1011 static QStringList suffixes;
1005 static QStringList prefixes; 1012 static QStringList prefixes;
1006 1013
1007 if ( first ) { 1014 if ( first ) {
1008 first = false; 1015 first = false;
1009 titles += i18n( "Dr." ); 1016 titles += i18n( "Dr." );
1010 titles += i18n( "Miss" ); 1017 titles += i18n( "Miss" );
1011 titles += i18n( "Mr." ); 1018 titles += i18n( "Mr." );
1012 titles += i18n( "Mrs." ); 1019 titles += i18n( "Mrs." );
1013 titles += i18n( "Ms." ); 1020 titles += i18n( "Ms." );
1014 titles += i18n( "Prof." ); 1021 titles += i18n( "Prof." );
1015 1022
1016 suffixes += i18n( "I" ); 1023 suffixes += i18n( "I" );
1017 suffixes += i18n( "II" ); 1024 suffixes += i18n( "II" );
1018 suffixes += i18n( "III" ); 1025 suffixes += i18n( "III" );
1019 suffixes += i18n( "Jr." ); 1026 suffixes += i18n( "Jr." );
1020 suffixes += i18n( "Sr." ); 1027 suffixes += i18n( "Sr." );
1021 1028
1022 prefixes += "van"; 1029 prefixes += "van";
1023 prefixes += "von"; 1030 prefixes += "von";
1024 prefixes += "de"; 1031 prefixes += "de";
1025 1032
1026 KConfig config( locateLocal( "config", "kabcrc") ); 1033 KConfig config( locateLocal( "config", "kabcrc") );
1027 config.setGroup( "General" ); 1034 config.setGroup( "General" );
1028 titles += config.readListEntry( "Prefixes" ); 1035 titles += config.readListEntry( "Prefixes" );
1029 titles.remove( "" ); 1036 titles.remove( "" );
1030 prefixes += config.readListEntry( "Inclusions" ); 1037 prefixes += config.readListEntry( "Inclusions" );
1031 prefixes.remove( "" ); 1038 prefixes.remove( "" );
1032 suffixes += config.readListEntry( "Suffixes" ); 1039 suffixes += config.readListEntry( "Suffixes" );
1033 suffixes.remove( "" ); 1040 suffixes.remove( "" );
1034 } 1041 }
1035 1042
1036 // clear all name parts 1043 // clear all name parts
1037 setPrefix( "" ); 1044 setPrefix( "" );
1038 setGivenName( "" ); 1045 setGivenName( "" );
1039 setAdditionalName( "" ); 1046 setAdditionalName( "" );
1040 setFamilyName( "" ); 1047 setFamilyName( "" );
1041 setSuffix( "" ); 1048 setSuffix( "" );
1042 1049
1043 if ( str.isEmpty() ) 1050 if ( str.isEmpty() )
1044 return; 1051 return;
1045 1052
1046 int i = str.find(','); 1053 int i = str.find(',');
1047 if( i < 0 ) { 1054 if( i < 0 ) {
1048 QStringList parts = QStringList::split( " ", str ); 1055 QStringList parts = QStringList::split( " ", str );
1049 int leftOffset = 0; 1056 int leftOffset = 0;
1050 int rightOffset = parts.count() - 1; 1057 int rightOffset = parts.count() - 1;
1051 1058
1052 QString suffix; 1059 QString suffix;
1053 while ( rightOffset >= 0 ) { 1060 while ( rightOffset >= 0 ) {
1054 if ( suffixes.contains( parts[ rightOffset ] ) ) { 1061 if ( suffixes.contains( parts[ rightOffset ] ) ) {
1055 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); 1062 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " "));
1056 rightOffset--; 1063 rightOffset--;
1057 } else 1064 } else
1058 break; 1065 break;
1059 } 1066 }
1060 setSuffix( suffix ); 1067 setSuffix( suffix );
1061 1068
1062 if ( rightOffset < 0 ) 1069 if ( rightOffset < 0 )
1063 return; 1070 return;
1064 1071
1065 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { 1072 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) {
1066 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); 1073 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] );
1067 rightOffset--; 1074 rightOffset--;
1068 } else 1075 } else
1069 setFamilyName( parts[ rightOffset ] ); 1076 setFamilyName( parts[ rightOffset ] );
1070 1077