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