summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 82b4b9b..bfcfab5 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -1,1106 +1,1125 @@
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 familyName; 54 QString familyName;
55 QString givenName; 55 QString givenName;
56 QString additionalName; 56 QString additionalName;
57 QString prefix; 57 QString prefix;
58 QString suffix; 58 QString suffix;
59 QString nickName; 59 QString nickName;
60 QDateTime birthday; 60 QDateTime birthday;
61 QString mailer; 61 QString mailer;
62 TimeZone timeZone; 62 TimeZone timeZone;
63 Geo geo; 63 Geo geo;
64 QString title; 64 QString title;
65 QString role; 65 QString role;
66 QString organization; 66 QString organization;
67 QString note; 67 QString note;
68 QString productId; 68 QString productId;
69 QDateTime revision; 69 QDateTime revision;
70 QString sortString; 70 QString sortString;
71 QString externalUID; 71 QString externalUID;
72 QString originalExternalUID; 72 QString originalExternalUID;
73 KURL url; 73 KURL url;
74 Secrecy secrecy; 74 Secrecy secrecy;
75 Picture logo; 75 Picture logo;
76 Picture photo; 76 Picture photo;
77 Sound sound; 77 Sound sound;
78 Agent agent; 78 Agent agent;
79 QString mExternalId; 79 QString mExternalId;
80 PhoneNumber::List phoneNumbers; 80 PhoneNumber::List phoneNumbers;
81 Address::List addresses; 81 Address::List addresses;
82 Key::List keys; 82 Key::List keys;
83 QStringList emails; 83 QStringList emails;
84 QStringList categories; 84 QStringList categories;
85 QStringList custom; 85 QStringList custom;
86 int mTempSyncStat; 86 int mTempSyncStat;
87 Resource *resource; 87 Resource *resource;
88 88
89 bool empty :1; 89 bool empty :1;
90 bool changed :1; 90 bool changed :1;
91 bool tagged :1; 91 bool tagged :1;
92}; 92};
93 93
94Addressee::Addressee() 94Addressee::Addressee()
95{ 95{
96 mData = new AddresseeData; 96 mData = new AddresseeData;
97 mData->empty = true; 97 mData->empty = true;
98 mData->changed = false; 98 mData->changed = false;
99 mData->resource = 0; 99 mData->resource = 0;
100 mData->mExternalId = ":"; 100 mData->mExternalId = ":";
101 mData->revision = QDateTime ( QDate( 2003,1,1)); 101 mData->revision = QDateTime ( QDate( 2003,1,1));
102 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; 102 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
103} 103}
104 104
105Addressee::~Addressee() 105Addressee::~Addressee()
106{ 106{
107} 107}
108 108
109Addressee::Addressee( const Addressee &a ) 109Addressee::Addressee( const Addressee &a )
110{ 110{
111 mData = a.mData; 111 mData = a.mData;
112} 112}
113 113
114Addressee &Addressee::operator=( const Addressee &a ) 114Addressee &Addressee::operator=( const Addressee &a )
115{ 115{
116 mData = a.mData; 116 mData = a.mData;
117 return (*this); 117 return (*this);
118} 118}
119 119
120Addressee Addressee::copy() 120Addressee Addressee::copy()
121{ 121{
122 Addressee a; 122 Addressee a;
123 *(a.mData) = *mData; 123 *(a.mData) = *mData;
124 return a; 124 return a;
125} 125}
126 126
127void Addressee::detach() 127void Addressee::detach()
128{ 128{
129 if ( mData.count() == 1 ) return; 129 if ( mData.count() == 1 ) return;
130 *this = copy(); 130 *this = copy();
131} 131}
132 132
133bool Addressee::operator==( const Addressee &a ) const 133bool Addressee::operator==( const Addressee &a ) const
134{ 134{
135 if ( uid() != a.uid() ) return false; 135 if ( uid() != a.uid() ) return false;
136 if ( mData->name != a.mData->name ) return false; 136 if ( mData->name != a.mData->name ) return false;
137 if ( mData->formattedName != a.mData->formattedName ) return false; 137 if ( mData->formattedName != a.mData->formattedName ) return false;
138 if ( mData->familyName != a.mData->familyName ) return false; 138 if ( mData->familyName != a.mData->familyName ) return false;
139 if ( mData->givenName != a.mData->givenName ) return false; 139 if ( mData->givenName != a.mData->givenName ) return false;
140 if ( mData->additionalName != a.mData->additionalName ) return false; 140 if ( mData->additionalName != a.mData->additionalName ) return false;
141 if ( mData->prefix != a.mData->prefix ) return false; 141 if ( mData->prefix != a.mData->prefix ) return false;
142 if ( mData->suffix != a.mData->suffix ) return false; 142 if ( mData->suffix != a.mData->suffix ) return false;
143 if ( mData->nickName != a.mData->nickName ) return false; 143 if ( mData->nickName != a.mData->nickName ) return false;
144 if ( mData->birthday != a.mData->birthday ) return false; 144 if ( mData->birthday != a.mData->birthday ) return false;
145 if ( mData->mailer != a.mData->mailer ) return false; 145 if ( mData->mailer != a.mData->mailer ) return false;
146 if ( mData->timeZone != a.mData->timeZone ) return false; 146 if ( mData->timeZone != a.mData->timeZone ) return false;
147 if ( mData->geo != a.mData->geo ) return false; 147 if ( mData->geo != a.mData->geo ) return false;
148 if ( mData->title != a.mData->title ) return false; 148 if ( mData->title != a.mData->title ) return false;
149 if ( mData->role != a.mData->role ) return false; 149 if ( mData->role != a.mData->role ) return false;
150 if ( mData->organization != a.mData->organization ) return false; 150 if ( mData->organization != a.mData->organization ) return false;
151 if ( mData->note != a.mData->note ) return false; 151 if ( mData->note != a.mData->note ) return false;
152 if ( mData->productId != a.mData->productId ) return false; 152 if ( mData->productId != a.mData->productId ) return false;
153 //if ( mData->revision != a.mData->revision ) return false; 153 //if ( mData->revision != a.mData->revision ) return false;
154 if ( mData->sortString != a.mData->sortString ) return false; 154 if ( mData->sortString != a.mData->sortString ) return false;
155 if ( mData->secrecy != a.mData->secrecy ) return false; 155 if ( mData->secrecy != a.mData->secrecy ) return false;
156 if ( mData->logo != a.mData->logo ) return false; 156 if ( mData->logo != a.mData->logo ) return false;
157 if ( mData->photo != a.mData->photo ) return false; 157 if ( mData->photo != a.mData->photo ) return false;
158 if ( mData->sound != a.mData->sound ) return false; 158 if ( mData->sound != a.mData->sound ) return false;
159 if ( mData->agent != a.mData->agent ) return false; 159 if ( mData->agent != a.mData->agent ) return false;
160 if ( ( mData->url.isValid() || a.mData->url.isValid() ) && 160 if ( ( mData->url.isValid() || a.mData->url.isValid() ) &&
161 ( mData->url != a.mData->url ) ) return false; 161 ( mData->url != a.mData->url ) ) return false;
162 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; 162 if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false;
163 if ( mData->addresses != a.mData->addresses ) return false; 163 if ( mData->addresses != a.mData->addresses ) return false;
164 if ( mData->keys != a.mData->keys ) return false; 164 if ( mData->keys != a.mData->keys ) return false;
165 if ( mData->emails != a.mData->emails ) return false; 165 if ( mData->emails != a.mData->emails ) return false;
166 if ( mData->categories != a.mData->categories ) return false; 166 if ( mData->categories != a.mData->categories ) return false;
167 if ( mData->custom != a.mData->custom ) return false; 167 if ( mData->custom != a.mData->custom ) return false;
168 168
169 return true; 169 return true;
170} 170}
171 171
172bool Addressee::operator!=( const Addressee &a ) const 172bool Addressee::operator!=( const Addressee &a ) const
173{ 173{
174 return !( a == *this ); 174 return !( a == *this );
175} 175}
176 176
177bool Addressee::isEmpty() const 177bool Addressee::isEmpty() const
178{ 178{
179 return mData->empty; 179 return mData->empty;
180} 180}
181ulong Addressee::getCsum4List( const QStringList & attList) 181ulong Addressee::getCsum4List( const QStringList & attList)
182{ 182{
183 int max = attList.count(); 183 int max = attList.count();
184 ulong cSum = 0; 184 ulong cSum = 0;
185 int j,k,i; 185 int j,k,i;
186 int add; 186 int add;
187 for ( i = 0; i < max ; ++i ) { 187 for ( i = 0; i < max ; ++i ) {
188 QString s = attList[i]; 188 QString s = attList[i];
189 if ( ! s.isEmpty() ){ 189 if ( ! s.isEmpty() ){
190 j = s.length(); 190 j = s.length();
191 for ( k = 0; k < j; ++k ) { 191 for ( k = 0; k < j; ++k ) {
192 int mul = k +1; 192 int mul = k +1;
193 add = s[k].unicode (); 193 add = s[k].unicode ();
194 if ( k < 16 ) 194 if ( k < 16 )
195 mul = mul * mul; 195 mul = mul * mul;
196 int ii = i+1; 196 int ii = i+1;
197 add = add * mul *ii*ii*ii; 197 add = add * mul *ii*ii*ii;
198 cSum += add; 198 cSum += add;
199 } 199 }
200 } 200 }
201 201
202 } 202 }
203 //QString dump = attList.join(","); 203 //QString dump = attList.join(",");
204 //qDebug("csum: %d %s", cSum,dump.latin1()); 204 //qDebug("csum: %d %s", cSum,dump.latin1());
205 205
206 return cSum; 206 return cSum;
207 207
208} 208}
209void Addressee::computeCsum(const QString &dev) 209void Addressee::computeCsum(const QString &dev)
210{ 210{
211 QStringList l; 211 QStringList l;
212 //if ( !mData->name.isEmpty() ) l.append(mData->name); 212 //if ( !mData->name.isEmpty() ) l.append(mData->name);
213 //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); 213 //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName );
214 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); 214 if ( !mData->familyName.isEmpty() ) l.append( mData->familyName );
215 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); 215 if ( !mData->givenName.isEmpty() ) l.append(mData->givenName );
216 if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); 216 if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName );
217 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); 217 if ( !mData->prefix.isEmpty() ) l.append( mData->prefix );
218 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); 218 if ( !mData->suffix.isEmpty() ) l.append( mData->suffix );
219 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); 219 if ( !mData->nickName.isEmpty() ) l.append( mData->nickName );
220 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); 220 if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() );
221 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); 221 if ( !mData->mailer.isEmpty() ) l.append( mData->mailer );
222 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); 222 if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() );
223 if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); 223 if ( mData->geo.isValid() ) l.append( mData->geo.asString() );
224 if ( !mData->title .isEmpty() ) l.append( mData->title ); 224 if ( !mData->title .isEmpty() ) l.append( mData->title );
225 if ( !mData->role.isEmpty() ) l.append( mData->role ); 225 if ( !mData->role.isEmpty() ) l.append( mData->role );
226 if ( !mData->organization.isEmpty() ) l.append( mData->organization ); 226 if ( !mData->organization.isEmpty() ) l.append( mData->organization );
227 if ( !mData->note.isEmpty() ) l.append( mData->note ); 227 if ( !mData->note.isEmpty() ) l.append( mData->note );
228 if ( !mData->productId.isEmpty() ) l.append(mData->productId ); 228 if ( !mData->productId.isEmpty() ) l.append(mData->productId );
229 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); 229 if ( !mData->sortString.isEmpty() ) l.append( mData->sortString );
230 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); 230 if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString());
231 // if ( !mData->logo.isEmpty() ) l.append( ); 231 // if ( !mData->logo.isEmpty() ) l.append( );
232 //if ( !mData->photo.isEmpty() ) l.append( ); 232 //if ( !mData->photo.isEmpty() ) l.append( );
233 //if ( !mData->sound.isEmpty() ) l.append( ); 233 //if ( !mData->sound.isEmpty() ) l.append( );
234 //if ( !mData->agent.isEmpty() ) l.append( ); 234 //if ( !mData->agent.isEmpty() ) l.append( );
235 if ( mData->url.isValid() ) 235 if ( mData->url.isValid() )
236 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); 236 if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() );
237 KABC::PhoneNumber::List phoneNumbers; 237 KABC::PhoneNumber::List phoneNumbers;
238 KABC::PhoneNumber::List::Iterator phoneIter; 238 KABC::PhoneNumber::List::Iterator phoneIter;
239 239
240 QStringList t; 240 QStringList t;
241 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 241 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
242 ++phoneIter ) 242 ++phoneIter )
243 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); 243 t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) );
244 t.sort(); 244 t.sort();
245 uint iii; 245 uint iii;
246 for ( iii = 0; iii < t.count(); ++iii) 246 for ( iii = 0; iii < t.count(); ++iii)
247 l.append( t[iii] ); 247 l.append( t[iii] );
248 t = mData->emails; 248 t = mData->emails;
249 t.sort(); 249 t.sort();
250 for ( iii = 0; iii < t.count(); ++iii) 250 for ( iii = 0; iii < t.count(); ++iii)
251 l.append( t[iii] ); 251 l.append( t[iii] );
252 t = mData->categories; 252 t = mData->categories;
253 t.sort(); 253 t.sort();
254 for ( iii = 0; iii < t.count(); ++iii) 254 for ( iii = 0; iii < t.count(); ++iii)
255 l.append( t[iii] ); 255 l.append( t[iii] );
256 t = mData->custom; 256 t = mData->custom;
257 t.sort(); 257 t.sort();
258 for ( iii = 0; iii < t.count(); ++iii) 258 for ( iii = 0; iii < t.count(); ++iii)
259 if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) { 259 if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) {
260 int find = t[iii].find (':')+1; 260 int find = t[iii].find (':')+1;
261 //qDebug("lennnn %d %d ", find, t[iii].length()); 261 //qDebug("lennnn %d %d ", find, t[iii].length());
262 if ( find < t[iii].length()) 262 if ( find < t[iii].length())
263 l.append( t[iii] ); 263 l.append( t[iii] );
264 264
265 } 265 }
266 KABC::Address::List::Iterator addressIter; 266 KABC::Address::List::Iterator addressIter;
267 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 267 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
268 ++addressIter ) { 268 ++addressIter ) {
269 t = (*addressIter).asList(); 269 t = (*addressIter).asList();
270 t.sort(); 270 t.sort();
271 for ( iii = 0; iii < t.count(); ++iii) 271 for ( iii = 0; iii < t.count(); ++iii)
272 l.append( t[iii] ); 272 l.append( t[iii] );
273 } 273 }
274 uint cs = getCsum4List(l); 274 uint cs = getCsum4List(l);
275 275
276#if 0 276#if 0
277 for ( iii = 0; iii < l.count(); ++iii) 277 for ( iii = 0; iii < l.count(); ++iii)
278 qDebug("%d***%s***",iii,l[iii].latin1()); 278 qDebug("%d***%s***",iii,l[iii].latin1());
279 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); 279 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
280#endif 280#endif
281 281
282 setCsum( dev, QString::number (cs )); 282 setCsum( dev, QString::number (cs ));
283} 283}
284 284
285void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) 285void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
286{ 286{
287 // merge all standard non-outlook fields. 287 // merge all standard non-outlook fields.
288 //if isSubSet (e.g. mobile phone sync) merge all fields 288 //if isSubSet (e.g. mobile phone sync) merge all fields
289 289
290 detach(); 290 detach();
291 if ( isSubSet ) { 291 if ( isSubSet ) {
292 if ( mData->name.isEmpty() ) mData->name = ad.mData->name; 292 if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
293 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; 293 if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
294 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; 294 if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
295 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; 295 if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
296 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; 296 if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
297 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; 297 if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
298 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; 298 if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
299 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 299 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
300 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 300 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
301 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; 301 if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
302 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 302 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
303 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; 303 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
304 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; 304 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
305 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; 305 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
306 if ( !mData->birthday.isValid() ) 306 if ( !mData->birthday.isValid() )
307 if ( ad.mData->birthday.isValid()) 307 if ( ad.mData->birthday.isValid())
308 mData->birthday = ad.mData->birthday; 308 mData->birthday = ad.mData->birthday;
309 309
310 } 310 }
311 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 311 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
312 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 312 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
313 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 313 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
314 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; 314 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
315 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; 315 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
316 QStringList t; 316 QStringList t;
317 QStringList tAD; 317 QStringList tAD;
318 uint iii; 318 uint iii;
319 319
320 // ********** phone numbers 320 // ********** phone numbers
321 if ( isSubSet ) { 321 if ( isSubSet ) {
322 PhoneNumber::List phoneAD = ad.phoneNumbers(); 322 PhoneNumber::List phoneAD = ad.phoneNumbers();
323 PhoneNumber::List::Iterator phoneItAD; 323 PhoneNumber::List::Iterator phoneItAD;
324 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { 324 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
325 bool found = false; 325 bool found = false;
326 PhoneNumber::List::Iterator it; 326 PhoneNumber::List::Iterator it;
327 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { 327 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
328 if ( ( *phoneItAD ).contains( (*it) ) ) { 328 if ( ( *phoneItAD ).contains( (*it) ) ) {
329 found = true; 329 found = true;
330 (*it).setType( ( *phoneItAD ).type() ); 330 (*it).setType( ( *phoneItAD ).type() );
331 (*it).setNumber( ( *phoneItAD ).number() ); 331 (*it).setNumber( ( *phoneItAD ).number() );
332 break; 332 break;
333 } 333 }
334 } 334 }
335 // if ( isSubSet && ! found ) 335 // if ( isSubSet && ! found )
336 if ( ! found ) // LR try this one... 336 if ( ! found ) // LR try this one...
337 mData->phoneNumbers.append( *phoneItAD ); 337 mData->phoneNumbers.append( *phoneItAD );
338 } 338 }
339 } else {
340 PhoneNumber::List phoneAD = ad.phoneNumbers();
341 PhoneNumber::List::Iterator phoneItAD;
342 for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
343 bool found = false;
344 PhoneNumber::List::Iterator it;
345 for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
346 if ( ( *phoneItAD ).contains( (*it) ) ) {
347 found = true;
348 (*it).setType( ( *phoneItAD ).type() );
349 (*it).setNumber( ( *phoneItAD ).number() );
350 break;
351 }
352 }
353 if ( ! found ) { // append numbers which do not have work or home type
354 if ( ! ( ( *phoneItAD ).type() & (PhoneNumber::Work | PhoneNumber::Home) ) )
355 mData->phoneNumbers.append( *phoneItAD );
356 }
357 }
339 } 358 }
340 if ( isSubSet ) { 359 if ( isSubSet ) {
341 // ************* emails; 360 // ************* emails;
342 t = mData->emails; 361 t = mData->emails;
343 tAD = ad.mData->emails; 362 tAD = ad.mData->emails;
344 for ( iii = 0; iii < tAD.count(); ++iii) 363 for ( iii = 0; iii < tAD.count(); ++iii)
345 if ( !t.contains(tAD[iii] ) ) 364 if ( !t.contains(tAD[iii] ) )
346 mData->emails.append( tAD[iii] ); 365 mData->emails.append( tAD[iii] );
347 } 366 }
348 367
349 // ************* categories; 368 // ************* categories;
350 if ( isSubSet ) { 369 if ( isSubSet ) {
351 t = mData->categories; 370 t = mData->categories;
352 tAD = ad.mData->categories; 371 tAD = ad.mData->categories;
353 for ( iii = 0; iii < tAD.count(); ++iii) 372 for ( iii = 0; iii < tAD.count(); ++iii)
354 if ( !t.contains(tAD[iii] ) ) 373 if ( !t.contains(tAD[iii] ) )
355 mData->categories.append( tAD[iii] ); 374 mData->categories.append( tAD[iii] );
356 } 375 }
357 QStringList::ConstIterator it; 376 QStringList::ConstIterator it;
358 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { 377 for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) {
359 QString qualifiedName = (*it).left( (*it).find( ":" )); 378 QString qualifiedName = (*it).left( (*it).find( ":" ));
360 bool found = false; 379 bool found = false;
361 QStringList::ConstIterator itL; 380 QStringList::ConstIterator itL;
362 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { 381 for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) {
363 if ( (*itL).startsWith( qualifiedName ) ) { 382 if ( (*itL).startsWith( qualifiedName ) ) {
364 found = true; 383 found = true;
365 break; 384 break;
366 } 385 }
367 } 386 }
368 if ( ! found ) { 387 if ( ! found ) {
369 mData->custom.append( *it ); 388 mData->custom.append( *it );
370 } 389 }
371 } 390 }
372 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; 391 if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo;
373 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; 392 if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo;
374 if ( !mData->sound.isIntern() ) { 393 if ( !mData->sound.isIntern() ) {
375 if ( mData->sound.url().isEmpty() ) { 394 if ( mData->sound.url().isEmpty() ) {
376 mData->sound = ad.mData->sound; 395 mData->sound = ad.mData->sound;
377 } 396 }
378 } 397 }
379 if ( !mData->agent.isIntern() ) { 398 if ( !mData->agent.isIntern() ) {
380 if ( mData->agent.url().isEmpty() ) { 399 if ( mData->agent.url().isEmpty() ) {
381 mData->agent = ad.mData->agent; 400 mData->agent = ad.mData->agent;
382 } 401 }
383 } 402 }
384 { 403 {
385 Key::List::Iterator itA; 404 Key::List::Iterator itA;
386 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { 405 for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) {
387 bool found = false; 406 bool found = false;
388 Key::List::Iterator it; 407 Key::List::Iterator it;
389 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { 408 for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) {
390 if ( (*it) == (*itA)) { 409 if ( (*it) == (*itA)) {
391 found = true; 410 found = true;
392 break; 411 break;
393 412
394 } 413 }
395 } 414 }
396 if ( ! found ) { 415 if ( ! found ) {
397 mData->keys.append( *itA ); 416 mData->keys.append( *itA );
398 } 417 }
399 } 418 }
400 } 419 }
401 if ( isSubSet ) { 420 if ( isSubSet ) {
402 KABC::Address::List::Iterator addressIterA; 421 KABC::Address::List::Iterator addressIterA;
403 for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { 422 for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) {
404 bool found = false; 423 bool found = false;
405 KABC::Address::List::Iterator addressIter; 424 KABC::Address::List::Iterator addressIter;
406 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); 425 for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
407 ++addressIter ) { 426 ++addressIter ) {
408 if ( (*addressIter) == (*addressIterA)) { 427 if ( (*addressIter) == (*addressIterA)) {
409 found = true; 428 found = true;
410 (*addressIter).setType( (*addressIterA).type() ); 429 (*addressIter).setType( (*addressIterA).type() );
411 break; 430 break;
412 } 431 }
413 432
414 } 433 }
415 if ( isSubSet && ! found ) { 434 if ( isSubSet && ! found ) {
416 mData->addresses.append( *addressIterA ); 435 mData->addresses.append( *addressIterA );
417 } 436 }
418 } 437 }
419 } 438 }
420 //qDebug("merge contact %s ", ad.uid().latin1()); 439 //qDebug("merge contact %s ", ad.uid().latin1());
421 setUid( ad.uid() ); 440 setUid( ad.uid() );
422 setRevision( ad.revision() ); 441 setRevision( ad.revision() );
423} 442}
424 443
425bool Addressee::removeVoice() 444bool Addressee::removeVoice()
426{ 445{
427 PhoneNumber::List phoneN = phoneNumbers(); 446 PhoneNumber::List phoneN = phoneNumbers();
428 PhoneNumber::List::Iterator phoneIt; 447 PhoneNumber::List::Iterator phoneIt;
429 bool found = false; 448 bool found = false;
430 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { 449 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
431 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 450 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
432 if ((*phoneIt).type() - PhoneNumber::Voice ) { 451 if ((*phoneIt).type() - PhoneNumber::Voice ) {
433 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 452 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
434 insertPhoneNumber( (*phoneIt) ); 453 insertPhoneNumber( (*phoneIt) );
435 found = true; 454 found = true;
436 } 455 }
437 } 456 }
438 457
439 } 458 }
440 return found; 459 return found;
441} 460}
442 461
443bool Addressee::containsAdr(const Addressee& ad ) 462bool Addressee::containsAdr(const Addressee& ad )
444{ 463{
445 if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; 464 if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false;
446 if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; 465 if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false;
447 if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; 466 if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ;
448 if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; 467 if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ;
449 if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; 468 if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ;
450 if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; 469 if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ;
451 if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; 470 if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ;
452 471
453 // compare phone numbers 472 // compare phone numbers
454 PhoneNumber::List phoneN = ad.phoneNumbers(); 473 PhoneNumber::List phoneN = ad.phoneNumbers();
455 PhoneNumber::List::Iterator phoneIt; 474 PhoneNumber::List::Iterator phoneIt;
456 bool found = false; 475 bool found = false;
457 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { 476 for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
458 bool found = false; 477 bool found = false;
459 PhoneNumber::List phoneL = ad.phoneNumbers(); 478 PhoneNumber::List phoneL = ad.phoneNumbers();
460 PhoneNumber::List::Iterator phoneItL; 479 PhoneNumber::List::Iterator phoneItL;
461 for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { 480 for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) {
462 if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { 481 if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) {
463 found = true; 482 found = true;
464 break; 483 break;
465 } 484 }
466 } 485 }
467 if ( ! found ) 486 if ( ! found )
468 return false; 487 return false;
469 } 488 }
470 return true; 489 return true;
471 490
472} 491}
473void Addressee::simplifyAddresses() 492void Addressee::simplifyAddresses()
474{ 493{
475 494
476 495
477 Address::List list; 496 Address::List list;
478 Address::List::Iterator it; 497 Address::List::Iterator it;
479 Address::List::Iterator it2; 498 Address::List::Iterator it2;
480 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 499 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
481 it2 = it; 500 it2 = it;
482 ++it2; 501 ++it2;
483 for( ; it2 != mData->addresses.end(); ++it2 ) { 502 for( ; it2 != mData->addresses.end(); ++it2 ) {
484 if ( (*it) == (*it2) ) { 503 if ( (*it) == (*it2) ) {
485 list.append( *it ); 504 list.append( *it );
486 break; 505 break;
487 } 506 }
488 } 507 }
489 } 508 }
490 for( it = list.begin(); it != list.end(); ++it ) { 509 for( it = list.begin(); it != list.end(); ++it ) {
491 removeAddress( (*it) ); 510 removeAddress( (*it) );
492 } 511 }
493 512
494 list.clear(); 513 list.clear();
495 int max = 2; 514 int max = 2;
496 if ( mData->url.isValid() ) 515 if ( mData->url.isValid() )
497 max = 1; 516 max = 1;
498 if ( mData->addresses.count() <= max ) return ; 517 if ( mData->addresses.count() <= max ) return ;
499 int count = 0; 518 int count = 0;
500 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 519 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
501 if ( count >= max ) 520 if ( count >= max )
502 list.append( *it ); 521 list.append( *it );
503 ++count; 522 ++count;
504 } 523 }
505 for( it = list.begin(); it != list.end(); ++it ) { 524 for( it = list.begin(); it != list.end(); ++it ) {
506 removeAddress( (*it) ); 525 removeAddress( (*it) );
507 } 526 }
508} 527}
509 528
510// removes all emails but the first 529// removes all emails but the first
511// needed by phone sync 530// needed by phone sync
512void Addressee::simplifyEmails() 531void Addressee::simplifyEmails()
513{ 532{
514 if ( mData->emails.count() == 0 ) return ; 533 if ( mData->emails.count() == 0 ) return ;
515 QString email = mData->emails.first(); 534 QString email = mData->emails.first();
516 detach(); 535 detach();
517 mData->emails.clear(); 536 mData->emails.clear();
518 mData->emails.append( email ); 537 mData->emails.append( email );
519} 538}
520 539
521void Addressee::simplifyPhoneNumbers() 540void Addressee::simplifyPhoneNumbers()
522{ 541{
523 int max = 4; 542 int max = 4;
524 int inList = mData->phoneNumbers.count(); 543 int inList = mData->phoneNumbers.count();
525 KABC::PhoneNumber::List removeNumbers; 544 KABC::PhoneNumber::List removeNumbers;
526 KABC::PhoneNumber::List::Iterator phoneIter; 545 KABC::PhoneNumber::List::Iterator phoneIter;
527 if ( inList > max ) { 546 if ( inList > max ) {
528 // delete non-preferred numbers 547 // delete non-preferred numbers
529 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 548 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
530 ++phoneIter ) { 549 ++phoneIter ) {
531 if ( inList > max ) { 550 if ( inList > max ) {
532 if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { 551 if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) {
533 removeNumbers.append( ( *phoneIter ) ); 552 removeNumbers.append( ( *phoneIter ) );
534 --inList; 553 --inList;
535 } 554 }
536 } else 555 } else
537 break; 556 break;
538 } 557 }
539 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 558 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
540 ++phoneIter ) { 559 ++phoneIter ) {
541 removePhoneNumber(( *phoneIter )); 560 removePhoneNumber(( *phoneIter ));
542 } 561 }
543 // delete preferred numbers 562 // delete preferred numbers
544 if ( inList > max ) { 563 if ( inList > max ) {
545 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 564 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
546 ++phoneIter ) { 565 ++phoneIter ) {
547 if ( inList > max ) { 566 if ( inList > max ) {
548 removeNumbers.append( ( *phoneIter ) ); 567 removeNumbers.append( ( *phoneIter ) );
549 --inList; 568 --inList;
550 } else 569 } else
551 break; 570 break;
552 } 571 }
553 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 572 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
554 ++phoneIter ) { 573 ++phoneIter ) {
555 removePhoneNumber(( *phoneIter )); 574 removePhoneNumber(( *phoneIter ));
556 } 575 }
557 } 576 }
558 } 577 }
559 // remove non-numeric characters 578 // remove non-numeric characters
560 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 579 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
561 ++phoneIter ) { 580 ++phoneIter ) {
562 if ( ! ( *phoneIter ).simplifyNumber() ) 581 if ( ! ( *phoneIter ).simplifyNumber() )
563 removeNumbers.append( ( *phoneIter ) ); 582 removeNumbers.append( ( *phoneIter ) );
564 } 583 }
565 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 584 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
566 ++phoneIter ) { 585 ++phoneIter ) {
567 removePhoneNumber(( *phoneIter )); 586 removePhoneNumber(( *phoneIter ));
568 } 587 }
569} 588}
570void Addressee::simplifyPhoneNumberTypes() 589void Addressee::simplifyPhoneNumberTypes()
571{ 590{
572 KABC::PhoneNumber::List::Iterator phoneIter; 591 KABC::PhoneNumber::List::Iterator phoneIter;
573 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 592 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
574 ++phoneIter ) 593 ++phoneIter )
575 ( *phoneIter ).simplifyType(); 594 ( *phoneIter ).simplifyType();
576} 595}
577void Addressee::removeID(const QString &prof) 596void Addressee::removeID(const QString &prof)
578{ 597{
579 detach(); 598 detach();
580 if ( prof.isEmpty() ) 599 if ( prof.isEmpty() )
581 mData->mExternalId = ":"; 600 mData->mExternalId = ":";
582 else 601 else
583 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 602 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
584 603
585} 604}
586void Addressee::setID( const QString & prof , const QString & id ) 605void Addressee::setID( const QString & prof , const QString & id )
587{ 606{
588 detach(); 607 detach();
589 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 608 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
590 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 609 //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
591} 610}
592void Addressee::setTempSyncStat( int id ) 611void Addressee::setTempSyncStat( int id )
593{ 612{
594 if ( mData->mTempSyncStat == id ) return; 613 if ( mData->mTempSyncStat == id ) return;
595 detach(); 614 detach();
596 mData->mTempSyncStat = id; 615 mData->mTempSyncStat = id;
597} 616}
598int Addressee::tempSyncStat() const 617int Addressee::tempSyncStat() const
599{ 618{
600 return mData->mTempSyncStat; 619 return mData->mTempSyncStat;
601} 620}
602 621
603const QString Addressee::getID( const QString & prof) const 622const QString Addressee::getID( const QString & prof) const
604{ 623{
605 return KIdManager::getId ( mData->mExternalId, prof ); 624 return KIdManager::getId ( mData->mExternalId, prof );
606} 625}
607 626
608void Addressee::setCsum( const QString & prof , const QString & id ) 627void Addressee::setCsum( const QString & prof , const QString & id )
609{ 628{
610 detach(); 629 detach();
611 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); 630 //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
612 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); 631 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
613 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); 632 //qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
614} 633}
615 634
616const QString Addressee::getCsum( const QString & prof) const 635const QString Addressee::getCsum( const QString & prof) const
617{ 636{
618 return KIdManager::getCsum ( mData->mExternalId, prof ); 637 return KIdManager::getCsum ( mData->mExternalId, prof );
619} 638}
620 639
621void Addressee::setIDStr( const QString & s ) 640void Addressee::setIDStr( const QString & s )
622{ 641{
623 detach(); 642 detach();
624 mData->mExternalId = s; 643 mData->mExternalId = s;
625} 644}
626 645
627const QString Addressee::IDStr() const 646const QString Addressee::IDStr() const
628{ 647{
629 return mData->mExternalId; 648 return mData->mExternalId;
630} 649}
631 650
632void Addressee::setExternalUID( const QString &id ) 651void Addressee::setExternalUID( const QString &id )
633{ 652{
634 if ( id == mData->externalUID ) return; 653 if ( id == mData->externalUID ) return;
635 detach(); 654 detach();
636 mData->empty = false; 655 mData->empty = false;
637 mData->externalUID = id; 656 mData->externalUID = id;
638} 657}
639 658
640const QString Addressee::externalUID() const 659const QString Addressee::externalUID() const
641{ 660{
642 return mData->externalUID; 661 return mData->externalUID;
643} 662}
644void Addressee::setOriginalExternalUID( const QString &id ) 663void Addressee::setOriginalExternalUID( const QString &id )
645{ 664{
646 if ( id == mData->originalExternalUID ) return; 665 if ( id == mData->originalExternalUID ) return;
647 detach(); 666 detach();
648 mData->empty = false; 667 mData->empty = false;
649 //qDebug("*******Set orig uid %s ", id.latin1()); 668 //qDebug("*******Set orig uid %s ", id.latin1());
650 mData->originalExternalUID = id; 669 mData->originalExternalUID = id;
651} 670}
652 671
653QString Addressee::originalExternalUID() const 672QString Addressee::originalExternalUID() const
654{ 673{
655 return mData->originalExternalUID; 674 return mData->originalExternalUID;
656} 675}
657 676
658void Addressee::setUid( const QString &id ) 677void Addressee::setUid( const QString &id )
659{ 678{
660 if ( id == mData->uid ) return; 679 if ( id == mData->uid ) return;
661 detach(); 680 detach();
662 //qDebug("****setuid %s ", id.latin1()); 681 //qDebug("****setuid %s ", id.latin1());
663 mData->empty = false; 682 mData->empty = false;
664 mData->uid = id; 683 mData->uid = id;
665} 684}
666 685
667const QString Addressee::uid() const 686const QString Addressee::uid() const
668{ 687{
669 if ( mData->uid.isEmpty() ) 688 if ( mData->uid.isEmpty() )
670 mData->uid = KApplication::randomString( 10 ); 689 mData->uid = KApplication::randomString( 10 );
671 690
672 return mData->uid; 691 return mData->uid;
673} 692}
674 693
675QString Addressee::uidLabel() 694QString Addressee::uidLabel()
676{ 695{
677 return i18n("Unique Identifier"); 696 return i18n("Unique Identifier");
678} 697}
679 698
680void Addressee::setName( const QString &name ) 699void Addressee::setName( const QString &name )
681{ 700{
682 if ( name == mData->name ) return; 701 if ( name == mData->name ) return;
683 detach(); 702 detach();
684 mData->empty = false; 703 mData->empty = false;
685 mData->name = name; 704 mData->name = name;
686} 705}
687 706
688QString Addressee::name() const 707QString Addressee::name() const
689{ 708{
690 return mData->name; 709 return mData->name;
691} 710}
692 711
693QString Addressee::nameLabel() 712QString Addressee::nameLabel()
694{ 713{
695 return i18n("Name"); 714 return i18n("Name");
696} 715}
697 716
698 717
699void Addressee::setFormattedName( const QString &formattedName ) 718void Addressee::setFormattedName( const QString &formattedName )
700{ 719{
701 if ( formattedName == mData->formattedName ) return; 720 if ( formattedName == mData->formattedName ) return;
702 detach(); 721 detach();
703 mData->empty = false; 722 mData->empty = false;
704 mData->formattedName = formattedName; 723 mData->formattedName = formattedName;
705} 724}
706 725
707QString Addressee::formattedName() const 726QString Addressee::formattedName() const
708{ 727{
709 return mData->formattedName; 728 return mData->formattedName;
710} 729}
711 730
712QString Addressee::formattedNameLabel() 731QString Addressee::formattedNameLabel()
713{ 732{
714 return i18n("Formatted Name"); 733 return i18n("Formatted Name");
715} 734}
716 735
717 736
718void Addressee::setFamilyName( const QString &familyName ) 737void Addressee::setFamilyName( const QString &familyName )
719{ 738{
720 if ( familyName == mData->familyName ) return; 739 if ( familyName == mData->familyName ) return;
721 detach(); 740 detach();
722 mData->empty = false; 741 mData->empty = false;
723 mData->familyName = familyName; 742 mData->familyName = familyName;
724} 743}
725 744
726QString Addressee::familyName() const 745QString Addressee::familyName() const
727{ 746{
728 return mData->familyName; 747 return mData->familyName;
729} 748}
730 749
731QString Addressee::familyNameLabel() 750QString Addressee::familyNameLabel()
732{ 751{
733 return i18n("Family Name"); 752 return i18n("Family Name");
734} 753}
735 754
736 755
737void Addressee::setGivenName( const QString &givenName ) 756void Addressee::setGivenName( const QString &givenName )
738{ 757{
739 if ( givenName == mData->givenName ) return; 758 if ( givenName == mData->givenName ) return;
740 detach(); 759 detach();
741 mData->empty = false; 760 mData->empty = false;
742 mData->givenName = givenName; 761 mData->givenName = givenName;
743} 762}
744 763
745QString Addressee::givenName() const 764QString Addressee::givenName() const
746{ 765{
747 return mData->givenName; 766 return mData->givenName;
748} 767}
749 768
750QString Addressee::givenNameLabel() 769QString Addressee::givenNameLabel()
751{ 770{
752 return i18n("Given Name"); 771 return i18n("Given Name");
753} 772}
754 773
755 774
756void Addressee::setAdditionalName( const QString &additionalName ) 775void Addressee::setAdditionalName( const QString &additionalName )
757{ 776{
758 if ( additionalName == mData->additionalName ) return; 777 if ( additionalName == mData->additionalName ) return;
759 detach(); 778 detach();
760 mData->empty = false; 779 mData->empty = false;
761 mData->additionalName = additionalName; 780 mData->additionalName = additionalName;
762} 781}
763 782
764QString Addressee::additionalName() const 783QString Addressee::additionalName() const
765{ 784{
766 return mData->additionalName; 785 return mData->additionalName;
767} 786}
768 787
769QString Addressee::additionalNameLabel() 788QString Addressee::additionalNameLabel()
770{ 789{
771 return i18n("Additional Names"); 790 return i18n("Additional Names");
772} 791}
773 792
774 793
775void Addressee::setPrefix( const QString &prefix ) 794void Addressee::setPrefix( const QString &prefix )
776{ 795{
777 if ( prefix == mData->prefix ) return; 796 if ( prefix == mData->prefix ) return;
778 detach(); 797 detach();
779 mData->empty = false; 798 mData->empty = false;
780 mData->prefix = prefix; 799 mData->prefix = prefix;
781} 800}
782 801
783QString Addressee::prefix() const 802QString Addressee::prefix() const
784{ 803{
785 return mData->prefix; 804 return mData->prefix;
786} 805}
787 806
788QString Addressee::prefixLabel() 807QString Addressee::prefixLabel()
789{ 808{
790 return i18n("Honorific Prefixes"); 809 return i18n("Honorific Prefixes");
791} 810}
792 811
793 812
794void Addressee::setSuffix( const QString &suffix ) 813void Addressee::setSuffix( const QString &suffix )
795{ 814{
796 if ( suffix == mData->suffix ) return; 815 if ( suffix == mData->suffix ) return;
797 detach(); 816 detach();
798 mData->empty = false; 817 mData->empty = false;
799 mData->suffix = suffix; 818 mData->suffix = suffix;
800} 819}
801 820
802QString Addressee::suffix() const 821QString Addressee::suffix() const
803{ 822{
804 return mData->suffix; 823 return mData->suffix;
805} 824}
806 825
807QString Addressee::suffixLabel() 826QString Addressee::suffixLabel()
808{ 827{
809 return i18n("Honorific Suffixes"); 828 return i18n("Honorific Suffixes");
810} 829}
811 830
812 831
813void Addressee::setNickName( const QString &nickName ) 832void Addressee::setNickName( const QString &nickName )
814{ 833{
815 if ( nickName == mData->nickName ) return; 834 if ( nickName == mData->nickName ) return;
816 detach(); 835 detach();
817 mData->empty = false; 836 mData->empty = false;
818 mData->nickName = nickName; 837 mData->nickName = nickName;
819} 838}
820 839
821QString Addressee::nickName() const 840QString Addressee::nickName() const
822{ 841{
823 return mData->nickName; 842 return mData->nickName;
824} 843}
825 844
826QString Addressee::nickNameLabel() 845QString Addressee::nickNameLabel()
827{ 846{
828 return i18n("Nick Name"); 847 return i18n("Nick Name");
829} 848}
830 849
831 850
832void Addressee::setBirthday( const QDateTime &birthday ) 851void Addressee::setBirthday( const QDateTime &birthday )
833{ 852{
834 if ( birthday == mData->birthday ) return; 853 if ( birthday == mData->birthday ) return;
835 detach(); 854 detach();
836 mData->empty = false; 855 mData->empty = false;
837 mData->birthday = birthday; 856 mData->birthday = birthday;
838} 857}
839 858
840QDateTime Addressee::birthday() const 859QDateTime Addressee::birthday() const
841{ 860{
842 return mData->birthday; 861 return mData->birthday;
843} 862}
844 863
845QString Addressee::birthdayLabel() 864QString Addressee::birthdayLabel()
846{ 865{
847 return i18n("Birthday"); 866 return i18n("Birthday");
848} 867}
849 868
850 869
851QString Addressee::homeAddressStreetLabel() 870QString Addressee::homeAddressStreetLabel()
852{ 871{
853 return i18n("Home Address Street"); 872 return i18n("Home Address Street");
854} 873}
855 874
856 875
857QString Addressee::homeAddressLocalityLabel() 876QString Addressee::homeAddressLocalityLabel()
858{ 877{
859 return i18n("Home Address Locality"); 878 return i18n("Home Address Locality");
860} 879}
861 880
862 881
863QString Addressee::homeAddressRegionLabel() 882QString Addressee::homeAddressRegionLabel()
864{ 883{
865 return i18n("Home Address Region"); 884 return i18n("Home Address Region");
866} 885}
867 886
868 887
869QString Addressee::homeAddressPostalCodeLabel() 888QString Addressee::homeAddressPostalCodeLabel()
870{ 889{
871 return i18n("Home Address Postal Code"); 890 return i18n("Home Address Postal Code");
872} 891}
873 892
874 893
875QString Addressee::homeAddressCountryLabel() 894QString Addressee::homeAddressCountryLabel()
876{ 895{
877 return i18n("Home Address Country"); 896 return i18n("Home Address Country");
878} 897}
879 898
880 899
881QString Addressee::homeAddressLabelLabel() 900QString Addressee::homeAddressLabelLabel()
882{ 901{
883 return i18n("Home Address Label"); 902 return i18n("Home Address Label");
884} 903}
885 904
886 905
887QString Addressee::businessAddressStreetLabel() 906QString Addressee::businessAddressStreetLabel()
888{ 907{
889 return i18n("Business Address Street"); 908 return i18n("Business Address Street");
890} 909}
891 910
892 911
893QString Addressee::businessAddressLocalityLabel() 912QString Addressee::businessAddressLocalityLabel()
894{ 913{
895 return i18n("Business Address Locality"); 914 return i18n("Business Address Locality");
896} 915}
897 916
898 917
899QString Addressee::businessAddressRegionLabel() 918QString Addressee::businessAddressRegionLabel()
900{ 919{
901 return i18n("Business Address Region"); 920 return i18n("Business Address Region");
902} 921}
903 922
904 923
905QString Addressee::businessAddressPostalCodeLabel() 924QString Addressee::businessAddressPostalCodeLabel()
906{ 925{
907 return i18n("Business Address Postal Code"); 926 return i18n("Business Address Postal Code");
908} 927}
909 928
910 929
911QString Addressee::businessAddressCountryLabel() 930QString Addressee::businessAddressCountryLabel()
912{ 931{
913 return i18n("Business Address Country"); 932 return i18n("Business Address Country");
914} 933}
915 934
916 935
917QString Addressee::businessAddressLabelLabel() 936QString Addressee::businessAddressLabelLabel()
918{ 937{
919 return i18n("Business Address Label"); 938 return i18n("Business Address Label");
920} 939}
921 940
922 941
923QString Addressee::homePhoneLabel() 942QString Addressee::homePhoneLabel()
924{ 943{
925 return i18n("Home Phone"); 944 return i18n("Home Phone");
926} 945}
927 946
928 947
929QString Addressee::businessPhoneLabel() 948QString Addressee::businessPhoneLabel()
930{ 949{
931 return i18n("Business Phone"); 950 return i18n("Business Phone");
932} 951}
933 952
934 953
935QString Addressee::mobilePhoneLabel() 954QString Addressee::mobilePhoneLabel()
936{ 955{
937 return i18n("Mobile Phone"); 956 return i18n("Mobile Phone");
938} 957}
939 958
940 959
941QString Addressee::homeFaxLabel() 960QString Addressee::homeFaxLabel()
942{ 961{
943 return i18n("Home Fax"); 962 return i18n("Home Fax");
944} 963}
945 964
946 965
947QString Addressee::businessFaxLabel() 966QString Addressee::businessFaxLabel()
948{ 967{
949 return i18n("Business Fax"); 968 return i18n("Business Fax");
950} 969}
951 970
952 971
953QString Addressee::carPhoneLabel() 972QString Addressee::carPhoneLabel()
954{ 973{
955 return i18n("Car Phone"); 974 return i18n("Car Phone");
956} 975}
957 976
958 977
959QString Addressee::isdnLabel() 978QString Addressee::isdnLabel()
960{ 979{
961 return i18n("ISDN"); 980 return i18n("ISDN");
962} 981}
963 982
964 983
965QString Addressee::pagerLabel() 984QString Addressee::pagerLabel()
966{ 985{
967 return i18n("Pager"); 986 return i18n("Pager");
968} 987}
969 988
970QString Addressee::sipLabel() 989QString Addressee::sipLabel()
971{ 990{
972 return i18n("SIP"); 991 return i18n("SIP");
973} 992}
974 993
975QString Addressee::emailLabel() 994QString Addressee::emailLabel()
976{ 995{
977 return i18n("Email Address"); 996 return i18n("Email Address");
978} 997}
979 998
980 999
981void Addressee::setMailer( const QString &mailer ) 1000void Addressee::setMailer( const QString &mailer )
982{ 1001{
983 if ( mailer == mData->mailer ) return; 1002 if ( mailer == mData->mailer ) return;
984 detach(); 1003 detach();
985 mData->empty = false; 1004 mData->empty = false;
986 mData->mailer = mailer; 1005 mData->mailer = mailer;
987} 1006}
988 1007
989QString Addressee::mailer() const 1008QString Addressee::mailer() const
990{ 1009{
991 return mData->mailer; 1010 return mData->mailer;
992} 1011}
993 1012
994QString Addressee::mailerLabel() 1013QString Addressee::mailerLabel()
995{ 1014{
996 return i18n("Mail Client"); 1015 return i18n("Mail Client");
997} 1016}
998 1017
999 1018
1000void Addressee::setTimeZone( const TimeZone &timeZone ) 1019void Addressee::setTimeZone( const TimeZone &timeZone )
1001{ 1020{
1002 if ( timeZone == mData->timeZone ) return; 1021 if ( timeZone == mData->timeZone ) return;
1003 detach(); 1022 detach();
1004 mData->empty = false; 1023 mData->empty = false;
1005 mData->timeZone = timeZone; 1024 mData->timeZone = timeZone;
1006} 1025}
1007 1026
1008TimeZone Addressee::timeZone() const 1027TimeZone Addressee::timeZone() const
1009{ 1028{
1010 return mData->timeZone; 1029 return mData->timeZone;
1011} 1030}
1012 1031
1013QString Addressee::timeZoneLabel() 1032QString Addressee::timeZoneLabel()
1014{ 1033{
1015 return i18n("Time Zone"); 1034 return i18n("Time Zone");
1016} 1035}
1017 1036
1018 1037
1019void Addressee::setGeo( const Geo &geo ) 1038void Addressee::setGeo( const Geo &geo )
1020{ 1039{
1021 if ( geo == mData->geo ) return; 1040 if ( geo == mData->geo ) return;
1022 detach(); 1041 detach();
1023 mData->empty = false; 1042 mData->empty = false;
1024 mData->geo = geo; 1043 mData->geo = geo;
1025} 1044}
1026 1045
1027Geo Addressee::geo() const 1046Geo Addressee::geo() const
1028{ 1047{
1029 return mData->geo; 1048 return mData->geo;
1030} 1049}
1031 1050
1032QString Addressee::geoLabel() 1051QString Addressee::geoLabel()
1033{ 1052{
1034 return i18n("Geographic Position"); 1053 return i18n("Geographic Position");
1035} 1054}
1036 1055
1037 1056
1038void Addressee::setTitle( const QString &title ) 1057void Addressee::setTitle( const QString &title )
1039{ 1058{
1040 if ( title == mData->title ) return; 1059 if ( title == mData->title ) return;
1041 detach(); 1060 detach();
1042 mData->empty = false; 1061 mData->empty = false;
1043 mData->title = title; 1062 mData->title = title;
1044} 1063}
1045 1064
1046QString Addressee::title() const 1065QString Addressee::title() const
1047{ 1066{
1048 return mData->title; 1067 return mData->title;
1049} 1068}
1050 1069
1051QString Addressee::titleLabel() 1070QString Addressee::titleLabel()
1052{ 1071{
1053 return i18n("Title"); 1072 return i18n("Title");
1054} 1073}
1055 1074
1056 1075
1057void Addressee::setRole( const QString &role ) 1076void Addressee::setRole( const QString &role )
1058{ 1077{
1059 if ( role == mData->role ) return; 1078 if ( role == mData->role ) return;
1060 detach(); 1079 detach();
1061 mData->empty = false; 1080 mData->empty = false;
1062 mData->role = role; 1081 mData->role = role;
1063} 1082}
1064 1083
1065QString Addressee::role() const 1084QString Addressee::role() const
1066{ 1085{
1067 return mData->role; 1086 return mData->role;
1068} 1087}
1069 1088
1070QString Addressee::roleLabel() 1089QString Addressee::roleLabel()
1071{ 1090{
1072 return i18n("Role"); 1091 return i18n("Role");
1073} 1092}
1074 1093
1075 1094
1076void Addressee::setOrganization( const QString &organization ) 1095void Addressee::setOrganization( const QString &organization )
1077{ 1096{
1078 if ( organization == mData->organization ) return; 1097 if ( organization == mData->organization ) return;
1079 detach(); 1098 detach();
1080 mData->empty = false; 1099 mData->empty = false;
1081 mData->organization = organization; 1100 mData->organization = organization;
1082} 1101}
1083 1102
1084QString Addressee::organization() const 1103QString Addressee::organization() const
1085{ 1104{
1086 return mData->organization; 1105 return mData->organization;
1087} 1106}
1088 1107
1089QString Addressee::organizationLabel() 1108QString Addressee::organizationLabel()
1090{ 1109{
1091 return i18n("Organization"); 1110 return i18n("Organization");
1092} 1111}
1093 1112
1094 1113
1095void Addressee::setNote( const QString &note ) 1114void Addressee::setNote( const QString &note )
1096{ 1115{
1097 if ( note == mData->note ) return; 1116 if ( note == mData->note ) return;
1098 detach(); 1117 detach();
1099 mData->empty = false; 1118 mData->empty = false;
1100 mData->note = note; 1119 mData->note = note;
1101} 1120}
1102 1121
1103QString Addressee::note() const 1122QString Addressee::note() const
1104{ 1123{
1105 return mData->note; 1124 return mData->note;
1106} 1125}