summaryrefslogtreecommitdiffabout
path: root/kabc
Unidiff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp17
-rw-r--r--kabc/addressee.h3
-rw-r--r--kabc/field.cpp6
3 files changed, 0 insertions, 26 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 7f592e9..155ce24 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -1,1289 +1,1272 @@
1/*** Warning! This file has been generated by the script makeaddressee ***/ 1/*** Warning! This file has been generated by the script makeaddressee ***/
2/* 2/*
3 This file is part of libkabc. 3 This file is part of libkabc.
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22/* 22/*
23Enhanced Version of the file for platform independent KDE tools. 23Enhanced Version of the file for platform independent KDE tools.
24Copyright (c) 2004 Ulf Schenk 24Copyright (c) 2004 Ulf Schenk
25 25
26$Id$ 26$Id$
27*/ 27*/
28 28
29#include <kconfig.h> 29#include <kconfig.h>
30 30
31#include <ksharedptr.h> 31#include <ksharedptr.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <kapplication.h> 33#include <kapplication.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kidmanager.h> 35#include <kidmanager.h>
36//US 36//US
37#include <kstandarddirs.h> 37#include <kstandarddirs.h>
38#include <libkcal/syncdefines.h> 38#include <libkcal/syncdefines.h>
39 39
40//US #include "resource.h" 40//US #include "resource.h"
41#include "addressee.h" 41#include "addressee.h"
42 42
43using namespace KABC; 43using namespace KABC;
44 44
45static bool matchBinaryPattern( int value, int pattern ); 45static bool matchBinaryPattern( int value, int pattern );
46static bool matchBinaryPatternA( int value, int pattern ); 46static bool matchBinaryPatternA( int value, int pattern );
47static bool matchBinaryPatternP( int value, int pattern ); 47static bool matchBinaryPatternP( int value, int pattern );
48 48
49struct Addressee::AddresseeData : public KShared 49struct Addressee::AddresseeData : public KShared
50{ 50{
51 QString uid; 51 QString uid;
52 QString name; 52 QString name;
53 QString formattedName; 53 QString formattedName;
54 QString defaultFormattedName;
55 QString familyName; 54 QString familyName;
56 QString givenName; 55 QString givenName;
57 QString additionalName; 56 QString additionalName;
58 QString prefix; 57 QString prefix;
59 QString suffix; 58 QString suffix;
60 QString nickName; 59 QString nickName;
61 QDateTime birthday; 60 QDateTime birthday;
62 QString mailer; 61 QString mailer;
63 TimeZone timeZone; 62 TimeZone timeZone;
64 Geo geo; 63 Geo geo;
65 QString title; 64 QString title;
66 QString role; 65 QString role;
67 QString organization; 66 QString organization;
68 QString note; 67 QString note;
69 QString productId; 68 QString productId;
70 QDateTime revision; 69 QDateTime revision;
71 QString sortString; 70 QString sortString;
72 QString externalUID; 71 QString externalUID;
73 QString originalExternalUID; 72 QString originalExternalUID;
74 KURL url; 73 KURL url;
75 Secrecy secrecy; 74 Secrecy secrecy;
76 Picture logo; 75 Picture logo;
77 Picture photo; 76 Picture photo;
78 Sound sound; 77 Sound sound;
79 Agent agent; 78 Agent agent;
80 QString mExternalId; 79 QString mExternalId;
81 PhoneNumber::List phoneNumbers; 80 PhoneNumber::List phoneNumbers;
82 Address::List addresses; 81 Address::List addresses;
83 Key::List keys; 82 Key::List keys;
84 QStringList emails; 83 QStringList emails;
85 QStringList categories; 84 QStringList categories;
86 QStringList custom; 85 QStringList custom;
87 int mTempSyncStat; 86 int mTempSyncStat;
88 Resource *resource; 87 Resource *resource;
89 88
90 bool empty :1; 89 bool empty :1;
91 bool changed :1; 90 bool changed :1;
92 bool tagged :1; 91 bool tagged :1;
93}; 92};
94 93
95Addressee::Addressee() 94Addressee::Addressee()
96{ 95{
97 mData = new AddresseeData; 96 mData = new AddresseeData;
98 mData->empty = true; 97 mData->empty = true;
99 mData->changed = false; 98 mData->changed = false;
100 mData->resource = 0; 99 mData->resource = 0;
101 mData->mExternalId = ":"; 100 mData->mExternalId = ":";
102 mData->revision = QDateTime ( QDate( 2003,1,1)); 101 mData->revision = QDateTime ( QDate( 2003,1,1));
103 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; 102 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
104} 103}
105 104
106Addressee::~Addressee() 105Addressee::~Addressee()
107{ 106{
108} 107}
109 108
110Addressee::Addressee( const Addressee &a ) 109Addressee::Addressee( const Addressee &a )
111{ 110{
112 mData = a.mData; 111 mData = a.mData;
113} 112}
114 113
115Addressee &Addressee::operator=( const Addressee &a ) 114Addressee &Addressee::operator=( const Addressee &a )
116{ 115{
117 mData = a.mData; 116 mData = a.mData;
118 return (*this); 117 return (*this);
119} 118}
120 119
121Addressee Addressee::copy() 120Addressee Addressee::copy()
122{ 121{
123 Addressee a; 122 Addressee a;
124 *(a.mData) = *mData; 123 *(a.mData) = *mData;
125 return a; 124 return a;
126} 125}
127 126
128void Addressee::detach() 127void Addressee::detach()
129{ 128{
130 if ( mData.count() == 1 ) return; 129 if ( mData.count() == 1 ) return;
131 *this = copy(); 130 *this = copy();
132} 131}
133 132
134bool Addressee::operator==( const Addressee &a ) const 133bool Addressee::operator==( const Addressee &a ) const
135{ 134{
136 if ( uid() != a.uid() ) return false; 135 if ( uid() != a.uid() ) return false;
137 if ( mData->name != a.mData->name ) return false; 136 if ( mData->name != a.mData->name ) return false;
138 if ( mData->formattedName != a.mData->formattedName ) return false; 137 if ( mData->formattedName != a.mData->formattedName ) return false;
139 if ( mData->familyName != a.mData->familyName ) return false; 138 if ( mData->familyName != a.mData->familyName ) return false;
140 if ( mData->givenName != a.mData->givenName ) return false; 139 if ( mData->givenName != a.mData->givenName ) return false;
141 if ( mData->additionalName != a.mData->additionalName ) return false; 140 if ( mData->additionalName != a.mData->additionalName ) return false;
142 if ( mData->prefix != a.mData->prefix ) return false; 141 if ( mData->prefix != a.mData->prefix ) return false;
143 if ( mData->suffix != a.mData->suffix ) return false; 142 if ( mData->suffix != a.mData->suffix ) return false;
144 if ( mData->nickName != a.mData->nickName ) return false; 143 if ( mData->nickName != a.mData->nickName ) return false;
145 if ( mData->birthday != a.mData->birthday ) return false; 144 if ( mData->birthday != a.mData->birthday ) return false;
146 if ( mData->mailer != a.mData->mailer ) return false; 145 if ( mData->mailer != a.mData->mailer ) return false;
147 if ( mData->timeZone != a.mData->timeZone ) return false; 146 if ( mData->timeZone != a.mData->timeZone ) return false;
148 if ( mData->geo != a.mData->geo ) return false; 147 if ( mData->geo != a.mData->geo ) return false;
149 if ( mData->title != a.mData->title ) return false; 148 if ( mData->title != a.mData->title ) return false;
150 if ( mData->role != a.mData->role ) return false; 149 if ( mData->role != a.mData->role ) return false;
151 if ( mData->organization != a.mData->organization ) return false; 150 if ( mData->organization != a.mData->organization ) return false;
152 if ( mData->note != a.mData->note ) return false; 151 if ( mData->note != a.mData->note ) return false;
153 if ( mData->productId != a.mData->productId ) return false; 152 if ( mData->productId != a.mData->productId ) return false;
154 //if ( mData->revision != a.mData->revision ) return false; 153 //if ( mData->revision != a.mData->revision ) return false;
155 if ( mData->sortString != a.mData->sortString ) return false; 154 if ( mData->sortString != a.mData->sortString ) return false;
156 if ( mData->secrecy != a.mData->secrecy ) return false; 155 if ( mData->secrecy != a.mData->secrecy ) return false;
157 if ( mData->logo != a.mData->logo ) return false; 156 if ( mData->logo != a.mData->logo ) return false;
158 if ( mData->photo != a.mData->photo ) return false; 157 if ( mData->photo != a.mData->photo ) return false;
159 if ( mData->sound != a.mData->sound ) return false; 158 if ( mData->sound != a.mData->sound ) return false;
160 if ( mData->agent != a.mData->agent ) return false; 159 if ( mData->agent != a.mData->agent ) return false;
161 if ( ( mData->url.isValid() || a.mData->url.isValid() ) && 160 if ( ( mData->url.isValid() || a.mData->url.isValid() ) &&
162 ( mData->url != a.mData->url ) ) return false; 161 ( mData->url != a.mData->url ) ) return false;
163 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; 162 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false;
164 if ( mData->addresses != a.mData->addresses ) return false; 163 if ( mData->addresses != a.mData->addresses ) return false;
165 if ( mData->keys != a.mData->keys ) return false; 164 if ( mData->keys != a.mData->keys ) return false;
166 if ( mData->emails != a.mData->emails ) return false; 165 if ( mData->emails != a.mData->emails ) return false;
167 if ( mData->categories != a.mData->categories ) return false; 166 if ( mData->categories != a.mData->categories ) return false;
168 if ( mData->custom != a.mData->custom ) return false; 167 if ( mData->custom != a.mData->custom ) return false;
169 168
170 return true; 169 return true;
171} 170}
172 171
173bool Addressee::operator!=( const Addressee &a ) const 172bool Addressee::operator!=( const Addressee &a ) const
174{ 173{
175 return !( a == *this ); 174 return !( a == *this );
176} 175}
177 176
178bool Addressee::isEmpty() const 177bool Addressee::isEmpty() const
179{ 178{
180 return mData->empty; 179 return mData->empty;
181} 180}
182ulong Addressee::getCsum4List( const QStringList & attList) 181ulong Addressee::getCsum4List( const QStringList & attList)
183{ 182{
184 int max = attList.count(); 183 int max = attList.count();
185 ulong cSum = 0; 184 ulong cSum = 0;
186 int j,k,i; 185 int j,k,i;
187 int add; 186 int add;
188 for ( i = 0; i < max ; ++i ) { 187 for ( i = 0; i < max ; ++i ) {
189 QString s = attList[i]; 188 QString s = attList[i];
190 if ( ! s.isEmpty() ){ 189 if ( ! s.isEmpty() ){
191 j = s.length(); 190 j = s.length();
192 for ( k = 0; k < j; ++k ) { 191 for ( k = 0; k < j; ++k ) {
193 int mul = k +1; 192 int mul = k +1;
194 add = s[k].unicode (); 193 add = s[k].unicode ();
195 if ( k < 16 ) 194 if ( k < 16 )
196 mul = mul * mul; 195 mul = mul * mul;
197 int ii = i+1; 196 int ii = i+1;
198 add = add * mul *ii*ii*ii; 197 add = add * mul *ii*ii*ii;
199 cSum += add; 198 cSum += add;
200 //qDebug("csum: %d %d %d", i,k,cSum); 199 //qDebug("csum: %d %d %d", i,k,cSum);
201 } 200 }
202 } 201 }
203 202
204 } 203 }
205 //QString dump = attList.join(","); 204 //QString dump = attList.join(",");
206 //qDebug("csum: %d %s", cSum,dump.latin1()); 205 //qDebug("csum: %d %s", cSum,dump.latin1());
207 206
208 return cSum; 207 return cSum;
209 208
210} 209}
211void Addressee::computeCsum(const QString &dev) 210void Addressee::computeCsum(const QString &dev)
212{ 211{
213 QStringList l; 212 QStringList l;
214 //if ( !mData->name.isEmpty() ) l.append(mData->name); 213 //if ( !mData->name.isEmpty() ) l.append(mData->name);
215 //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); 214 //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName );
216 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); 215 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName );
217 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); 216 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName );
218 if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); 217 if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName );
219 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); 218 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix );
220 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); 219 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix );
221 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); 220 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName );
222 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); 221 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() );
223 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); 222 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer );
224 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); 223 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
225 if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); 224 if ( mData->geo.isValid() ) l.append( mData->geo.asString() );
226 if ( !mData->title .isEmpty() ) l.append( mData->title ); 225 if ( !mData->title .isEmpty() ) l.append( mData->title );
227 if ( !mData->role.isEmpty() ) l.append( mData->role ); 226 if ( !mData->role.isEmpty() ) l.append( mData->role );
228 if ( !mData->organization.isEmpty() ) l.append( mData->organization ); 227 if ( !mData->organization.isEmpty() ) l.append( mData->organization );
229 if ( !mData->note.isEmpty() ) l.append( mData->note ); 228 if ( !mData->note.isEmpty() ) l.append( mData->note );
230 if ( !mData->productId.isEmpty() ) l.append(mData->productId ); 229 if ( !mData->productId.isEmpty() ) l.append(mData->productId );
231 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); 230 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString );
232 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); 231 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString());
233 if ( !mData->logo.undefined() ) { 232 if ( !mData->logo.undefined() ) {
234 if ( !mData->logo.isIntern() ) 233 if ( !mData->logo.isIntern() )
235 l.append( mData->logo.url() ); 234 l.append( mData->logo.url() );
236 else 235 else
237 l.append( QString::number(mData->logo.data().width()* mData->logo.data().height())); 236 l.append( QString::number(mData->logo.data().width()* mData->logo.data().height()));
238 } else { 237 } else {
239 l.append( "nologo"); 238 l.append( "nologo");
240 } 239 }
241 if ( !mData->photo.undefined() ) { 240 if ( !mData->photo.undefined() ) {
242 if ( !mData->photo.isIntern() ) 241 if ( !mData->photo.isIntern() )
243 l.append( mData->photo.url() ); 242 l.append( mData->photo.url() );
244 else 243 else
245 l.append( QString::number(mData->photo.data().width()* mData->photo.data().height())); 244 l.append( QString::number(mData->photo.data().width()* mData->photo.data().height()));
246 } else { 245 } else {
247 l.append( "nophoto"); 246 l.append( "nophoto");
248 } 247 }
249#if 0 248#if 0
250 if ( !mData->sound.undefined() ) { 249 if ( !mData->sound.undefined() ) {
251 if ( !mData->sound.isIntern() ) 250 if ( !mData->sound.isIntern() )
252 l.append( mData->sound.url() ); 251 l.append( mData->sound.url() );
253 else 252 else
254 l.append( QString(mData->sound.data().with()* mData->sound.data().height())); 253 l.append( QString(mData->sound.data().with()* mData->sound.data().height()));
255 } else { 254 } else {
256 l.append( "nosound"); 255 l.append( "nosound");
257 } 256 }
258#endif 257#endif
259 //if ( !mData->agent.isEmpty() ) l.append( ); 258 //if ( !mData->agent.isEmpty() ) l.append( );
260 if ( mData->url.isValid() ) 259 if ( mData->url.isValid() )
261 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); 260 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() );
262 KABC::PhoneNumber::List phoneNumbers; 261 KABC::PhoneNumber::List phoneNumbers;
263 KABC::PhoneNumber::List::Iterator phoneIter; 262 KABC::PhoneNumber::List::Iterator phoneIter;
264 263
265 QStringList t; 264 QStringList t;
266 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 265 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
267 ++phoneIter ) 266 ++phoneIter )
268 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); 267 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) );
269 t.sort(); 268 t.sort();
270 uint iii; 269 uint iii;
271 for ( iii = 0; iii < t.count(); ++iii) 270 for ( iii = 0; iii < t.count(); ++iii)
272 l.append( t[iii] ); 271 l.append( t[iii] );
273 t = mData->emails; 272 t = mData->emails;
274 t.sort(); 273 t.sort();
275 for ( iii = 0; iii < t.count(); ++iii) 274 for ( iii = 0; iii < t.count(); ++iii)
276 l.append( t[iii] ); 275 l.append( t[iii] );
277 t = mData->categories; 276 t = mData->categories;
278 t.sort(); 277 t.sort();
279 for ( iii = 0; iii < t.count(); ++iii) 278 for ( iii = 0; iii < t.count(); ++iii)
280 l.append( t[iii] ); 279 l.append( t[iii] );
281 t = mData->custom; 280 t = mData->custom;
282 t.sort(); 281 t.sort();
283 for ( iii = 0; iii < t.count(); ++iii) 282 for ( iii = 0; iii < t.count(); ++iii)
284 if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) { 283 if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) {
285 int find = t[iii].find (':')+1; 284 int find = t[iii].find (':')+1;
286 //qDebug("lennnn %d %d ", find, t[iii].length()); 285 //qDebug("lennnn %d %d ", find, t[iii].length());
287 if ( find < t[iii].length()) 286 if ( find < t[iii].length())
288 l.append( t[iii] ); 287 l.append( t[iii] );
289 288
290 } 289 }
291 KABC::Address::List::Iterator addressIter; 290 KABC::Address::List::Iterator addressIter;
292 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 291 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
293 ++addressIter ) { 292 ++addressIter ) {
294 t = (*addressIter).asList(); 293 t = (*addressIter).asList();
295 t.sort(); 294 t.sort();
296 for ( iii = 0; iii < t.count(); ++iii) 295 for ( iii = 0; iii < t.count(); ++iii)
297 l.append( t[iii] ); 296 l.append( t[iii] );
298 } 297 }
299 uint cs = getCsum4List(l); 298 uint cs = getCsum4List(l);
300 299
301#if 0 300#if 0
302 for ( iii = 0; iii < l.count(); ++iii) 301 for ( iii = 0; iii < l.count(); ++iii)
303 qDebug("%d***%s***",iii,l[iii].latin1()); 302 qDebug("%d***%s***",iii,l[iii].latin1());
304 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); 303 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
305#endif 304#endif
306 305
307 306
308 setCsum( dev, QString::number (cs )); 307 setCsum( dev, QString::number (cs ));
309} 308}
310 309
311void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) 310void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
312{ 311{
313 // merge all standard non-outlook fields. 312 // merge all standard non-outlook fields.
314 //if isSubSet (e.g. mobile phone sync) merge all fields 313 //if isSubSet (e.g. mobile phone sync) merge all fields
315 314
316 detach(); 315 detach();
317 if ( isSubSet ) { 316 if ( isSubSet ) {
318 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 317 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
319 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 318 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
320 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 319 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
321 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 320 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
322 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 321 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
323 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; 322 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
324 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; 323 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
325 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 324 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
326 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 325 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
327 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; 326 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
328 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 327 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
329 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; 328 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
330 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; 329 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
331 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; 330 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
332 if ( !mData->birthday.isValid() ) 331 if ( !mData->birthday.isValid() )
333 if ( ad.mData->birthday.isValid()) 332 if ( ad.mData->birthday.isValid())
334 mData->birthday = ad.mData->birthday; 333 mData->birthday = ad.mData->birthday;
335 334
336 } 335 }
337 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 336 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
338 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 337 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
339 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 338 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
340 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; 339 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
341 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; 340 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
342 QStringList t; 341 QStringList t;
343 QStringList tAD; 342 QStringList tAD;
344 uint iii; 343 uint iii;
345 344
346 // ********** phone numbers 345 // ********** phone numbers
347 if ( isSubSet ) { 346 if ( isSubSet ) {
348 PhoneNumber::List phoneAD = ad.phoneNumbers(); 347 PhoneNumber::List phoneAD = ad.phoneNumbers();
349 PhoneNumber::List::Iterator phoneItAD; 348 PhoneNumber::List::Iterator phoneItAD;
350 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { 349 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
351 bool found = false; 350 bool found = false;
352 PhoneNumber::List::Iterator it; 351 PhoneNumber::List::Iterator it;
353 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 352 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
354 if ( ( *phoneItAD ).contains( (*it) ) ) { 353 if ( ( *phoneItAD ).contains( (*it) ) ) {
355 found = true; 354 found = true;
356 (*it).setType( ( *phoneItAD ).type() ); 355 (*it).setType( ( *phoneItAD ).type() );
357 (*it).setNumber( ( *phoneItAD ).number() ); 356 (*it).setNumber( ( *phoneItAD ).number() );
358 break; 357 break;
359 } 358 }
360 } 359 }
361 // if ( isSubSet && ! found ) 360 // if ( isSubSet && ! found )
362 if ( ! found ) // LR try this one... 361 if ( ! found ) // LR try this one...
363 mData->phoneNumbers.append( *phoneItAD ); 362 mData->phoneNumbers.append( *phoneItAD );
364 } 363 }
365 } else { 364 } else {
366 PhoneNumber::List phoneAD = ad.phoneNumbers(); 365 PhoneNumber::List phoneAD = ad.phoneNumbers();
367 PhoneNumber::List::Iterator phoneItAD; 366 PhoneNumber::List::Iterator phoneItAD;
368 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { 367 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
369 bool found = false; 368 bool found = false;
370 PhoneNumber::List::Iterator it; 369 PhoneNumber::List::Iterator it;
371 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 370 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
372 if ( ( *phoneItAD ).contains( (*it) ) ) { 371 if ( ( *phoneItAD ).contains( (*it) ) ) {
373 found = true; 372 found = true;
374 (*it).setType( ( *phoneItAD ).type() ); 373 (*it).setType( ( *phoneItAD ).type() );
375 (*it).setNumber( ( *phoneItAD ).number() ); 374 (*it).setNumber( ( *phoneItAD ).number() );
376 break; 375 break;
377 } 376 }
378 } 377 }
379 if ( ! found ) { // append numbers which do not have work or home type 378 if ( ! found ) { // append numbers which do not have work or home type
380 if ( ! ( ( *phoneItAD ).type() & (PhoneNumber::Work | PhoneNumber::Home) ) ) 379 if ( ! ( ( *phoneItAD ).type() & (PhoneNumber::Work | PhoneNumber::Home) ) )
381 mData->phoneNumbers.append( *phoneItAD ); 380 mData->phoneNumbers.append( *phoneItAD );
382 } 381 }
383 } 382 }
384 } 383 }
385 if ( isSubSet ) { 384 if ( isSubSet ) {
386 // ************* emails; 385 // ************* emails;
387 t = mData->emails; 386 t = mData->emails;
388 tAD = ad.mData->emails; 387 tAD = ad.mData->emails;
389 for ( iii = 0; iii < tAD.count(); ++iii) 388 for ( iii = 0; iii < tAD.count(); ++iii)
390 if ( !t.contains(tAD[iii] ) ) 389 if ( !t.contains(tAD[iii] ) )
391 mData->emails.append( tAD[iii] ); 390 mData->emails.append( tAD[iii] );
392 } 391 }
393 392
394 // ************* categories; 393 // ************* categories;
395 if ( isSubSet ) { 394 if ( isSubSet ) {
396 t = mData->categories; 395 t = mData->categories;
397 tAD = ad.mData->categories; 396 tAD = ad.mData->categories;
398 for ( iii = 0; iii < tAD.count(); ++iii) 397 for ( iii = 0; iii < tAD.count(); ++iii)
399 if ( !t.contains(tAD[iii] ) ) 398 if ( !t.contains(tAD[iii] ) )
400 mData->categories.append( tAD[iii] ); 399 mData->categories.append( tAD[iii] );
401 } 400 }
402 QStringList::ConstIterator it; 401 QStringList::ConstIterator it;
403 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { 402 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) {
404 QString qualifiedName = (*it).left( (*it).find( ":" )); 403 QString qualifiedName = (*it).left( (*it).find( ":" ));
405 bool found = false; 404 bool found = false;
406 QStringList::ConstIterator itL; 405 QStringList::ConstIterator itL;
407 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { 406 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) {
408 if ( (*itL).startsWith( qualifiedName ) ) { 407 if ( (*itL).startsWith( qualifiedName ) ) {
409 found = true; 408 found = true;
410 break; 409 break;
411 } 410 }
412 } 411 }
413 if ( ! found ) { 412 if ( ! found ) {
414 mData->custom.append( *it ); 413 mData->custom.append( *it );
415 } 414 }
416 } 415 }
417 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; 416 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo;
418 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; 417 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo;
419 if ( !mData->sound.isIntern() ) { 418 if ( !mData->sound.isIntern() ) {
420 if ( mData->sound.url().isEmpty() ) { 419 if ( mData->sound.url().isEmpty() ) {
421 mData->sound = ad.mData->sound; 420 mData->sound = ad.mData->sound;
422 } 421 }
423 } 422 }
424 if ( !mData->agent.isIntern() ) { 423 if ( !mData->agent.isIntern() ) {
425 if ( mData->agent.url().isEmpty() ) { 424 if ( mData->agent.url().isEmpty() ) {
426 mData->agent = ad.mData->agent; 425 mData->agent = ad.mData->agent;
427 } 426 }
428 } 427 }
429 { 428 {
430 Key::List::Iterator itA; 429 Key::List::Iterator itA;
431 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { 430 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) {
432 bool found = false; 431 bool found = false;
433 Key::List::Iterator it; 432 Key::List::Iterator it;
434 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 433 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
435 if ( (*it) == (*itA)) { 434 if ( (*it) == (*itA)) {
436 found = true; 435 found = true;
437 break; 436 break;
438 437
439 } 438 }
440 } 439 }
441 if ( ! found ) { 440 if ( ! found ) {
442 mData->keys.append( *itA ); 441 mData->keys.append( *itA );
443 } 442 }
444 } 443 }
445 } 444 }
446 if ( isSubSet ) { 445 if ( isSubSet ) {
447 KABC::Address::List::Iterator addressIterA; 446 KABC::Address::List::Iterator addressIterA;
448 for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { 447 for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) {
449 bool found = false; 448 bool found = false;
450 KABC::Address::List::Iterator addressIter; 449 KABC::Address::List::Iterator addressIter;
451 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 450 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
452 ++addressIter ) { 451 ++addressIter ) {
453 if ( (*addressIter) == (*addressIterA)) { 452 if ( (*addressIter) == (*addressIterA)) {
454 found = true; 453 found = true;
455 (*addressIter).setType( (*addressIterA).type() ); 454 (*addressIter).setType( (*addressIterA).type() );
456 break; 455 break;
457 } 456 }
458 457
459 } 458 }
460 if ( isSubSet && ! found ) { 459 if ( isSubSet && ! found ) {
461 mData->addresses.append( *addressIterA ); 460 mData->addresses.append( *addressIterA );
462 } 461 }
463 } 462 }
464 } 463 }
465 //qDebug("merge contact %s ", ad.uid().latin1()); 464 //qDebug("merge contact %s ", ad.uid().latin1());
466 setUid( ad.uid() ); 465 setUid( ad.uid() );
467 setRevision( ad.revision() ); 466 setRevision( ad.revision() );
468} 467}
469 468
470bool Addressee::removeVoice() 469bool Addressee::removeVoice()
471{ 470{
472 PhoneNumber::List phoneN = phoneNumbers(); 471 PhoneNumber::List phoneN = phoneNumbers();
473 PhoneNumber::List::Iterator phoneIt; 472 PhoneNumber::List::Iterator phoneIt;
474 bool found = false; 473 bool found = false;
475 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { 474 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
476 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 475 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
477 if ((*phoneIt).type() - PhoneNumber::Voice ) { 476 if ((*phoneIt).type() - PhoneNumber::Voice ) {
478 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 477 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
479 insertPhoneNumber( (*phoneIt) ); 478 insertPhoneNumber( (*phoneIt) );
480 found = true; 479 found = true;
481 } 480 }
482 } 481 }
483 482
484 } 483 }
485 return found; 484 return found;
486} 485}
487 486
488bool Addressee::containsAdr(const Addressee& ad ) 487bool Addressee::containsAdr(const Addressee& ad )
489{ 488{
490 if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; 489 if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false;
491 if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; 490 if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false;
492 if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; 491 if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ;
493 if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; 492 if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ;
494 if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; 493 if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ;
495 if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; 494 if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ;
496 if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; 495 if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ;
497 496
498 // compare phone numbers 497 // compare phone numbers
499 PhoneNumber::List phoneN = ad.phoneNumbers(); 498 PhoneNumber::List phoneN = ad.phoneNumbers();
500 PhoneNumber::List::Iterator phoneIt; 499 PhoneNumber::List::Iterator phoneIt;
501 bool found = false; 500 bool found = false;
502 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { 501 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
503 bool found = false; 502 bool found = false;
504 PhoneNumber::List phoneL = ad.phoneNumbers(); 503 PhoneNumber::List phoneL = ad.phoneNumbers();
505 PhoneNumber::List::Iterator phoneItL; 504 PhoneNumber::List::Iterator phoneItL;
506 for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { 505 for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) {
507 if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { 506 if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) {
508 found = true; 507 found = true;
509 break; 508 break;
510 } 509 }
511 } 510 }
512 if ( ! found ) 511 if ( ! found )
513 return false; 512 return false;
514 } 513 }
515 return true; 514 return true;
516 515
517} 516}
518void Addressee::simplifyAddresses() 517void Addressee::simplifyAddresses()
519{ 518{
520 519
521 520
522 Address::List list; 521 Address::List list;
523 Address::List::Iterator it; 522 Address::List::Iterator it;
524 Address::List::Iterator it2; 523 Address::List::Iterator it2;
525 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 524 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
526 it2 = it; 525 it2 = it;
527 ++it2; 526 ++it2;
528 for( ; it2 != mData->addresses.end(); ++it2 ) { 527 for( ; it2 != mData->addresses.end(); ++it2 ) {
529 if ( (*it) == (*it2) ) { 528 if ( (*it) == (*it2) ) {
530 list.append( *it ); 529 list.append( *it );
531 break; 530 break;
532 } 531 }
533 } 532 }
534 } 533 }
535 for( it = list.begin(); it != list.end(); ++it ) { 534 for( it = list.begin(); it != list.end(); ++it ) {
536 removeAddress( (*it) ); 535 removeAddress( (*it) );
537 } 536 }
538 537
539 list.clear(); 538 list.clear();
540 int max = 2; 539 int max = 2;
541 if ( mData->url.isValid() ) 540 if ( mData->url.isValid() )
542 max = 1; 541 max = 1;
543 if ( mData->addresses.count() <= max ) return ; 542 if ( mData->addresses.count() <= max ) return ;
544 int count = 0; 543 int count = 0;
545 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 544 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
546 if ( count >= max ) 545 if ( count >= max )
547 list.append( *it ); 546 list.append( *it );
548 ++count; 547 ++count;
549 } 548 }
550 for( it = list.begin(); it != list.end(); ++it ) { 549 for( it = list.begin(); it != list.end(); ++it ) {
551 removeAddress( (*it) ); 550 removeAddress( (*it) );
552 } 551 }
553} 552}
554 553
555// removes all emails but the first 554// removes all emails but the first
556// needed by phone sync 555// needed by phone sync
557void Addressee::simplifyEmails() 556void Addressee::simplifyEmails()
558{ 557{
559 if ( mData->emails.count() == 0 ) return ; 558 if ( mData->emails.count() == 0 ) return ;
560 QString email = mData->emails.first(); 559 QString email = mData->emails.first();
561 detach(); 560 detach();
562 mData->emails.clear(); 561 mData->emails.clear();
563 mData->emails.append( email ); 562 mData->emails.append( email );
564} 563}
565 564
566void Addressee::simplifyPhoneNumbers() 565void Addressee::simplifyPhoneNumbers()
567{ 566{
568 int max = 4; 567 int max = 4;
569 int inList = mData->phoneNumbers.count(); 568 int inList = mData->phoneNumbers.count();
570 KABC::PhoneNumber::List removeNumbers; 569 KABC::PhoneNumber::List removeNumbers;
571 KABC::PhoneNumber::List::Iterator phoneIter; 570 KABC::PhoneNumber::List::Iterator phoneIter;
572 if ( inList > max ) { 571 if ( inList > max ) {
573 // delete non-preferred numbers 572 // delete non-preferred numbers
574 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 573 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
575 ++phoneIter ) { 574 ++phoneIter ) {
576 if ( inList > max ) { 575 if ( inList > max ) {
577 if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { 576 if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) {
578 removeNumbers.append( ( *phoneIter ) ); 577 removeNumbers.append( ( *phoneIter ) );
579 --inList; 578 --inList;
580 } 579 }
581 } else 580 } else
582 break; 581 break;
583 } 582 }
584 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 583 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
585 ++phoneIter ) { 584 ++phoneIter ) {
586 removePhoneNumber(( *phoneIter )); 585 removePhoneNumber(( *phoneIter ));
587 } 586 }
588 // delete preferred numbers 587 // delete preferred numbers
589 if ( inList > max ) { 588 if ( inList > max ) {
590 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 589 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
591 ++phoneIter ) { 590 ++phoneIter ) {
592 if ( inList > max ) { 591 if ( inList > max ) {
593 removeNumbers.append( ( *phoneIter ) ); 592 removeNumbers.append( ( *phoneIter ) );
594 --inList; 593 --inList;
595 } else 594 } else
596 break; 595 break;
597 } 596 }
598 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 597 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
599 ++phoneIter ) { 598 ++phoneIter ) {
600 removePhoneNumber(( *phoneIter )); 599 removePhoneNumber(( *phoneIter ));
601 } 600 }
602 } 601 }
603 } 602 }
604 // remove non-numeric characters 603 // remove non-numeric characters
605 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 604 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
606 ++phoneIter ) { 605 ++phoneIter ) {
607 if ( ! ( *phoneIter ).simplifyNumber() ) 606 if ( ! ( *phoneIter ).simplifyNumber() )
608 removeNumbers.append( ( *phoneIter ) ); 607 removeNumbers.append( ( *phoneIter ) );
609 } 608 }
610 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 609 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
611 ++phoneIter ) { 610 ++phoneIter ) {
612 removePhoneNumber(( *phoneIter )); 611 removePhoneNumber(( *phoneIter ));
613 } 612 }
614} 613}
615void Addressee::simplifyPhoneNumberTypes() 614void Addressee::simplifyPhoneNumberTypes()
616{ 615{
617 KABC::PhoneNumber::List::Iterator phoneIter; 616 KABC::PhoneNumber::List::Iterator phoneIter;
618 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 617 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
619 ++phoneIter ) 618 ++phoneIter )
620 ( *phoneIter ).simplifyType(); 619 ( *phoneIter ).simplifyType();
621} 620}
622void Addressee::removeID(const QString &prof) 621void Addressee::removeID(const QString &prof)
623{ 622{
624 detach(); 623 detach();
625 if ( prof.isEmpty() ) 624 if ( prof.isEmpty() )
626 mData->mExternalId = ":"; 625 mData->mExternalId = ":";
627 else 626 else
628 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 627 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
629 628
630} 629}
631void Addressee::setID( const QString & prof , const QString & id ) 630void Addressee::setID( const QString & prof , const QString & id )
632{ 631{
633 detach(); 632 detach();
634 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 633 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
635 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 634 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
636} 635}
637void Addressee::setTempSyncStat( int id ) 636void Addressee::setTempSyncStat( int id )
638{ 637{
639 if ( mData->mTempSyncStat == id ) return; 638 if ( mData->mTempSyncStat == id ) return;
640 detach(); 639 detach();
641 mData->mTempSyncStat = id; 640 mData->mTempSyncStat = id;
642} 641}
643int Addressee::tempSyncStat() const 642int Addressee::tempSyncStat() const
644{ 643{
645 return mData->mTempSyncStat; 644 return mData->mTempSyncStat;
646} 645}
647 646
648const QString Addressee::getID( const QString & prof) const 647const QString Addressee::getID( const QString & prof) const
649{ 648{
650 return KIdManager::getId ( mData->mExternalId, prof ); 649 return KIdManager::getId ( mData->mExternalId, prof );
651} 650}
652 651
653void Addressee::setCsum( const QString & prof , const QString & id ) 652void Addressee::setCsum( const QString & prof , const QString & id )
654{ 653{
655 detach(); 654 detach();
656 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 655 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
657 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); 656 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
658 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); 657 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
659} 658}
660 659
661const QString Addressee::getCsum( const QString & prof) const 660const QString Addressee::getCsum( const QString & prof) const
662{ 661{
663 return KIdManager::getCsum ( mData->mExternalId, prof ); 662 return KIdManager::getCsum ( mData->mExternalId, prof );
664} 663}
665 664
666void Addressee::setIDStr( const QString & s ) 665void Addressee::setIDStr( const QString & s )
667{ 666{
668 detach(); 667 detach();
669 mData->mExternalId = s; 668 mData->mExternalId = s;
670} 669}
671 670
672const QString Addressee::IDStr() const 671const QString Addressee::IDStr() const
673{ 672{
674 return mData->mExternalId; 673 return mData->mExternalId;
675} 674}
676 675
677void Addressee::setExternalUID( const QString &id ) 676void Addressee::setExternalUID( const QString &id )
678{ 677{
679 if ( id == mData->externalUID ) return; 678 if ( id == mData->externalUID ) return;
680 detach(); 679 detach();
681 mData->empty = false; 680 mData->empty = false;
682 mData->externalUID = id; 681 mData->externalUID = id;
683} 682}
684 683
685const QString Addressee::externalUID() const 684const QString Addressee::externalUID() const
686{ 685{
687 return mData->externalUID; 686 return mData->externalUID;
688} 687}
689void Addressee::setOriginalExternalUID( const QString &id ) 688void Addressee::setOriginalExternalUID( const QString &id )
690{ 689{
691 if ( id == mData->originalExternalUID ) return; 690 if ( id == mData->originalExternalUID ) return;
692 detach(); 691 detach();
693 mData->empty = false; 692 mData->empty = false;
694 //qDebug("*******Set orig uid %s ", id.latin1()); 693 //qDebug("*******Set orig uid %s ", id.latin1());
695 mData->originalExternalUID = id; 694 mData->originalExternalUID = id;
696} 695}
697 696
698QString Addressee::originalExternalUID() const 697QString Addressee::originalExternalUID() const
699{ 698{
700 return mData->originalExternalUID; 699 return mData->originalExternalUID;
701} 700}
702 701
703void Addressee::setUid( const QString &id ) 702void Addressee::setUid( const QString &id )
704{ 703{
705 if ( id == mData->uid ) return; 704 if ( id == mData->uid ) return;
706 detach(); 705 detach();
707 //qDebug("****setuid %s ", id.latin1()); 706 //qDebug("****setuid %s ", id.latin1());
708 mData->empty = false; 707 mData->empty = false;
709 mData->uid = id; 708 mData->uid = id;
710} 709}
711 710
712const QString Addressee::uid() const 711const QString Addressee::uid() const
713{ 712{
714 if ( mData->uid.isEmpty() ) 713 if ( mData->uid.isEmpty() )
715 mData->uid = KApplication::randomString( 10 ); 714 mData->uid = KApplication::randomString( 10 );
716 715
717 return mData->uid; 716 return mData->uid;
718} 717}
719 718
720QString Addressee::uidLabel() 719QString Addressee::uidLabel()
721{ 720{
722 return i18n("Unique Identifier"); 721 return i18n("Unique Identifier");
723} 722}
724 723
725void Addressee::setName( const QString &name ) 724void Addressee::setName( const QString &name )
726{ 725{
727 if ( name == mData->name ) return; 726 if ( name == mData->name ) return;
728 detach(); 727 detach();
729 mData->empty = false; 728 mData->empty = false;
730 mData->name = name; 729 mData->name = name;
731} 730}
732 731
733QString Addressee::name() const 732QString Addressee::name() const
734{ 733{
735 return mData->name; 734 return mData->name;
736} 735}
737 736
738QString Addressee::nameLabel() 737QString Addressee::nameLabel()
739{ 738{
740 return i18n("Name"); 739 return i18n("Name");
741} 740}
742 741
743 742
744void Addressee::setFormattedName( const QString &formattedName ) 743void Addressee::setFormattedName( const QString &formattedName )
745{ 744{
746 if ( formattedName == mData->formattedName ) return; 745 if ( formattedName == mData->formattedName ) return;
747 detach(); 746 detach();
748 mData->empty = false; 747 mData->empty = false;
749 mData->formattedName = formattedName; 748 mData->formattedName = formattedName;
750} 749}
751void Addressee::setDefaultFormattedName( const QString &formattedName )
752{
753 if ( formattedName == mData->defaultFormattedName ) return;
754 detach();
755 mData->empty = false;
756 mData->defaultFormattedName = formattedName;
757}
758 750
759QString Addressee::formattedName() const 751QString Addressee::formattedName() const
760{ 752{
761 return mData->formattedName; 753 return mData->formattedName;
762} 754}
763QString Addressee::defaultFormattedName() const
764{
765 return mData->defaultFormattedName;
766}
767 755
768QString Addressee::formattedNameLabel() 756QString Addressee::formattedNameLabel()
769{ 757{
770 return i18n("Formatted Name"); 758 return i18n("Formatted Name");
771} 759}
772 760
773QString Addressee::defaultFormattedNameLabel()
774{
775 return i18n("Def.Formatted Name");
776}
777
778 761
779void Addressee::setFamilyName( const QString &familyName ) 762void Addressee::setFamilyName( const QString &familyName )
780{ 763{
781 if ( familyName == mData->familyName ) return; 764 if ( familyName == mData->familyName ) return;
782 detach(); 765 detach();
783 mData->empty = false; 766 mData->empty = false;
784 mData->familyName = familyName; 767 mData->familyName = familyName;
785} 768}
786 769
787QString Addressee::familyName() const 770QString Addressee::familyName() const
788{ 771{
789 return mData->familyName; 772 return mData->familyName;
790} 773}
791 774
792QString Addressee::familyNameLabel() 775QString Addressee::familyNameLabel()
793{ 776{
794 return i18n("Family Name"); 777 return i18n("Family Name");
795} 778}
796 779
797 780
798void Addressee::setGivenName( const QString &givenName ) 781void Addressee::setGivenName( const QString &givenName )
799{ 782{
800 if ( givenName == mData->givenName ) return; 783 if ( givenName == mData->givenName ) return;
801 detach(); 784 detach();
802 mData->empty = false; 785 mData->empty = false;
803 mData->givenName = givenName; 786 mData->givenName = givenName;
804} 787}
805 788
806QString Addressee::givenName() const 789QString Addressee::givenName() const
807{ 790{
808 return mData->givenName; 791 return mData->givenName;
809} 792}
810 793
811QString Addressee::givenNameLabel() 794QString Addressee::givenNameLabel()
812{ 795{
813 return i18n("Given Name"); 796 return i18n("Given Name");
814} 797}
815 798
816 799
817void Addressee::setAdditionalName( const QString &additionalName ) 800void Addressee::setAdditionalName( const QString &additionalName )
818{ 801{
819 if ( additionalName == mData->additionalName ) return; 802 if ( additionalName == mData->additionalName ) return;
820 detach(); 803 detach();
821 mData->empty = false; 804 mData->empty = false;
822 mData->additionalName = additionalName; 805 mData->additionalName = additionalName;
823} 806}
824 807
825QString Addressee::additionalName() const 808QString Addressee::additionalName() const
826{ 809{
827 return mData->additionalName; 810 return mData->additionalName;
828} 811}
829 812
830QString Addressee::additionalNameLabel() 813QString Addressee::additionalNameLabel()
831{ 814{
832 return i18n("Additional Names"); 815 return i18n("Additional Names");
833} 816}
834 817
835 818
836void Addressee::setPrefix( const QString &prefix ) 819void Addressee::setPrefix( const QString &prefix )
837{ 820{
838 if ( prefix == mData->prefix ) return; 821 if ( prefix == mData->prefix ) return;
839 detach(); 822 detach();
840 mData->empty = false; 823 mData->empty = false;
841 mData->prefix = prefix; 824 mData->prefix = prefix;
842} 825}
843 826
844QString Addressee::prefix() const 827QString Addressee::prefix() const
845{ 828{
846 return mData->prefix; 829 return mData->prefix;
847} 830}
848 831
849QString Addressee::prefixLabel() 832QString Addressee::prefixLabel()
850{ 833{
851 return i18n("Honorific Prefixes"); 834 return i18n("Honorific Prefixes");
852} 835}
853 836
854 837
855void Addressee::setSuffix( const QString &suffix ) 838void Addressee::setSuffix( const QString &suffix )
856{ 839{
857 if ( suffix == mData->suffix ) return; 840 if ( suffix == mData->suffix ) return;
858 detach(); 841 detach();
859 mData->empty = false; 842 mData->empty = false;
860 mData->suffix = suffix; 843 mData->suffix = suffix;
861} 844}
862 845
863QString Addressee::suffix() const 846QString Addressee::suffix() const
864{ 847{
865 return mData->suffix; 848 return mData->suffix;
866} 849}
867 850
868QString Addressee::suffixLabel() 851QString Addressee::suffixLabel()
869{ 852{
870 return i18n("Honorific Suffixes"); 853 return i18n("Honorific Suffixes");
871} 854}
872 855
873 856
874void Addressee::setNickName( const QString &nickName ) 857void Addressee::setNickName( const QString &nickName )
875{ 858{
876 if ( nickName == mData->nickName ) return; 859 if ( nickName == mData->nickName ) return;
877 detach(); 860 detach();
878 mData->empty = false; 861 mData->empty = false;
879 mData->nickName = nickName; 862 mData->nickName = nickName;
880} 863}
881 864
882QString Addressee::nickName() const 865QString Addressee::nickName() const
883{ 866{
884 return mData->nickName; 867 return mData->nickName;
885} 868}
886 869
887QString Addressee::nickNameLabel() 870QString Addressee::nickNameLabel()
888{ 871{
889 return i18n("Nick Name"); 872 return i18n("Nick Name");
890} 873}
891 874
892 875
893void Addressee::setBirthday( const QDateTime &birthday ) 876void Addressee::setBirthday( const QDateTime &birthday )
894{ 877{
895 if ( birthday == mData->birthday ) return; 878 if ( birthday == mData->birthday ) return;
896 detach(); 879 detach();
897 mData->empty = false; 880 mData->empty = false;
898 mData->birthday = birthday; 881 mData->birthday = birthday;
899} 882}
900 883
901QDateTime Addressee::birthday() const 884QDateTime Addressee::birthday() const
902{ 885{
903 return mData->birthday; 886 return mData->birthday;
904} 887}
905 888
906QString Addressee::birthdayLabel() 889QString Addressee::birthdayLabel()
907{ 890{
908 return i18n("Birthday"); 891 return i18n("Birthday");
909} 892}
910 893
911 894
912QString Addressee::homeAddressStreetLabel() 895QString Addressee::homeAddressStreetLabel()
913{ 896{
914 return i18n("Home Address Street"); 897 return i18n("Home Address Street");
915} 898}
916 899
917 900
918QString Addressee::homeAddressLocalityLabel() 901QString Addressee::homeAddressLocalityLabel()
919{ 902{
920 return i18n("Home Address Locality"); 903 return i18n("Home Address Locality");
921} 904}
922 905
923 906
924QString Addressee::homeAddressRegionLabel() 907QString Addressee::homeAddressRegionLabel()
925{ 908{
926 return i18n("Home Address Region"); 909 return i18n("Home Address Region");
927} 910}
928 911
929 912
930QString Addressee::homeAddressPostalCodeLabel() 913QString Addressee::homeAddressPostalCodeLabel()
931{ 914{
932 return i18n("Home Address Postal Code"); 915 return i18n("Home Address Postal Code");
933} 916}
934 917
935 918
936QString Addressee::homeAddressCountryLabel() 919QString Addressee::homeAddressCountryLabel()
937{ 920{
938 return i18n("Home Address Country"); 921 return i18n("Home Address Country");
939} 922}
940 923
941 924
942QString Addressee::homeAddressLabelLabel() 925QString Addressee::homeAddressLabelLabel()
943{ 926{
944 return i18n("Home Address Label"); 927 return i18n("Home Address Label");
945} 928}
946 929
947 930
948QString Addressee::businessAddressStreetLabel() 931QString Addressee::businessAddressStreetLabel()
949{ 932{
950 return i18n("Business Address Street"); 933 return i18n("Business Address Street");
951} 934}
952 935
953 936
954QString Addressee::businessAddressLocalityLabel() 937QString Addressee::businessAddressLocalityLabel()
955{ 938{
956 return i18n("Business Address Locality"); 939 return i18n("Business Address Locality");
957} 940}
958 941
959 942
960QString Addressee::businessAddressRegionLabel() 943QString Addressee::businessAddressRegionLabel()
961{ 944{
962 return i18n("Business Address Region"); 945 return i18n("Business Address Region");
963} 946}
964 947
965 948
966QString Addressee::businessAddressPostalCodeLabel() 949QString Addressee::businessAddressPostalCodeLabel()
967{ 950{
968 return i18n("Business Address Postal Code"); 951 return i18n("Business Address Postal Code");
969} 952}
970 953
971 954
972QString Addressee::businessAddressCountryLabel() 955QString Addressee::businessAddressCountryLabel()
973{ 956{
974 return i18n("Business Address Country"); 957 return i18n("Business Address Country");
975} 958}
976 959
977 960
978QString Addressee::businessAddressLabelLabel() 961QString Addressee::businessAddressLabelLabel()
979{ 962{
980 return i18n("Business Address Label"); 963 return i18n("Business Address Label");
981} 964}
982 965
983 966
984QString Addressee::homePhoneLabel() 967QString Addressee::homePhoneLabel()
985{ 968{
986 return i18n("Home Phone"); 969 return i18n("Home Phone");
987} 970}
988 971
989 972
990QString Addressee::businessPhoneLabel() 973QString Addressee::businessPhoneLabel()
991{ 974{
992 return i18n("Business Phone"); 975 return i18n("Business Phone");
993} 976}
994 977
995 978
996QString Addressee::mobilePhoneLabel() 979QString Addressee::mobilePhoneLabel()
997{ 980{
998 return i18n("Mobile Phone"); 981 return i18n("Mobile Phone");
999} 982}
1000QString Addressee::mobileWorkPhoneLabel() 983QString Addressee::mobileWorkPhoneLabel()
1001{ 984{
1002 return i18n("Mobile (work)"); 985 return i18n("Mobile (work)");
1003} 986}
1004QString Addressee::mobileHomePhoneLabel() 987QString Addressee::mobileHomePhoneLabel()
1005{ 988{
1006 return i18n("Mobile (home)"); 989 return i18n("Mobile (home)");
1007} 990}
1008 991
1009 992
1010QString Addressee::homeFaxLabel() 993QString Addressee::homeFaxLabel()
1011{ 994{
1012 return i18n("Home Fax"); 995 return i18n("Home Fax");
1013} 996}
1014 997
1015 998
1016QString Addressee::businessFaxLabel() 999QString Addressee::businessFaxLabel()
1017{ 1000{
1018 return i18n("Business Fax"); 1001 return i18n("Business Fax");
1019} 1002}
1020 1003
1021 1004
1022QString Addressee::carPhoneLabel() 1005QString Addressee::carPhoneLabel()
1023{ 1006{
1024 return i18n("Car Phone"); 1007 return i18n("Car Phone");
1025} 1008}
1026 1009
1027 1010
1028QString Addressee::isdnLabel() 1011QString Addressee::isdnLabel()
1029{ 1012{
1030 return i18n("ISDN"); 1013 return i18n("ISDN");
1031} 1014}
1032 1015
1033 1016
1034QString Addressee::pagerLabel() 1017QString Addressee::pagerLabel()
1035{ 1018{
1036 return i18n("Pager"); 1019 return i18n("Pager");
1037} 1020}
1038 1021
1039QString Addressee::sipLabel() 1022QString Addressee::sipLabel()
1040{ 1023{
1041 return i18n("SIP"); 1024 return i18n("SIP");
1042} 1025}
1043 1026
1044QString Addressee::emailLabel() 1027QString Addressee::emailLabel()
1045{ 1028{
1046 return i18n("Email Address"); 1029 return i18n("Email Address");
1047} 1030}
1048 1031
1049 1032
1050void Addressee::setMailer( const QString &mailer ) 1033void Addressee::setMailer( const QString &mailer )
1051{ 1034{
1052 if ( mailer == mData->mailer ) return; 1035 if ( mailer == mData->mailer ) return;
1053 detach(); 1036 detach();
1054 mData->empty = false; 1037 mData->empty = false;
1055 mData->mailer = mailer; 1038 mData->mailer = mailer;
1056} 1039}
1057 1040
1058QString Addressee::mailer() const 1041QString Addressee::mailer() const
1059{ 1042{
1060 return mData->mailer; 1043 return mData->mailer;
1061} 1044}
1062 1045
1063QString Addressee::mailerLabel() 1046QString Addressee::mailerLabel()
1064{ 1047{
1065 return i18n("Mail Client"); 1048 return i18n("Mail Client");
1066} 1049}
1067 1050
1068 1051
1069void Addressee::setTimeZone( const TimeZone &timeZone ) 1052void Addressee::setTimeZone( const TimeZone &timeZone )
1070{ 1053{
1071 if ( timeZone == mData->timeZone ) return; 1054 if ( timeZone == mData->timeZone ) return;
1072 detach(); 1055 detach();
1073 mData->empty = false; 1056 mData->empty = false;
1074 mData->timeZone = timeZone; 1057 mData->timeZone = timeZone;
1075} 1058}
1076 1059
1077TimeZone Addressee::timeZone() const 1060TimeZone Addressee::timeZone() const
1078{ 1061{
1079 return mData->timeZone; 1062 return mData->timeZone;
1080} 1063}
1081 1064
1082QString Addressee::timeZoneLabel() 1065QString Addressee::timeZoneLabel()
1083{ 1066{
1084 return i18n("Time Zone"); 1067 return i18n("Time Zone");
1085} 1068}
1086 1069
1087 1070
1088void Addressee::setGeo( const Geo &geo ) 1071void Addressee::setGeo( const Geo &geo )
1089{ 1072{
1090 if ( geo == mData->geo ) return; 1073 if ( geo == mData->geo ) return;
1091 detach(); 1074 detach();
1092 mData->empty = false; 1075 mData->empty = false;
1093 mData->geo = geo; 1076 mData->geo = geo;
1094} 1077}
1095 1078
1096Geo Addressee::geo() const 1079Geo Addressee::geo() const
1097{ 1080{
1098 return mData->geo; 1081 return mData->geo;
1099} 1082}
1100 1083
1101QString Addressee::geoLabel() 1084QString Addressee::geoLabel()
1102{ 1085{
1103 return i18n("Geographic Position"); 1086 return i18n("Geographic Position");
1104} 1087}
1105 1088
1106 1089
1107void Addressee::setTitle( const QString &title ) 1090void Addressee::setTitle( const QString &title )
1108{ 1091{
1109 if ( title == mData->title ) return; 1092 if ( title == mData->title ) return;
1110 detach(); 1093 detach();
1111 mData->empty = false; 1094 mData->empty = false;
1112 mData->title = title; 1095 mData->title = title;
1113} 1096}
1114 1097
1115QString Addressee::title() const 1098QString Addressee::title() const
1116{ 1099{
1117 return mData->title; 1100 return mData->title;
1118} 1101}
1119 1102
1120QString Addressee::titleLabel() 1103QString Addressee::titleLabel()
1121{ 1104{
1122 return i18n("Title"); 1105 return i18n("Title");
1123} 1106}
1124 1107
1125 1108
1126void Addressee::setRole( const QString &role ) 1109void Addressee::setRole( const QString &role )
1127{ 1110{
1128 if ( role == mData->role ) return; 1111 if ( role == mData->role ) return;
1129 detach(); 1112 detach();
1130 mData->empty = false; 1113 mData->empty = false;
1131 mData->role = role; 1114 mData->role = role;
1132} 1115}
1133 1116
1134QString Addressee::role() const 1117QString Addressee::role() const
1135{ 1118{
1136 return mData->role; 1119 return mData->role;
1137} 1120}
1138 1121
1139QString Addressee::roleLabel() 1122QString Addressee::roleLabel()
1140{ 1123{
1141 return i18n("Role"); 1124 return i18n("Role");
1142} 1125}
1143 1126
1144 1127
1145void Addressee::setOrganization( const QString &organization ) 1128void Addressee::setOrganization( const QString &organization )
1146{ 1129{
1147 if ( organization == mData->organization ) return; 1130 if ( organization == mData->organization ) return;
1148 detach(); 1131 detach();
1149 mData->empty = false; 1132 mData->empty = false;
1150 mData->organization = organization; 1133 mData->organization = organization;
1151} 1134}
1152 1135
1153QString Addressee::organization() const 1136QString Addressee::organization() const
1154{ 1137{
1155 return mData->organization; 1138 return mData->organization;
1156} 1139}
1157 1140
1158QString Addressee::organizationLabel() 1141QString Addressee::organizationLabel()
1159{ 1142{
1160 return i18n("Organization"); 1143 return i18n("Organization");
1161} 1144}
1162 1145
1163 1146
1164void Addressee::setNote( const QString &note ) 1147void Addressee::setNote( const QString &note )
1165{ 1148{
1166 if ( note == mData->note ) return; 1149 if ( note == mData->note ) return;
1167 detach(); 1150 detach();
1168 mData->empty = false; 1151 mData->empty = false;
1169 mData->note = note; 1152 mData->note = note;
1170} 1153}
1171 1154
1172QString Addressee::note() const 1155QString Addressee::note() const
1173{ 1156{
1174 return mData->note; 1157 return mData->note;
1175} 1158}
1176 1159
1177QString Addressee::noteLabel() 1160QString Addressee::noteLabel()
1178{ 1161{
1179 return i18n("Note"); 1162 return i18n("Note");
1180} 1163}
1181 1164
1182 1165
1183void Addressee::setProductId( const QString &productId ) 1166void Addressee::setProductId( const QString &productId )
1184{ 1167{
1185 if ( productId == mData->productId ) return; 1168 if ( productId == mData->productId ) return;
1186 detach(); 1169 detach();
1187 mData->empty = false; 1170 mData->empty = false;
1188 mData->productId = productId; 1171 mData->productId = productId;
1189} 1172}
1190 1173
1191QString Addressee::productId() const 1174QString Addressee::productId() const
1192{ 1175{
1193 return mData->productId; 1176 return mData->productId;
1194} 1177}
1195 1178
1196QString Addressee::productIdLabel() 1179QString Addressee::productIdLabel()
1197{ 1180{
1198 return i18n("Product Identifier"); 1181 return i18n("Product Identifier");
1199} 1182}
1200 1183
1201 1184
1202void Addressee::setRevision( const QDateTime &revision ) 1185void Addressee::setRevision( const QDateTime &revision )
1203{ 1186{
1204 if ( revision == mData->revision ) return; 1187 if ( revision == mData->revision ) return;
1205 detach(); 1188 detach();
1206 mData->empty = false; 1189 mData->empty = false;
1207 mData->revision = QDateTime( revision.date(), 1190 mData->revision = QDateTime( revision.date(),
1208 QTime (revision.time().hour(), 1191 QTime (revision.time().hour(),
1209 revision.time().minute(), 1192 revision.time().minute(),
1210 revision.time().second())); 1193 revision.time().second()));
1211} 1194}
1212 1195
1213QDateTime Addressee::revision() const 1196QDateTime Addressee::revision() const
1214{ 1197{
1215 return mData->revision; 1198 return mData->revision;
1216} 1199}
1217 1200
1218QString Addressee::revisionLabel() 1201QString Addressee::revisionLabel()
1219{ 1202{
1220 return i18n("Revision Date"); 1203 return i18n("Revision Date");
1221} 1204}
1222 1205
1223 1206
1224void Addressee::setSortString( const QString &sortString ) 1207void Addressee::setSortString( const QString &sortString )
1225{ 1208{
1226 if ( sortString == mData->sortString ) return; 1209 if ( sortString == mData->sortString ) return;
1227 detach(); 1210 detach();
1228 mData->empty = false; 1211 mData->empty = false;
1229 mData->sortString = sortString; 1212 mData->sortString = sortString;
1230} 1213}
1231 1214
1232QString Addressee::sortString() const 1215QString Addressee::sortString() const
1233{ 1216{
1234 return mData->sortString; 1217 return mData->sortString;
1235} 1218}
1236 1219
1237QString Addressee::sortStringLabel() 1220QString Addressee::sortStringLabel()
1238{ 1221{
1239 return i18n("Sort String"); 1222 return i18n("Sort String");
1240} 1223}
1241 1224
1242 1225
1243void Addressee::setUrl( const KURL &url ) 1226void Addressee::setUrl( const KURL &url )
1244{ 1227{
1245 if ( url == mData->url ) return; 1228 if ( url == mData->url ) return;
1246 detach(); 1229 detach();
1247 mData->empty = false; 1230 mData->empty = false;
1248 mData->url = url; 1231 mData->url = url;
1249} 1232}
1250 1233
1251KURL Addressee::url() const 1234KURL Addressee::url() const
1252{ 1235{
1253 return mData->url; 1236 return mData->url;
1254} 1237}
1255 1238
1256QString Addressee::urlLabel() 1239QString Addressee::urlLabel()
1257{ 1240{
1258 return i18n("URL"); 1241 return i18n("URL");
1259} 1242}
1260 1243
1261 1244
1262void Addressee::setSecrecy( const Secrecy &secrecy ) 1245void Addressee::setSecrecy( const Secrecy &secrecy )
1263{ 1246{
1264 if ( secrecy == mData->secrecy ) return; 1247 if ( secrecy == mData->secrecy ) return;
1265 detach(); 1248 detach();
1266 mData->empty = false; 1249 mData->empty = false;
1267 mData->secrecy = secrecy; 1250 mData->secrecy = secrecy;
1268} 1251}
1269 1252
1270Secrecy Addressee::secrecy() const 1253Secrecy Addressee::secrecy() const
1271{ 1254{
1272 return mData->secrecy; 1255 return mData->secrecy;
1273} 1256}
1274 1257
1275QString Addressee::secrecyLabel() 1258QString Addressee::secrecyLabel()
1276{ 1259{
1277 return i18n("Security Class"); 1260 return i18n("Security Class");
1278} 1261}
1279 1262
1280 1263
1281void Addressee::setLogo( const Picture &logo ) 1264void Addressee::setLogo( const Picture &logo )
1282{ 1265{
1283 if ( logo == mData->logo ) return; 1266 if ( logo == mData->logo ) return;
1284 detach(); 1267 detach();
1285 mData->empty = false; 1268 mData->empty = false;
1286 mData->logo = logo; 1269 mData->logo = logo;
1287} 1270}
1288 1271
1289Picture Addressee::logo() const 1272Picture Addressee::logo() const
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 0d688f8..a2fbcf5 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -1,679 +1,676 @@
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#ifndef KABC_ADDRESSEE_H 29#ifndef KABC_ADDRESSEE_H
30#define KABC_ADDRESSEE_H 30#define KABC_ADDRESSEE_H
31 31
32#include <qdatetime.h> 32#include <qdatetime.h>
33#include <qstring.h> 33#include <qstring.h>
34#include <qstringlist.h> 34#include <qstringlist.h>
35#include <qvaluelist.h> 35#include <qvaluelist.h>
36 36
37#include <ksharedptr.h> 37#include <ksharedptr.h>
38#include <kurl.h> 38#include <kurl.h>
39 39
40#include "address.h" 40#include "address.h"
41#include "agent.h" 41#include "agent.h"
42#include "geo.h" 42#include "geo.h"
43#include "key.h" 43#include "key.h"
44#include "phonenumber.h" 44#include "phonenumber.h"
45#include "picture.h" 45#include "picture.h"
46#include "secrecy.h" 46#include "secrecy.h"
47#include "sound.h" 47#include "sound.h"
48#include "timezone.h" 48#include "timezone.h"
49 49
50namespace KABC { 50namespace KABC {
51 51
52class Resource; 52class Resource;
53 53
54/** 54/**
55 @short address book entry 55 @short address book entry
56 56
57 This class represents an entry in the address book. 57 This class represents an entry in the address book.
58 58
59 The data of this class is implicitly shared. You can pass this class by value. 59 The data of this class is implicitly shared. You can pass this class by value.
60 60
61 If you need the name of a field for presenting it to the user you should use 61 If you need the name of a field for presenting it to the user you should use
62 the functions ending in Label(). They return a translated string which can be 62 the functions ending in Label(). They return a translated string which can be
63 used as label for the corresponding field. 63 used as label for the corresponding field.
64 64
65 About the name fields: 65 About the name fields:
66 66
67 givenName() is the first name and familyName() the last name. In some 67 givenName() is the first name and familyName() the last name. In some
68 countries the family name comes first, that's the reason for the 68 countries the family name comes first, that's the reason for the
69 naming. formattedName() is the full name with the correct formatting. 69 naming. formattedName() is the full name with the correct formatting.
70 It is used as an override, when the correct formatting can't be generated 70 It is used as an override, when the correct formatting can't be generated
71 from the other name fields automatically. 71 from the other name fields automatically.
72 72
73 realName() returns a fully formatted name(). It uses formattedName, if set, 73 realName() returns a fully formatted name(). It uses formattedName, if set,
74 otherwise it constucts the name from the name fields. As fallback, if 74 otherwise it constucts the name from the name fields. As fallback, if
75 nothing else is set it uses name(). 75 nothing else is set it uses name().
76 76
77 name() is the NAME type of RFC2426. It can be used as internal name for the 77 name() is the NAME type of RFC2426. It can be used as internal name for the
78 data enty, but shouldn't be used for displaying the data to the user. 78 data enty, but shouldn't be used for displaying the data to the user.
79 */ 79 */
80class Addressee 80class Addressee
81{ 81{
82 friend QDataStream &operator<<( QDataStream &, const Addressee & ); 82 friend QDataStream &operator<<( QDataStream &, const Addressee & );
83 friend QDataStream &operator>>( QDataStream &, Addressee & ); 83 friend QDataStream &operator>>( QDataStream &, Addressee & );
84 84
85 public: 85 public:
86 typedef QValueList<Addressee> List; 86 typedef QValueList<Addressee> List;
87 87
88 /** 88 /**
89 Construct an empty address book entry. 89 Construct an empty address book entry.
90 */ 90 */
91 Addressee(); 91 Addressee();
92 ~Addressee(); 92 ~Addressee();
93 93
94 Addressee( const Addressee & ); 94 Addressee( const Addressee & );
95 Addressee &operator=( const Addressee & ); 95 Addressee &operator=( const Addressee & );
96 96
97 bool operator==( const Addressee & ) const; 97 bool operator==( const Addressee & ) const;
98 bool operator!=( const Addressee & ) const; 98 bool operator!=( const Addressee & ) const;
99 // sync stuff 99 // sync stuff
100 void setTempSyncStat(int id); 100 void setTempSyncStat(int id);
101 int tempSyncStat() const; 101 int tempSyncStat() const;
102 void setIDStr( const QString & ); 102 void setIDStr( const QString & );
103 const QString IDStr() const; 103 const QString IDStr() const;
104 void setID( const QString &, const QString & ); 104 void setID( const QString &, const QString & );
105 const QString getID( const QString & ) const; 105 const QString getID( const QString & ) const;
106 void setCsum( const QString &, const QString & ); 106 void setCsum( const QString &, const QString & );
107 const QString getCsum( const QString & ) const ; 107 const QString getCsum( const QString & ) const ;
108 void removeID(const QString &); 108 void removeID(const QString &);
109 void computeCsum(const QString &dev); 109 void computeCsum(const QString &dev);
110 ulong getCsum4List( const QStringList & attList); 110 ulong getCsum4List( const QStringList & attList);
111 /** 111 /**
112 Return, if the address book entry is empty. 112 Return, if the address book entry is empty.
113 */ 113 */
114 bool isEmpty() const; 114 bool isEmpty() const;
115 void setExternalUID( const QString &id ); 115 void setExternalUID( const QString &id );
116 const QString externalUID() const; 116 const QString externalUID() const;
117 void setOriginalExternalUID( const QString &id ); 117 void setOriginalExternalUID( const QString &id );
118 QString originalExternalUID() const; 118 QString originalExternalUID() const;
119 void mergeContact( const Addressee& ad, bool isSubSet ); 119 void mergeContact( const Addressee& ad, bool isSubSet );
120 void simplifyEmails(); 120 void simplifyEmails();
121 void simplifyAddresses(); 121 void simplifyAddresses();
122 void simplifyPhoneNumbers(); 122 void simplifyPhoneNumbers();
123 void simplifyPhoneNumberTypes(); 123 void simplifyPhoneNumberTypes();
124 bool removeVoice(); 124 bool removeVoice();
125 bool containsAdr(const Addressee& addr ); 125 bool containsAdr(const Addressee& addr );
126 126
127 /** 127 /**
128 Set unique identifier. 128 Set unique identifier.
129 */ 129 */
130 void setUid( const QString &uid ); 130 void setUid( const QString &uid );
131 /** 131 /**
132 Return unique identifier. 132 Return unique identifier.
133 */ 133 */
134 const QString uid() const; 134 const QString uid() const;
135 /** 135 /**
136 Return translated label for uid field. 136 Return translated label for uid field.
137 */ 137 */
138 static QString uidLabel(); 138 static QString uidLabel();
139 139
140 /** 140 /**
141 Set name. 141 Set name.
142 */ 142 */
143 void setName( const QString &name ); 143 void setName( const QString &name );
144 /** 144 /**
145 Return name. 145 Return name.
146 */ 146 */
147 QString name() const; 147 QString name() const;
148 /** 148 /**
149 Return translated label for name field. 149 Return translated label for name field.
150 */ 150 */
151 static QString nameLabel(); 151 static QString nameLabel();
152 152
153 /** 153 /**
154 Set formatted name. 154 Set formatted name.
155 */ 155 */
156 void setFormattedName( const QString &formattedName ); 156 void setFormattedName( const QString &formattedName );
157 void setDefaultFormattedName( const QString &formattedName );
158 /** 157 /**
159 Return formatted name. 158 Return formatted name.
160 */ 159 */
161 QString formattedName() const; 160 QString formattedName() const;
162 QString defaultFormattedName() const;
163 /** 161 /**
164 Return translated label for formattedName field. 162 Return translated label for formattedName field.
165 */ 163 */
166 static QString formattedNameLabel(); 164 static QString formattedNameLabel();
167 static QString defaultFormattedNameLabel();
168 165
169 /** 166 /**
170 Set family name. 167 Set family name.
171 */ 168 */
172 void setFamilyName( const QString &familyName ); 169 void setFamilyName( const QString &familyName );
173 /** 170 /**
174 Return family name. 171 Return family name.
175 */ 172 */
176 QString familyName() const; 173 QString familyName() const;
177 /** 174 /**
178 Return translated label for familyName field. 175 Return translated label for familyName field.
179 */ 176 */
180 static QString familyNameLabel(); 177 static QString familyNameLabel();
181 178
182 /** 179 /**
183 Set given name. 180 Set given name.
184 */ 181 */
185 void setGivenName( const QString &givenName ); 182 void setGivenName( const QString &givenName );
186 /** 183 /**
187 Return given name. 184 Return given name.
188 */ 185 */
189 QString givenName() const; 186 QString givenName() const;
190 /** 187 /**
191 Return translated label for givenName field. 188 Return translated label for givenName field.
192 */ 189 */
193 static QString givenNameLabel(); 190 static QString givenNameLabel();
194 191
195 /** 192 /**
196 Set additional names. 193 Set additional names.
197 */ 194 */
198 void setAdditionalName( const QString &additionalName ); 195 void setAdditionalName( const QString &additionalName );
199 /** 196 /**
200 Return additional names. 197 Return additional names.
201 */ 198 */
202 QString additionalName() const; 199 QString additionalName() const;
203 /** 200 /**
204 Return translated label for additionalName field. 201 Return translated label for additionalName field.
205 */ 202 */
206 static QString additionalNameLabel(); 203 static QString additionalNameLabel();
207 204
208 /** 205 /**
209 Set honorific prefixes. 206 Set honorific prefixes.
210 */ 207 */
211 void setPrefix( const QString &prefix ); 208 void setPrefix( const QString &prefix );
212 /** 209 /**
213 Return honorific prefixes. 210 Return honorific prefixes.
214 */ 211 */
215 QString prefix() const; 212 QString prefix() const;
216 /** 213 /**
217 Return translated label for prefix field. 214 Return translated label for prefix field.
218 */ 215 */
219 static QString prefixLabel(); 216 static QString prefixLabel();
220 217
221 /** 218 /**
222 Set honorific suffixes. 219 Set honorific suffixes.
223 */ 220 */
224 void setSuffix( const QString &suffix ); 221 void setSuffix( const QString &suffix );
225 /** 222 /**
226 Return honorific suffixes. 223 Return honorific suffixes.
227 */ 224 */
228 QString suffix() const; 225 QString suffix() const;
229 /** 226 /**
230 Return translated label for suffix field. 227 Return translated label for suffix field.
231 */ 228 */
232 static QString suffixLabel(); 229 static QString suffixLabel();
233 230
234 /** 231 /**
235 Set nick name. 232 Set nick name.
236 */ 233 */
237 void setNickName( const QString &nickName ); 234 void setNickName( const QString &nickName );
238 /** 235 /**
239 Return nick name. 236 Return nick name.
240 */ 237 */
241 QString nickName() const; 238 QString nickName() const;
242 /** 239 /**
243 Return translated label for nickName field. 240 Return translated label for nickName field.
244 */ 241 */
245 static QString nickNameLabel(); 242 static QString nickNameLabel();
246 243
247 /** 244 /**
248 Set birthday. 245 Set birthday.
249 */ 246 */
250 void setBirthday( const QDateTime &birthday ); 247 void setBirthday( const QDateTime &birthday );
251 /** 248 /**
252 Return birthday. 249 Return birthday.
253 */ 250 */
254 QDateTime birthday() const; 251 QDateTime birthday() const;
255 /** 252 /**
256 Return translated label for birthday field. 253 Return translated label for birthday field.
257 */ 254 */
258 static QString birthdayLabel(); 255 static QString birthdayLabel();
259 256
260 /** 257 /**
261 Return translated label for homeAddressStreet field. 258 Return translated label for homeAddressStreet field.
262 */ 259 */
263 static QString homeAddressStreetLabel(); 260 static QString homeAddressStreetLabel();
264 261
265 /** 262 /**
266 Return translated label for homeAddressLocality field. 263 Return translated label for homeAddressLocality field.
267 */ 264 */
268 static QString homeAddressLocalityLabel(); 265 static QString homeAddressLocalityLabel();
269 266
270 /** 267 /**
271 Return translated label for homeAddressRegion field. 268 Return translated label for homeAddressRegion field.
272 */ 269 */
273 static QString homeAddressRegionLabel(); 270 static QString homeAddressRegionLabel();
274 271
275 /** 272 /**
276 Return translated label for homeAddressPostalCode field. 273 Return translated label for homeAddressPostalCode field.
277 */ 274 */
278 static QString homeAddressPostalCodeLabel(); 275 static QString homeAddressPostalCodeLabel();
279 276
280 /** 277 /**
281 Return translated label for homeAddressCountry field. 278 Return translated label for homeAddressCountry field.
282 */ 279 */
283 static QString homeAddressCountryLabel(); 280 static QString homeAddressCountryLabel();
284 281
285 /** 282 /**
286 Return translated label for homeAddressLabel field. 283 Return translated label for homeAddressLabel field.
287 */ 284 */
288 static QString homeAddressLabelLabel(); 285 static QString homeAddressLabelLabel();
289 286
290 /** 287 /**
291 Return translated label for businessAddressStreet field. 288 Return translated label for businessAddressStreet field.
292 */ 289 */
293 static QString businessAddressStreetLabel(); 290 static QString businessAddressStreetLabel();
294 291
295 /** 292 /**
296 Return translated label for businessAddressLocality field. 293 Return translated label for businessAddressLocality field.
297 */ 294 */
298 static QString businessAddressLocalityLabel(); 295 static QString businessAddressLocalityLabel();
299 296
300 /** 297 /**
301 Return translated label for businessAddressRegion field. 298 Return translated label for businessAddressRegion field.
302 */ 299 */
303 static QString businessAddressRegionLabel(); 300 static QString businessAddressRegionLabel();
304 301
305 /** 302 /**
306 Return translated label for businessAddressPostalCode field. 303 Return translated label for businessAddressPostalCode field.
307 */ 304 */
308 static QString businessAddressPostalCodeLabel(); 305 static QString businessAddressPostalCodeLabel();
309 306
310 /** 307 /**
311 Return translated label for businessAddressCountry field. 308 Return translated label for businessAddressCountry field.
312 */ 309 */
313 static QString businessAddressCountryLabel(); 310 static QString businessAddressCountryLabel();
314 311
315 /** 312 /**
316 Return translated label for businessAddressLabel field. 313 Return translated label for businessAddressLabel field.
317 */ 314 */
318 static QString businessAddressLabelLabel(); 315 static QString businessAddressLabelLabel();
319 316
320 /** 317 /**
321 Return translated label for homePhone field. 318 Return translated label for homePhone field.
322 */ 319 */
323 static QString homePhoneLabel(); 320 static QString homePhoneLabel();
324 321
325 /** 322 /**
326 Return translated label for businessPhone field. 323 Return translated label for businessPhone field.
327 */ 324 */
328 static QString businessPhoneLabel(); 325 static QString businessPhoneLabel();
329 326
330 /** 327 /**
331 Return translated label for mobilePhone field. 328 Return translated label for mobilePhone field.
332 */ 329 */
333 static QString mobilePhoneLabel(); 330 static QString mobilePhoneLabel();
334 static QString mobileWorkPhoneLabel(); 331 static QString mobileWorkPhoneLabel();
335 static QString mobileHomePhoneLabel(); 332 static QString mobileHomePhoneLabel();
336 333
337 /** 334 /**
338 Return translated label for homeFax field. 335 Return translated label for homeFax field.
339 */ 336 */
340 static QString homeFaxLabel(); 337 static QString homeFaxLabel();
341 338
342 /** 339 /**
343 Return translated label for businessFax field. 340 Return translated label for businessFax field.
344 */ 341 */
345 static QString businessFaxLabel(); 342 static QString businessFaxLabel();
346 343
347 /** 344 /**
348 Return translated label for carPhone field. 345 Return translated label for carPhone field.
349 */ 346 */
350 static QString carPhoneLabel(); 347 static QString carPhoneLabel();
351 348
352 /** 349 /**
353 Return translated label for isdn field. 350 Return translated label for isdn field.
354 */ 351 */
355 static QString isdnLabel(); 352 static QString isdnLabel();
356 353
357 /** 354 /**
358 Return translated label for pager field. 355 Return translated label for pager field.
359 */ 356 */
360 static QString pagerLabel(); 357 static QString pagerLabel();
361 358
362 /** 359 /**
363 Return translated label for sip field. 360 Return translated label for sip field.
364 */ 361 */
365 static QString sipLabel(); 362 static QString sipLabel();
366 363
367 /** 364 /**
368 Return translated label for email field. 365 Return translated label for email field.
369 */ 366 */
370 static QString emailLabel(); 367 static QString emailLabel();
371 368
372 /** 369 /**
373 Set mail client. 370 Set mail client.
374 */ 371 */
375 void setMailer( const QString &mailer ); 372 void setMailer( const QString &mailer );
376 /** 373 /**
377 Return mail client. 374 Return mail client.
378 */ 375 */
379 QString mailer() const; 376 QString mailer() const;
380 /** 377 /**
381 Return translated label for mailer field. 378 Return translated label for mailer field.
382 */ 379 */
383 static QString mailerLabel(); 380 static QString mailerLabel();
384 381
385 /** 382 /**
386 Set time zone. 383 Set time zone.
387 */ 384 */
388 void setTimeZone( const TimeZone &timeZone ); 385 void setTimeZone( const TimeZone &timeZone );
389 /** 386 /**
390 Return time zone. 387 Return time zone.
391 */ 388 */
392 TimeZone timeZone() const; 389 TimeZone timeZone() const;
393 /** 390 /**
394 Return translated label for timeZone field. 391 Return translated label for timeZone field.
395 */ 392 */
396 static QString timeZoneLabel(); 393 static QString timeZoneLabel();
397 394
398 /** 395 /**
399 Set geographic position. 396 Set geographic position.
400 */ 397 */
401 void setGeo( const Geo &geo ); 398 void setGeo( const Geo &geo );
402 /** 399 /**
403 Return geographic position. 400 Return geographic position.
404 */ 401 */
405 Geo geo() const; 402 Geo geo() const;
406 /** 403 /**
407 Return translated label for geo field. 404 Return translated label for geo field.
408 */ 405 */
409 static QString geoLabel(); 406 static QString geoLabel();
410 407
411 /** 408 /**
412 Set title. 409 Set title.
413 */ 410 */
414 void setTitle( const QString &title ); 411 void setTitle( const QString &title );
415 /** 412 /**
416 Return title. 413 Return title.
417 */ 414 */
418 QString title() const; 415 QString title() const;
419 /** 416 /**
420 Return translated label for title field. 417 Return translated label for title field.
421 */ 418 */
422 static QString titleLabel(); 419 static QString titleLabel();
423 420
424 /** 421 /**
425 Set role. 422 Set role.
426 */ 423 */
427 void setRole( const QString &role ); 424 void setRole( const QString &role );
428 /** 425 /**
429 Return role. 426 Return role.
430 */ 427 */
431 QString role() const; 428 QString role() const;
432 /** 429 /**
433 Return translated label for role field. 430 Return translated label for role field.
434 */ 431 */
435 static QString roleLabel(); 432 static QString roleLabel();
436 433
437 /** 434 /**
438 Set organization. 435 Set organization.
439 */ 436 */
440 void setOrganization( const QString &organization ); 437 void setOrganization( const QString &organization );
441 /** 438 /**
442 Return organization. 439 Return organization.
443 */ 440 */
444 QString organization() const; 441 QString organization() const;
445 /** 442 /**
446 Return translated label for organization field. 443 Return translated label for organization field.
447 */ 444 */
448 static QString organizationLabel(); 445 static QString organizationLabel();
449 446
450 /** 447 /**
451 Set note. 448 Set note.
452 */ 449 */
453 void setNote( const QString &note ); 450 void setNote( const QString &note );
454 /** 451 /**
455 Return note. 452 Return note.
456 */ 453 */
457 QString note() const; 454 QString note() const;
458 /** 455 /**
459 Return translated label for note field. 456 Return translated label for note field.
460 */ 457 */
461 static QString noteLabel(); 458 static QString noteLabel();
462 459
463 /** 460 /**
464 Set product identifier. 461 Set product identifier.
465 */ 462 */
466 void setProductId( const QString &productId ); 463 void setProductId( const QString &productId );
467 /** 464 /**
468 Return product identifier. 465 Return product identifier.
469 */ 466 */
470 QString productId() const; 467 QString productId() const;
471 /** 468 /**
472 Return translated label for productId field. 469 Return translated label for productId field.
473 */ 470 */
474 static QString productIdLabel(); 471 static QString productIdLabel();
475 472
476 /** 473 /**
477 Set revision date. 474 Set revision date.
478 */ 475 */
479 void setRevision( const QDateTime &revision ); 476 void setRevision( const QDateTime &revision );
480 /** 477 /**
481 Return revision date. 478 Return revision date.
482 */ 479 */
483 QDateTime revision() const; 480 QDateTime revision() const;
484 /** 481 /**
485 Return translated label for revision field. 482 Return translated label for revision field.
486 */ 483 */
487 static QString revisionLabel(); 484 static QString revisionLabel();
488 485
489 /** 486 /**
490 Set sort string. 487 Set sort string.
491 */ 488 */
492 void setSortString( const QString &sortString ); 489 void setSortString( const QString &sortString );
493 /** 490 /**
494 Return sort string. 491 Return sort string.
495 */ 492 */
496 QString sortString() const; 493 QString sortString() const;
497 /** 494 /**
498 Return translated label for sortString field. 495 Return translated label for sortString field.
499 */ 496 */
500 static QString sortStringLabel(); 497 static QString sortStringLabel();
501 498
502 /** 499 /**
503 Set URL. 500 Set URL.
504 */ 501 */
505 void setUrl( const KURL &url ); 502 void setUrl( const KURL &url );
506 /** 503 /**
507 Return URL. 504 Return URL.
508 */ 505 */
509 KURL url() const; 506 KURL url() const;
510 /** 507 /**
511 Return translated label for url field. 508 Return translated label for url field.
512 */ 509 */
513 static QString urlLabel(); 510 static QString urlLabel();
514 511
515 /** 512 /**
516 Set security class. 513 Set security class.
517 */ 514 */
518 void setSecrecy( const Secrecy &secrecy ); 515 void setSecrecy( const Secrecy &secrecy );
519 /** 516 /**
520 Return security class. 517 Return security class.
521 */ 518 */
522 Secrecy secrecy() const; 519 Secrecy secrecy() const;
523 /** 520 /**
524 Return translated label for secrecy field. 521 Return translated label for secrecy field.
525 */ 522 */
526 static QString secrecyLabel(); 523 static QString secrecyLabel();
527 524
528 /** 525 /**
529 Set logo. 526 Set logo.
530 */ 527 */
531 void setLogo( const Picture &logo ); 528 void setLogo( const Picture &logo );
532 /** 529 /**
533 Return logo. 530 Return logo.
534 */ 531 */
535 Picture logo() const; 532 Picture logo() const;
536 /** 533 /**
537 Return translated label for logo field. 534 Return translated label for logo field.
538 */ 535 */
539 static QString logoLabel(); 536 static QString logoLabel();
540 537
541 /** 538 /**
542 Set photo. 539 Set photo.
543 */ 540 */
544 void setPhoto( const Picture &photo ); 541 void setPhoto( const Picture &photo );
545 /** 542 /**
546 Return photo. 543 Return photo.
547 */ 544 */
548 Picture photo() const; 545 Picture photo() const;
549 /** 546 /**
550 Return translated label for photo field. 547 Return translated label for photo field.
551 */ 548 */
552 static QString photoLabel(); 549 static QString photoLabel();
553 550
554 /** 551 /**
555 Set sound. 552 Set sound.
556 */ 553 */
557 void setSound( const Sound &sound ); 554 void setSound( const Sound &sound );
558 /** 555 /**
559 Return sound. 556 Return sound.
560 */ 557 */
561 Sound sound() const; 558 Sound sound() const;
562 /** 559 /**
563 Return translated label for sound field. 560 Return translated label for sound field.
564 */ 561 */
565 static QString soundLabel(); 562 static QString soundLabel();
566 563
567 /** 564 /**
568 Set agent. 565 Set agent.
569 */ 566 */
570 void setAgent( const Agent &agent ); 567 void setAgent( const Agent &agent );
571 /** 568 /**
572 Return agent. 569 Return agent.
573 */ 570 */
574 Agent agent() const; 571 Agent agent() const;
575 /** 572 /**
576 Return translated label for agent field. 573 Return translated label for agent field.
577 */ 574 */
578 static QString agentLabel(); 575 static QString agentLabel();
579 576
580 /** 577 /**
581 Set name fields by parsing the given string and trying to associate the 578 Set name fields by parsing the given string and trying to associate the
582 parts of the string with according fields. This function should probably 579 parts of the string with according fields. This function should probably
583 be a bit more clever. 580 be a bit more clever.
584 */ 581 */
585 void setNameFromString( const QString & ); 582 void setNameFromString( const QString & );
586 583
587 /** 584 /**
588 Return the name of the addressee. This is calculated from all the name 585 Return the name of the addressee. This is calculated from all the name
589 fields. 586 fields.
590 */ 587 */
591 QString realName() const; 588 QString realName() const;
592 589
593 /** 590 /**
594 Return the name that consists of all name parts. 591 Return the name that consists of all name parts.
595 */ 592 */
596 QString assembledName() const; 593 QString assembledName() const;
597 594
598 /** 595 /**
599 Return email address including real name. 596 Return email address including real name.
600 597
601 @param email Email address to be used to construct the full email string. 598 @param email Email address to be used to construct the full email string.
602 If this is QString::null the preferred email address is used. 599 If this is QString::null the preferred email address is used.
603 */ 600 */
604 QString fullEmail( const QString &email=QString::null ) const; 601 QString fullEmail( const QString &email=QString::null ) const;
605 602
606 /** 603 /**
607 Insert an email address. If the email address already exists in this 604 Insert an email address. If the email address already exists in this
608 addressee it is not duplicated. 605 addressee it is not duplicated.
609 606
610 @param email Email address 607 @param email Email address
611 @param preferred Set to true, if this is the preferred email address of 608 @param preferred Set to true, if this is the preferred email address of
612 the addressee. 609 the addressee.
613 */ 610 */
614 void insertEmail( const QString &email, bool preferred=false ); 611 void insertEmail( const QString &email, bool preferred=false );
615 612
616 /** 613 /**
617 Remove email address. If the email address doesn't exist, nothing happens. 614 Remove email address. If the email address doesn't exist, nothing happens.
618 */ 615 */
619 void removeEmail( const QString &email ); 616 void removeEmail( const QString &email );
620 617
621 /** 618 /**
622 Return preferred email address. This is the first email address or the 619 Return preferred email address. This is the first email address or the
623 last one added with @ref insertEmail() with a set preferred parameter. 620 last one added with @ref insertEmail() with a set preferred parameter.
624 */ 621 */
625 QString preferredEmail() const; 622 QString preferredEmail() const;
626 623
627 /** 624 /**
628 Return list of all email addresses. 625 Return list of all email addresses.
629 */ 626 */
630 QStringList emails() const; 627 QStringList emails() const;
631 628
632 /** 629 /**
633 Set the emails to @param. 630 Set the emails to @param.
634 The first email address gets the preferred one! 631 The first email address gets the preferred one!
635 @param list The list of email addresses. 632 @param list The list of email addresses.
636 */ 633 */
637 void setEmails( const QStringList& list); 634 void setEmails( const QStringList& list);
638 635
639 /** 636 /**
640 Insert a phone number. If a phone number with the same id already exists 637 Insert a phone number. If a phone number with the same id already exists
641 in this addressee it is not duplicated. 638 in this addressee it is not duplicated.
642 */ 639 */
643 void insertPhoneNumber( const PhoneNumber &phoneNumber ); 640 void insertPhoneNumber( const PhoneNumber &phoneNumber );
644 641
645 /** 642 /**
646 Remove phone number. If no phone number with the given id exists for this 643 Remove phone number. If no phone number with the given id exists for this
647 addresse nothing happens. 644 addresse nothing happens.
648 */ 645 */
649 void removePhoneNumber( const PhoneNumber &phoneNumber ); 646 void removePhoneNumber( const PhoneNumber &phoneNumber );
650 647
651 /** 648 /**
652 Return phone number, which matches the given type. 649 Return phone number, which matches the given type.
653 */ 650 */
654 PhoneNumber phoneNumber( int type ) const; 651 PhoneNumber phoneNumber( int type ) const;
655 652
656 /** 653 /**
657 Return list of all phone numbers. 654 Return list of all phone numbers.
658 */ 655 */
659 PhoneNumber::List phoneNumbers() const; 656 PhoneNumber::List phoneNumbers() const;
660 657
661 /** 658 /**
662 Return list of phone numbers with a special type. 659 Return list of phone numbers with a special type.
663 */ 660 */
664 PhoneNumber::List phoneNumbers( int type ) const; 661 PhoneNumber::List phoneNumbers( int type ) const;
665 662
666 /** 663 /**
667 Return phone number with the given id. 664 Return phone number with the given id.
668 */ 665 */
669 PhoneNumber findPhoneNumber( const QString &id ) const; 666 PhoneNumber findPhoneNumber( const QString &id ) const;
670 667
671 /** 668 /**
672 Insert a key. If a key with the same id already exists 669 Insert a key. If a key with the same id already exists
673 in this addressee it is not duplicated. 670 in this addressee it is not duplicated.
674 */ 671 */
675 void insertKey( const Key &key ); 672 void insertKey( const Key &key );
676 673
677 /** 674 /**
678 Remove a key. If no key with the given id exists for this 675 Remove a key. If no key with the given id exists for this
679 addresse nothing happens. 676 addresse nothing happens.
diff --git a/kabc/field.cpp b/kabc/field.cpp
index 5c561c3..fd51026 100644
--- a/kabc/field.cpp
+++ b/kabc/field.cpp
@@ -1,596 +1,590 @@
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) 2002 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2002 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 <klocale.h> 29#include <klocale.h>
30#include <kconfig.h> 30#include <kconfig.h>
31#include <kconfigbase.h> 31#include <kconfigbase.h>
32#include <kglobal.h> 32#include <kglobal.h>
33 33
34#include "field.h" 34#include "field.h"
35#include "resource.h" 35#include "resource.h"
36 36
37using namespace KABC; 37using namespace KABC;
38 38
39class Field::FieldImpl 39class Field::FieldImpl
40{ 40{
41 public: 41 public:
42 FieldImpl( int fieldId, int category = 0, 42 FieldImpl( int fieldId, int category = 0,
43 const QString &label = QString::null, 43 const QString &label = QString::null,
44 const QString &key = QString::null, 44 const QString &key = QString::null,
45 const QString &app = QString::null ) 45 const QString &app = QString::null )
46 : mFieldId( fieldId ), mCategory( category ), mLabel( label ), 46 : mFieldId( fieldId ), mCategory( category ), mLabel( label ),
47 mKey( key ), mApp( app ) {} 47 mKey( key ), mApp( app ) {}
48 48
49 enum FieldId 49 enum FieldId
50 { 50 {
51 CustomField, 51 CustomField,
52 FormattedName, 52 FormattedName,
53 FamilyName, 53 FamilyName,
54 GivenName, 54 GivenName,
55 AdditionalName, 55 AdditionalName,
56 Prefix, 56 Prefix,
57 Suffix, 57 Suffix,
58 NickName, 58 NickName,
59 Birthday, 59 Birthday,
60 Category, 60 Category,
61 HomeAddressStreet, 61 HomeAddressStreet,
62 HomeAddressLocality, 62 HomeAddressLocality,
63 HomeAddressRegion, 63 HomeAddressRegion,
64 HomeAddressPostalCode, 64 HomeAddressPostalCode,
65 HomeAddressCountry, 65 HomeAddressCountry,
66 HomeAddressLabel, 66 HomeAddressLabel,
67 BusinessAddressStreet, 67 BusinessAddressStreet,
68 BusinessAddressLocality, 68 BusinessAddressLocality,
69 BusinessAddressRegion, 69 BusinessAddressRegion,
70 BusinessAddressPostalCode, 70 BusinessAddressPostalCode,
71 BusinessAddressCountry, 71 BusinessAddressCountry,
72 BusinessAddressLabel, 72 BusinessAddressLabel,
73 HomePhone, 73 HomePhone,
74 BusinessPhone, 74 BusinessPhone,
75 MobilePhone, 75 MobilePhone,
76 HomeFax, 76 HomeFax,
77 BusinessFax, 77 BusinessFax,
78 CarPhone, 78 CarPhone,
79 Isdn, 79 Isdn,
80 Pager, 80 Pager,
81 Email, 81 Email,
82 Mailer, 82 Mailer,
83 Title, 83 Title,
84 Role, 84 Role,
85 Organization, 85 Organization,
86 Note, 86 Note,
87 Url, 87 Url,
88 Resource, 88 Resource,
89 Sip, 89 Sip,
90 DefaultFormattedName,
91 MobileWorkPhone, 90 MobileWorkPhone,
92 MobileHomePhone 91 MobileHomePhone
93 }; 92 };
94 93
95 int fieldId() { return mFieldId; } 94 int fieldId() { return mFieldId; }
96 int category() { return mCategory; } 95 int category() { return mCategory; }
97 96
98 QString label() { return mLabel; } 97 QString label() { return mLabel; }
99 QString key() { return mKey; } 98 QString key() { return mKey; }
100 QString app() { return mApp; } 99 QString app() { return mApp; }
101 100
102 private: 101 private:
103 int mFieldId; 102 int mFieldId;
104 int mCategory; 103 int mCategory;
105 104
106 QString mLabel; 105 QString mLabel;
107 QString mKey; 106 QString mKey;
108 QString mApp; 107 QString mApp;
109}; 108};
110 109
111 110
112Field::List Field::mAllFields; 111Field::List Field::mAllFields;
113Field::List Field::mDefaultFields; 112Field::List Field::mDefaultFields;
114Field::List Field::mCustomFields; 113Field::List Field::mCustomFields;
115 114
116 115
117Field::Field( FieldImpl *impl ) 116Field::Field( FieldImpl *impl )
118{ 117{
119 mImpl = impl; 118 mImpl = impl;
120} 119}
121 120
122Field::~Field() 121Field::~Field()
123{ 122{
124 delete mImpl; 123 delete mImpl;
125} 124}
126 125
127QString Field::label() 126QString Field::label()
128{ 127{
129 switch ( mImpl->fieldId() ) { 128 switch ( mImpl->fieldId() ) {
130 case FieldImpl::FormattedName: 129 case FieldImpl::FormattedName:
131 return Addressee::formattedNameLabel(); 130 return Addressee::formattedNameLabel();
132 case FieldImpl::DefaultFormattedName:
133 return Addressee::defaultFormattedNameLabel();
134 case FieldImpl::FamilyName: 131 case FieldImpl::FamilyName:
135 return Addressee::familyNameLabel(); 132 return Addressee::familyNameLabel();
136 case FieldImpl::GivenName: 133 case FieldImpl::GivenName:
137 return Addressee::givenNameLabel(); 134 return Addressee::givenNameLabel();
138 case FieldImpl::AdditionalName: 135 case FieldImpl::AdditionalName:
139 return Addressee::additionalNameLabel(); 136 return Addressee::additionalNameLabel();
140 case FieldImpl::Prefix: 137 case FieldImpl::Prefix:
141 return Addressee::prefixLabel(); 138 return Addressee::prefixLabel();
142 case FieldImpl::Suffix: 139 case FieldImpl::Suffix:
143 return Addressee::suffixLabel(); 140 return Addressee::suffixLabel();
144 case FieldImpl::NickName: 141 case FieldImpl::NickName:
145 return Addressee::nickNameLabel(); 142 return Addressee::nickNameLabel();
146 case FieldImpl::Birthday: 143 case FieldImpl::Birthday:
147 return Addressee::birthdayLabel(); 144 return Addressee::birthdayLabel();
148 case FieldImpl::HomeAddressStreet: 145 case FieldImpl::HomeAddressStreet:
149 return Addressee::homeAddressStreetLabel(); 146 return Addressee::homeAddressStreetLabel();
150 case FieldImpl::HomeAddressLocality: 147 case FieldImpl::HomeAddressLocality:
151 return Addressee::homeAddressLocalityLabel(); 148 return Addressee::homeAddressLocalityLabel();
152 case FieldImpl::HomeAddressRegion: 149 case FieldImpl::HomeAddressRegion:
153 return Addressee::homeAddressRegionLabel(); 150 return Addressee::homeAddressRegionLabel();
154 case FieldImpl::HomeAddressPostalCode: 151 case FieldImpl::HomeAddressPostalCode:
155 return Addressee::homeAddressPostalCodeLabel(); 152 return Addressee::homeAddressPostalCodeLabel();
156 case FieldImpl::HomeAddressCountry: 153 case FieldImpl::HomeAddressCountry:
157 return Addressee::homeAddressCountryLabel(); 154 return Addressee::homeAddressCountryLabel();
158 case FieldImpl::HomeAddressLabel: 155 case FieldImpl::HomeAddressLabel:
159 return Addressee::homeAddressLabelLabel(); 156 return Addressee::homeAddressLabelLabel();
160 case FieldImpl::BusinessAddressStreet: 157 case FieldImpl::BusinessAddressStreet:
161 return Addressee::businessAddressStreetLabel(); 158 return Addressee::businessAddressStreetLabel();
162 case FieldImpl::BusinessAddressLocality: 159 case FieldImpl::BusinessAddressLocality:
163 return Addressee::businessAddressLocalityLabel(); 160 return Addressee::businessAddressLocalityLabel();
164 case FieldImpl::BusinessAddressRegion: 161 case FieldImpl::BusinessAddressRegion:
165 return Addressee::businessAddressRegionLabel(); 162 return Addressee::businessAddressRegionLabel();
166 case FieldImpl::BusinessAddressPostalCode: 163 case FieldImpl::BusinessAddressPostalCode:
167 return Addressee::businessAddressPostalCodeLabel(); 164 return Addressee::businessAddressPostalCodeLabel();
168 case FieldImpl::BusinessAddressCountry: 165 case FieldImpl::BusinessAddressCountry:
169 return Addressee::businessAddressCountryLabel(); 166 return Addressee::businessAddressCountryLabel();
170 case FieldImpl::BusinessAddressLabel: 167 case FieldImpl::BusinessAddressLabel:
171 return Addressee::businessAddressLabelLabel(); 168 return Addressee::businessAddressLabelLabel();
172 case FieldImpl::HomePhone: 169 case FieldImpl::HomePhone:
173 return Addressee::homePhoneLabel(); 170 return Addressee::homePhoneLabel();
174 case FieldImpl::BusinessPhone: 171 case FieldImpl::BusinessPhone:
175 return Addressee::businessPhoneLabel(); 172 return Addressee::businessPhoneLabel();
176 case FieldImpl::MobilePhone: 173 case FieldImpl::MobilePhone:
177 return Addressee::mobilePhoneLabel(); 174 return Addressee::mobilePhoneLabel();
178 case FieldImpl::MobileHomePhone: 175 case FieldImpl::MobileHomePhone:
179 return Addressee::mobileHomePhoneLabel(); 176 return Addressee::mobileHomePhoneLabel();
180 case FieldImpl::MobileWorkPhone: 177 case FieldImpl::MobileWorkPhone:
181 return Addressee::mobileWorkPhoneLabel(); 178 return Addressee::mobileWorkPhoneLabel();
182 case FieldImpl::HomeFax: 179 case FieldImpl::HomeFax:
183 return Addressee::homeFaxLabel(); 180 return Addressee::homeFaxLabel();
184 case FieldImpl::BusinessFax: 181 case FieldImpl::BusinessFax:
185 return Addressee::businessFaxLabel(); 182 return Addressee::businessFaxLabel();
186 case FieldImpl::CarPhone: 183 case FieldImpl::CarPhone:
187 return Addressee::carPhoneLabel(); 184 return Addressee::carPhoneLabel();
188 case FieldImpl::Isdn: 185 case FieldImpl::Isdn:
189 return Addressee::isdnLabel(); 186 return Addressee::isdnLabel();
190 case FieldImpl::Pager: 187 case FieldImpl::Pager:
191 return Addressee::pagerLabel(); 188 return Addressee::pagerLabel();
192 case FieldImpl::Email: 189 case FieldImpl::Email:
193 return Addressee::emailLabel(); 190 return Addressee::emailLabel();
194 case FieldImpl::Mailer: 191 case FieldImpl::Mailer:
195 return Addressee::mailerLabel(); 192 return Addressee::mailerLabel();
196 case FieldImpl::Title: 193 case FieldImpl::Title:
197 return Addressee::titleLabel(); 194 return Addressee::titleLabel();
198 case FieldImpl::Role: 195 case FieldImpl::Role:
199 return Addressee::roleLabel(); 196 return Addressee::roleLabel();
200 case FieldImpl::Organization: 197 case FieldImpl::Organization:
201 return Addressee::organizationLabel(); 198 return Addressee::organizationLabel();
202 case FieldImpl::Note: 199 case FieldImpl::Note:
203 return Addressee::noteLabel(); 200 return Addressee::noteLabel();
204 case FieldImpl::Url: 201 case FieldImpl::Url:
205 return Addressee::urlLabel(); 202 return Addressee::urlLabel();
206 case FieldImpl::Resource: 203 case FieldImpl::Resource:
207 return Addressee::resourceLabel(); 204 return Addressee::resourceLabel();
208 case FieldImpl::Category: 205 case FieldImpl::Category:
209 return Addressee::categoryLabel(); 206 return Addressee::categoryLabel();
210 case FieldImpl::Sip: 207 case FieldImpl::Sip:
211 return Addressee::sipLabel(); 208 return Addressee::sipLabel();
212 case FieldImpl::CustomField: 209 case FieldImpl::CustomField:
213 return mImpl->label(); 210 return mImpl->label();
214 default: 211 default:
215 return i18n("Unknown Field"); 212 return i18n("Unknown Field");
216 } 213 }
217} 214}
218 215
219int Field::category() 216int Field::category()
220{ 217{
221 return mImpl->category(); 218 return mImpl->category();
222} 219}
223 220
224QString Field::categoryLabel( int category ) 221QString Field::categoryLabel( int category )
225{ 222{
226 switch ( category ) { 223 switch ( category ) {
227 case All: 224 case All:
228 return i18n("All"); 225 return i18n("All");
229 case Frequent: 226 case Frequent:
230 return i18n("Frequent"); 227 return i18n("Frequent");
231 case Address: 228 case Address:
232 return i18n("Address"); 229 return i18n("Address");
233 case Email: 230 case Email:
234 return i18n("Email"); 231 return i18n("Email");
235 case Personal: 232 case Personal:
236 return i18n("Personal"); 233 return i18n("Personal");
237 case Organization: 234 case Organization:
238 return i18n("Organization"); 235 return i18n("Organization");
239 case CustomCategory: 236 case CustomCategory:
240 return i18n("Custom"); 237 return i18n("Custom");
241 default: 238 default:
242 return i18n("Undefined"); 239 return i18n("Undefined");
243 } 240 }
244} 241}
245 242
246QString Field::value( const KABC::Addressee &a ) 243QString Field::value( const KABC::Addressee &a )
247{ 244{
248 switch ( mImpl->fieldId() ) { 245 switch ( mImpl->fieldId() ) {
249 case FieldImpl::FormattedName: 246 case FieldImpl::FormattedName:
250 return a.formattedName(); 247 return a.formattedName();
251 case FieldImpl::DefaultFormattedName:
252 return a.defaultFormattedName();
253 case FieldImpl::FamilyName: 248 case FieldImpl::FamilyName:
254 return a.familyName(); 249 return a.familyName();
255 case FieldImpl::GivenName: 250 case FieldImpl::GivenName:
256 return a.givenName(); 251 return a.givenName();
257 case FieldImpl::AdditionalName: 252 case FieldImpl::AdditionalName:
258 return a.additionalName(); 253 return a.additionalName();
259 case FieldImpl::Prefix: 254 case FieldImpl::Prefix:
260 return a.prefix(); 255 return a.prefix();
261 case FieldImpl::Suffix: 256 case FieldImpl::Suffix:
262 return a.suffix(); 257 return a.suffix();
263 case FieldImpl::NickName: 258 case FieldImpl::NickName:
264 return a.nickName(); 259 return a.nickName();
265 case FieldImpl::Mailer: 260 case FieldImpl::Mailer:
266 return a.mailer(); 261 return a.mailer();
267 case FieldImpl::Title: 262 case FieldImpl::Title:
268 return a.title(); 263 return a.title();
269 case FieldImpl::Role: 264 case FieldImpl::Role:
270 return a.role(); 265 return a.role();
271 case FieldImpl::Organization: 266 case FieldImpl::Organization:
272 return a.organization(); 267 return a.organization();
273 case FieldImpl::Note: 268 case FieldImpl::Note:
274 return a.note(); 269 return a.note();
275 case FieldImpl::Email: 270 case FieldImpl::Email:
276 return a.preferredEmail(); 271 return a.preferredEmail();
277 case FieldImpl::Birthday: 272 case FieldImpl::Birthday:
278 if ( a.birthday().isValid() ) { 273 if ( a.birthday().isValid() ) {
279//the generated code had the following format: return a.birthday().date().toString( Qt::ISODate ); 274//the generated code had the following format: return a.birthday().date().toString( Qt::ISODate );
280// But Qt::IsoDate was not specified. 275// But Qt::IsoDate was not specified.
281// QString _oldFormat = KGlobal::locale()->dateFormat(); 276// QString _oldFormat = KGlobal::locale()->dateFormat();
282// KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate 277// KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate
283 QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false, KLocale::ISODate); 278 QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false, KLocale::ISODate);
284// KGlobal::locale()->setDateFormat(_oldFormat); 279// KGlobal::locale()->setDateFormat(_oldFormat);
285 return dt; 280 return dt;
286 } 281 }
287 else 282 else
288 return QString::null; 283 return QString::null;
289 case FieldImpl::Url: 284 case FieldImpl::Url:
290 return a.url().prettyURL(); 285 return a.url().prettyURL();
291//US 286//US
292 case FieldImpl::Resource: 287 case FieldImpl::Resource:
293 return a.resource()->resourceName(); 288 return a.resource()->resourceName();
294 case FieldImpl::Category: 289 case FieldImpl::Category:
295 return a.categories().join(","); 290 return a.categories().join(",");
296 case FieldImpl::HomePhone: 291 case FieldImpl::HomePhone:
297 return a.phoneNumber( PhoneNumber::Home ).number(); 292 return a.phoneNumber( PhoneNumber::Home ).number();
298 case FieldImpl::BusinessPhone: 293 case FieldImpl::BusinessPhone:
299 return a.phoneNumber( PhoneNumber::Work ).number(); 294 return a.phoneNumber( PhoneNumber::Work ).number();
300 case FieldImpl::MobilePhone: 295 case FieldImpl::MobilePhone:
301 return a.phoneNumber( PhoneNumber::Cell ).number(); 296 return a.phoneNumber( PhoneNumber::Cell ).number();
302 case FieldImpl::MobileWorkPhone: 297 case FieldImpl::MobileWorkPhone:
303 return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Work ).number(); 298 return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Work ).number();
304 case FieldImpl::MobileHomePhone: 299 case FieldImpl::MobileHomePhone:
305 return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Home ).number(); 300 return a.phoneNumber( PhoneNumber::Cell | PhoneNumber::Home ).number();
306 case FieldImpl::HomeFax: 301 case FieldImpl::HomeFax:
307 return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); 302 return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number();
308 case FieldImpl::BusinessFax: 303 case FieldImpl::BusinessFax:
309 return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); 304 return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number();
310 case FieldImpl::CarPhone: 305 case FieldImpl::CarPhone:
311 return a.phoneNumber( PhoneNumber::Car ).number(); 306 return a.phoneNumber( PhoneNumber::Car ).number();
312 case FieldImpl::Isdn: 307 case FieldImpl::Isdn:
313 return a.phoneNumber( PhoneNumber::Isdn ).number(); 308 return a.phoneNumber( PhoneNumber::Isdn ).number();
314 case FieldImpl::Pager: 309 case FieldImpl::Pager:
315 return a.phoneNumber( PhoneNumber::Pager ).number(); 310 return a.phoneNumber( PhoneNumber::Pager ).number();
316 case FieldImpl::Sip: 311 case FieldImpl::Sip:
317 return a.phoneNumber( PhoneNumber::Sip ).number(); 312 return a.phoneNumber( PhoneNumber::Sip ).number();
318 case FieldImpl::HomeAddressStreet: 313 case FieldImpl::HomeAddressStreet:
319 return a.address( Address::Home ).street(); 314 return a.address( Address::Home ).street();
320 case FieldImpl::HomeAddressLocality: 315 case FieldImpl::HomeAddressLocality:
321 return a.address( Address::Home ).locality(); 316 return a.address( Address::Home ).locality();
322 case FieldImpl::HomeAddressRegion: 317 case FieldImpl::HomeAddressRegion:
323 return a.address( Address::Home ).region(); 318 return a.address( Address::Home ).region();
324 case FieldImpl::HomeAddressPostalCode: 319 case FieldImpl::HomeAddressPostalCode:
325 return a.address( Address::Home ).postalCode(); 320 return a.address( Address::Home ).postalCode();
326 case FieldImpl::HomeAddressCountry: 321 case FieldImpl::HomeAddressCountry:
327 return a.address( Address::Home ).country(); 322 return a.address( Address::Home ).country();
328 case FieldImpl::BusinessAddressStreet: 323 case FieldImpl::BusinessAddressStreet:
329 return a.address( Address::Work ).street(); 324 return a.address( Address::Work ).street();
330 case FieldImpl::BusinessAddressLocality: 325 case FieldImpl::BusinessAddressLocality:
331 return a.address( Address::Work ).locality(); 326 return a.address( Address::Work ).locality();
332 case FieldImpl::BusinessAddressRegion: 327 case FieldImpl::BusinessAddressRegion:
333 return a.address( Address::Work ).region(); 328 return a.address( Address::Work ).region();
334 case FieldImpl::BusinessAddressPostalCode: 329 case FieldImpl::BusinessAddressPostalCode:
335 return a.address( Address::Work ).postalCode(); 330 return a.address( Address::Work ).postalCode();
336 case FieldImpl::BusinessAddressCountry: 331 case FieldImpl::BusinessAddressCountry:
337 return a.address( Address::Work ).country(); 332 return a.address( Address::Work ).country();
338 case FieldImpl::CustomField: 333 case FieldImpl::CustomField:
339 return a.custom( mImpl->app(), mImpl->key() ); 334 return a.custom( mImpl->app(), mImpl->key() );
340 default: 335 default:
341 return QString::null; 336 return QString::null;
342 } 337 }
343} 338}
344 339
345bool Field::setValue( KABC::Addressee &a, const QString &value ) 340bool Field::setValue( KABC::Addressee &a, const QString &value )
346{ 341{
347 switch ( mImpl->fieldId() ) { 342 switch ( mImpl->fieldId() ) {
348 case FieldImpl::FormattedName: 343 case FieldImpl::FormattedName:
349 a.setFormattedName( value ); 344 a.setFormattedName( value );
350 return true; 345 return true;
351 case FieldImpl::FamilyName: 346 case FieldImpl::FamilyName:
352 a.setFamilyName( value ); 347 a.setFamilyName( value );
353 return true; 348 return true;
354 case FieldImpl::GivenName: 349 case FieldImpl::GivenName:
355 a.setGivenName( value ); 350 a.setGivenName( value );
356 return true; 351 return true;
357 case FieldImpl::AdditionalName: 352 case FieldImpl::AdditionalName:
358 a.setAdditionalName( value ); 353 a.setAdditionalName( value );
359 return true; 354 return true;
360 case FieldImpl::Prefix: 355 case FieldImpl::Prefix:
361 a.setPrefix( value ); 356 a.setPrefix( value );
362 return true; 357 return true;
363 case FieldImpl::Suffix: 358 case FieldImpl::Suffix:
364 a.setSuffix( value ); 359 a.setSuffix( value );
365 return true; 360 return true;
366 case FieldImpl::NickName: 361 case FieldImpl::NickName:
367 a.setNickName( value ); 362 a.setNickName( value );
368 return true; 363 return true;
369 case FieldImpl::Mailer: 364 case FieldImpl::Mailer:
370 a.setMailer( value ); 365 a.setMailer( value );
371 return true; 366 return true;
372 case FieldImpl::Title: 367 case FieldImpl::Title:
373 a.setTitle( value ); 368 a.setTitle( value );
374 return true; 369 return true;
375 case FieldImpl::Role: 370 case FieldImpl::Role:
376 a.setRole( value ); 371 a.setRole( value );
377 return true; 372 return true;
378 case FieldImpl::Organization: 373 case FieldImpl::Organization:
379 a.setOrganization( value ); 374 a.setOrganization( value );
380 return true; 375 return true;
381 case FieldImpl::Note: 376 case FieldImpl::Note:
382 a.setNote( value ); 377 a.setNote( value );
383 return true; 378 return true;
384 case FieldImpl::Birthday: 379 case FieldImpl::Birthday:
385//US 380//US
386//the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); 381//the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) );
387// But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? 382// But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ?
388 { 383 {
389 QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate 384 QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate
390 a.setBirthday(dt); 385 a.setBirthday(dt);
391 } 386 }
392 return true; 387 return true;
393 case FieldImpl::CustomField: 388 case FieldImpl::CustomField:
394 a.insertCustom( mImpl->app(), mImpl->key(), value ); 389 a.insertCustom( mImpl->app(), mImpl->key(), value );
395//US never copy the resourcename back to the adressee. 390//US never copy the resourcename back to the adressee.
396 case FieldImpl::Resource: 391 case FieldImpl::Resource:
397 default: 392 default:
398 return false; 393 return false;
399 } 394 }
400} 395}
401 396
402bool Field::isCustom() 397bool Field::isCustom()
403{ 398{
404 return mImpl->fieldId() == FieldImpl::CustomField; 399 return mImpl->fieldId() == FieldImpl::CustomField;
405} 400}
406 401
407Field::List Field::allFields() 402Field::List Field::allFields()
408{ 403{
409 if ( mAllFields.isEmpty() ) { 404 if ( mAllFields.isEmpty() ) {
410 createField( FieldImpl::FormattedName, Frequent ); 405 createField( FieldImpl::FormattedName, Frequent );
411 createField( FieldImpl::DefaultFormattedName, Frequent );
412 createField( FieldImpl::FamilyName, Frequent ); 406 createField( FieldImpl::FamilyName, Frequent );
413 createField( FieldImpl::GivenName, Frequent ); 407 createField( FieldImpl::GivenName, Frequent );
414 createField( FieldImpl::AdditionalName ); 408 createField( FieldImpl::AdditionalName );
415 createField( FieldImpl::Prefix ); 409 createField( FieldImpl::Prefix );
416 createField( FieldImpl::Suffix ); 410 createField( FieldImpl::Suffix );
417 createField( FieldImpl::NickName, Personal ); 411 createField( FieldImpl::NickName, Personal );
418 createField( FieldImpl::Birthday, Personal ); 412 createField( FieldImpl::Birthday, Personal );
419 createField( FieldImpl::Category ); 413 createField( FieldImpl::Category );
420 createField( FieldImpl::HomeAddressStreet, Address|Personal ); 414 createField( FieldImpl::HomeAddressStreet, Address|Personal );
421 createField( FieldImpl::HomeAddressLocality, Address|Personal ); 415 createField( FieldImpl::HomeAddressLocality, Address|Personal );
422 createField( FieldImpl::HomeAddressRegion, Address|Personal ); 416 createField( FieldImpl::HomeAddressRegion, Address|Personal );
423 createField( FieldImpl::HomeAddressPostalCode, Address|Personal ); 417 createField( FieldImpl::HomeAddressPostalCode, Address|Personal );
424 createField( FieldImpl::HomeAddressCountry, Address|Personal ); 418 createField( FieldImpl::HomeAddressCountry, Address|Personal );
425 createField( FieldImpl::HomeAddressLabel, Address|Personal ); 419 createField( FieldImpl::HomeAddressLabel, Address|Personal );
426 createField( FieldImpl::BusinessAddressStreet, Address|Organization ); 420 createField( FieldImpl::BusinessAddressStreet, Address|Organization );
427 createField( FieldImpl::BusinessAddressLocality, Address|Organization ); 421 createField( FieldImpl::BusinessAddressLocality, Address|Organization );
428 createField( FieldImpl::BusinessAddressRegion, Address|Organization ); 422 createField( FieldImpl::BusinessAddressRegion, Address|Organization );
429 createField( FieldImpl::BusinessAddressPostalCode, Address|Organization ); 423 createField( FieldImpl::BusinessAddressPostalCode, Address|Organization );
430 createField( FieldImpl::BusinessAddressCountry, Address|Organization ); 424 createField( FieldImpl::BusinessAddressCountry, Address|Organization );
431 createField( FieldImpl::BusinessAddressLabel, Address|Organization ); 425 createField( FieldImpl::BusinessAddressLabel, Address|Organization );
432 createField( FieldImpl::HomePhone, Personal|Frequent ); 426 createField( FieldImpl::HomePhone, Personal|Frequent );
433 createField( FieldImpl::BusinessPhone, Organization|Frequent ); 427 createField( FieldImpl::BusinessPhone, Organization|Frequent );
434 createField( FieldImpl::MobilePhone, Frequent ); 428 createField( FieldImpl::MobilePhone, Frequent );
435 createField( FieldImpl::MobileHomePhone, Frequent ); 429 createField( FieldImpl::MobileHomePhone, Frequent );
436 createField( FieldImpl::MobileWorkPhone, Frequent ); 430 createField( FieldImpl::MobileWorkPhone, Frequent );
437 createField( FieldImpl::HomeFax ); 431 createField( FieldImpl::HomeFax );
438 createField( FieldImpl::BusinessFax ); 432 createField( FieldImpl::BusinessFax );
439 createField( FieldImpl::CarPhone ); 433 createField( FieldImpl::CarPhone );
440 createField( FieldImpl::Isdn ); 434 createField( FieldImpl::Isdn );
441 createField( FieldImpl::Pager ); 435 createField( FieldImpl::Pager );
442 createField( FieldImpl::Email, Email|Frequent ); 436 createField( FieldImpl::Email, Email|Frequent );
443 createField( FieldImpl::Mailer, Email ); 437 createField( FieldImpl::Mailer, Email );
444 createField( FieldImpl::Title, Organization ); 438 createField( FieldImpl::Title, Organization );
445 createField( FieldImpl::Role, Organization ); 439 createField( FieldImpl::Role, Organization );
446 createField( FieldImpl::Organization, Organization ); 440 createField( FieldImpl::Organization, Organization );
447 createField( FieldImpl::Note ); 441 createField( FieldImpl::Note );
448 createField( FieldImpl::Url ); 442 createField( FieldImpl::Url );
449 createField( FieldImpl::Resource ); 443 createField( FieldImpl::Resource );
450 createField( FieldImpl::Sip ); 444 createField( FieldImpl::Sip );
451 } 445 }
452 446
453 return mAllFields; 447 return mAllFields;
454} 448}
455 449
456Field::List Field::defaultFields() 450Field::List Field::defaultFields()
457{ 451{
458 if ( mDefaultFields.isEmpty() ) { 452 if ( mDefaultFields.isEmpty() ) {
459 createDefaultField( FieldImpl::GivenName ); 453 createDefaultField( FieldImpl::GivenName );
460 createDefaultField( FieldImpl::FamilyName ); 454 createDefaultField( FieldImpl::FamilyName );
461 createDefaultField( FieldImpl::Email ); 455 createDefaultField( FieldImpl::Email );
462 } 456 }
463 457
464 return mDefaultFields; 458 return mDefaultFields;
465} 459}
466 460
467void Field::createField( int id, int category ) 461void Field::createField( int id, int category )
468{ 462{
469 mAllFields.append( new Field( new FieldImpl( id, category ) ) ); 463 mAllFields.append( new Field( new FieldImpl( id, category ) ) );
470} 464}
471 465
472void Field::createDefaultField( int id, int category ) 466void Field::createDefaultField( int id, int category )
473{ 467{
474 mDefaultFields.append( new Field( new FieldImpl( id, category ) ) ); 468 mDefaultFields.append( new Field( new FieldImpl( id, category ) ) );
475} 469}
476 470
477void Field::deleteFields() 471void Field::deleteFields()
478{ 472{
479 Field::List::ConstIterator it; 473 Field::List::ConstIterator it;
480 474
481 for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) { 475 for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) {
482 delete (*it); 476 delete (*it);
483 } 477 }
484 mAllFields.clear(); 478 mAllFields.clear();
485 479
486 for( it = mDefaultFields.begin(); it != mDefaultFields.end(); ++it ) { 480 for( it = mDefaultFields.begin(); it != mDefaultFields.end(); ++it ) {
487 delete (*it); 481 delete (*it);
488 } 482 }
489 mDefaultFields.clear(); 483 mDefaultFields.clear();
490 484
491 for( it = mCustomFields.begin(); it != mCustomFields.end(); ++it ) { 485 for( it = mCustomFields.begin(); it != mCustomFields.end(); ++it ) {
492 delete (*it); 486 delete (*it);
493 } 487 }
494 mCustomFields.clear(); 488 mCustomFields.clear();
495} 489}
496 490
497void Field::saveFields( const QString &identifier, 491void Field::saveFields( const QString &identifier,
498 const Field::List &fields ) 492 const Field::List &fields )
499{ 493{
500 KConfig *cfg = KGlobal::config(); 494 KConfig *cfg = KGlobal::config();
501 KConfigGroupSaver( cfg, "KABCFields" ); 495 KConfigGroupSaver( cfg, "KABCFields" );
502 saveFields( cfg, identifier, fields ); 496 saveFields( cfg, identifier, fields );
503} 497}
504 498
505void Field::saveFields( KConfig *cfg, const QString &identifier, 499void Field::saveFields( KConfig *cfg, const QString &identifier,
506 const Field::List &fields ) 500 const Field::List &fields )
507{ 501{
508 QValueList<int> fieldIds; 502 QValueList<int> fieldIds;
509 503
510//US 504//US
511// qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1()); 505// qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1());
512 506
513 int custom = 0; 507 int custom = 0;
514 Field::List::ConstIterator it; 508 Field::List::ConstIterator it;
515 for( it = fields.begin(); it != fields.end(); ++it ) { 509 for( it = fields.begin(); it != fields.end(); ++it ) {
516//US 510//US
517// qDebug("Field::saveFields field:%i", (*it)->mImpl->fieldId()); 511// qDebug("Field::saveFields field:%i", (*it)->mImpl->fieldId());
518 512
519 fieldIds.append( (*it)->mImpl->fieldId() ); 513 fieldIds.append( (*it)->mImpl->fieldId() );
520 if( (*it)->isCustom() ) { 514 if( (*it)->isCustom() ) {
521 QStringList customEntry; 515 QStringList customEntry;
522 customEntry << (*it)->mImpl->label(); 516 customEntry << (*it)->mImpl->label();
523 customEntry << (*it)->mImpl->key(); 517 customEntry << (*it)->mImpl->key();
524 customEntry << (*it)->mImpl->app(); 518 customEntry << (*it)->mImpl->app();
525 cfg->writeEntry( "KABC_CustomEntry_" + identifier + "_" + 519 cfg->writeEntry( "KABC_CustomEntry_" + identifier + "_" +
526 QString::number( custom++ ), customEntry ); 520 QString::number( custom++ ), customEntry );
527 } 521 }
528 } 522 }
529 cfg->writeEntry( identifier, fieldIds ); 523 cfg->writeEntry( identifier, fieldIds );
530} 524}
531 525
532Field::List Field::restoreFields( const QString &identifier ) 526Field::List Field::restoreFields( const QString &identifier )
533{ 527{
534//US 528//US
535// qDebug("Field::restoreFields, identifier: %s", identifier.latin1()); 529// qDebug("Field::restoreFields, identifier: %s", identifier.latin1());
536 530
537 KConfig *cfg = KGlobal::config(); 531 KConfig *cfg = KGlobal::config();
538 KConfigGroupSaver( cfg, "KABCFields" ); 532 KConfigGroupSaver( cfg, "KABCFields" );
539 cfg->setGroup( "KABCFields" ); 533 cfg->setGroup( "KABCFields" );
540 534
541 Field::List l = restoreFields( cfg, identifier ); 535 Field::List l = restoreFields( cfg, identifier );
542 536
543 return l; 537 return l;
544} 538}
545 539
546Field::List Field::restoreFields( KConfig *cfg, const QString &identifier ) 540Field::List Field::restoreFields( KConfig *cfg, const QString &identifier )
547{ 541{
548 QValueList<int> fieldIds = cfg->readIntListEntry( identifier); 542 QValueList<int> fieldIds = cfg->readIntListEntry( identifier);
549//US 543//US
550// qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1()); 544// qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1());
551 545
552 Field::List fields; 546 Field::List fields;
553 547
554 int custom = 0; 548 int custom = 0;
555 QValueList<int>::ConstIterator it; 549 QValueList<int>::ConstIterator it;
556 for( it = fieldIds.begin(); it != fieldIds.end(); ++it ) { 550 for( it = fieldIds.begin(); it != fieldIds.end(); ++it ) {
557 FieldImpl *f = 0; 551 FieldImpl *f = 0;
558 if ( (*it) == FieldImpl::CustomField ) { 552 if ( (*it) == FieldImpl::CustomField ) {
559 QStringList customEntry = cfg->readListEntry( "KABC_CustomEntry_" + 553 QStringList customEntry = cfg->readListEntry( "KABC_CustomEntry_" +
560 identifier + "_" + 554 identifier + "_" +
561 QString::number( custom++ ) ); 555 QString::number( custom++ ) );
562 f = new FieldImpl( *it, CustomCategory, customEntry[ 0 ], 556 f = new FieldImpl( *it, CustomCategory, customEntry[ 0 ],
563 customEntry[ 1 ], customEntry[ 2 ] ); 557 customEntry[ 1 ], customEntry[ 2 ] );
564 } else { 558 } else {
565 f = new FieldImpl( *it ); 559 f = new FieldImpl( *it );
566 } 560 }
567 fields.append( new Field( f ) ); 561 fields.append( new Field( f ) );
568 } 562 }
569 563
570 return fields; 564 return fields;
571} 565}
572 566
573bool Field::equals( Field *field ) 567bool Field::equals( Field *field )
574{ 568{
575 bool sameId = ( mImpl->fieldId() == field->mImpl->fieldId() ); 569 bool sameId = ( mImpl->fieldId() == field->mImpl->fieldId() );
576 570
577 if ( !sameId ) return false; 571 if ( !sameId ) return false;
578 572
579 if ( mImpl->fieldId() != FieldImpl::CustomField ) return true; 573 if ( mImpl->fieldId() != FieldImpl::CustomField ) return true;
580 574
581 return mImpl->key() == field->mImpl->key(); 575 return mImpl->key() == field->mImpl->key();
582} 576}
583 577
584Field *Field::createCustomField( const QString &label, int category, 578Field *Field::createCustomField( const QString &label, int category,
585 const QString &key, const QString &app ) 579 const QString &key, const QString &app )
586{ 580{
587 Field *field = new Field( new FieldImpl( FieldImpl::CustomField, 581 Field *field = new Field( new FieldImpl( FieldImpl::CustomField,
588 category | CustomCategory, 582 category | CustomCategory,
589 label, key, app ) ); 583 label, key, app ) );
590//US 584//US
591// qDebug("Field::createCustomField label %s", label.latin1() ); 585// qDebug("Field::createCustomField label %s", label.latin1() );
592 586
593 mCustomFields.append( field ); 587 mCustomFields.append( field );
594 588
595 return field; 589 return field;
596} 590}