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