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