summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-11-12 23:42:08 (UTC)
committer zautrix <zautrix>2005-11-12 23:42:08 (UTC)
commit4145dc4a513d5899d8a2b9e4573d8140d871b386 (patch) (unidiff)
tree11bb2010757a65d90c2ed7e4d40d4e72d218eeb9
parent9e47202fd38512cc523c09cf8878f4c5d836e777 (diff)
downloadkdepimpi-4145dc4a513d5899d8a2b9e4573d8140d871b386.zip
kdepimpi-4145dc4a513d5899d8a2b9e4573d8140d871b386.tar.gz
kdepimpi-4145dc4a513d5899d8a2b9e4573d8140d871b386.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcardformatimpl.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp
index 26fd4f0..580c28b 100644
--- a/kabc/vcardformatimpl.cpp
+++ b/kabc/vcardformatimpl.cpp
@@ -1,1035 +1,1039 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include <qfile.h> 28#include <qfile.h>
29#include <qregexp.h> 29#include <qregexp.h>
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <kmdcodec.h> 33#include <kmdcodec.h>
34#include <kstandarddirs.h> 34#include <kstandarddirs.h>
35#include <ktempfile.h> 35#include <ktempfile.h>
36 36
37#include <VCard.h> 37#include <VCard.h>
38 38
39#include "addressbook.h" 39#include "addressbook.h"
40#include "vcardformatimpl.h" 40#include "vcardformatimpl.h"
41 41
42using namespace KABC; 42using namespace KABC;
43using namespace VCARD; 43using namespace VCARD;
44 44
45int VCardFormatImpl::debug = -1; 45int VCardFormatImpl::debug = -1;
46 46
47VCardFormatImpl::VCardFormatImpl() 47VCardFormatImpl::VCardFormatImpl()
48{ 48{
49 debug = (getenv("KABC_DEBUG") != 0); 49 debug = (getenv("KABC_DEBUG") != 0);
50} 50}
51 51
52bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) 52bool VCardFormatImpl::load( Addressee &addressee, QFile *file )
53{ 53{
54 kdDebug(5700) << "VCardFormat::load()" << endl; 54 kdDebug(5700) << "VCardFormat::load()" << endl;
55 55
56 QByteArray fdata = file->readAll(); 56 QByteArray fdata = file->readAll();
57 QCString data(fdata.data(), fdata.size()+1); 57 QCString data(fdata.data(), fdata.size()+1);
58 58
59 VCardEntity e( data ); 59 VCardEntity e( data );
60 60
61 VCardListIterator it( e.cardList() ); 61 VCardListIterator it( e.cardList() );
62 62
63 if ( it.current() ) { 63 if ( it.current() ) {
64//US VCard v(*it.current()); 64//US VCard v(*it.current());
65//US loadAddressee( addressee, v ); 65//US loadAddressee( addressee, v );
66 loadAddressee( addressee, it.current() ); 66 loadAddressee( addressee, it.current() );
67 return true; 67 return true;
68 } 68 }
69 69
70 return false; 70 return false;
71} 71}
72 72
73 73
74#include <kmessagebox.h> 74#include <kmessagebox.h>
75bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) 75bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file )
76{ 76{
77 77
78 QCString data(file->readAll().data(), file->size()+1); 78 QCString data(file->readAll().data(), file->size()+1);
79 VCardEntity e( data ); 79 VCardEntity e( data );
80 80
81 VCardListIterator it( e.cardList() ); 81 VCardListIterator it( e.cardList() );
82 82
83 for (; it.current(); ++it) { 83 for (; it.current(); ++it) {
84//US VCard v(*it.current()); 84//US VCard v(*it.current());
85 Addressee addressee; 85 Addressee addressee;
86//US loadAddressee( addressee, v ); 86//US loadAddressee( addressee, v );
87 loadAddressee( addressee, it.current() ); 87 loadAddressee( addressee, it.current() );
88 addressee.setResource( resource ); 88 addressee.setResource( resource );
89 addressBook->insertAddressee( addressee ); 89 addressBook->insertAddressee( addressee );
90 if (debug == true) 90 if (debug == true)
91 { 91 {
92 printf("address %s loaded successfully\n", addressee.formattedName().latin1()); 92 printf("address %s loaded successfully\n", addressee.formattedName().latin1());
93 } 93 }
94 } 94 }
95 return true; 95 return true;
96} 96}
97 97
98void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) 98void VCardFormatImpl::save( const Addressee &addressee, QFile *file )
99{ 99{
100 VCardEntity vcards; 100 VCardEntity vcards;
101 VCardList vcardlist; 101 VCardList vcardlist;
102 vcardlist.setAutoDelete( true ); 102 vcardlist.setAutoDelete( true );
103 103
104 VCard *v = new VCard; 104 VCard *v = new VCard;
105 105
106 saveAddressee( addressee, v, false ); 106 saveAddressee( addressee, v, false );
107 107
108 vcardlist.append( v ); 108 vcardlist.append( v );
109 vcards.setCardList( vcardlist ); 109 vcards.setCardList( vcardlist );
110 110
111 QCString vcardData = vcards.asString(); 111 QCString vcardData = vcards.asString();
112 file->writeBlock( (const char*)vcardData, vcardData.length() ); 112 file->writeBlock( (const char*)vcardData, vcardData.length() );
113} 113}
114 114
115void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file ) 115void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file )
116{ 116{
117 117
118 AddressBook::Iterator it; 118 AddressBook::Iterator it;
119 for ( it = ab->begin(); it != ab->end(); ++it ) { 119 for ( it = ab->begin(); it != ab->end(); ++it ) {
120 if ( (*it).resource() == resource ) { 120 if ( (*it).resource() == resource ) {
121 save((*it),file); 121 save((*it),file);
122 qApp->processEvents(); 122 qApp->processEvents();
123 (*it).setChanged( false ); 123 (*it).setChanged( false );
124 } 124 }
125 } 125 }
126 // for memory usage status test only 126 // for memory usage status test only
127 // KMessageBox::information ( 0, "Stoppppp", QString("Stop ") ); 127 // KMessageBox::information ( 0, "Stoppppp", QString("Stop ") );
128} 128}
129 129
130bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) 130bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v )
131{ 131{
132 QPtrList<ContentLine> contentLines = v->contentLineList(); 132 QPtrList<ContentLine> contentLines = v->contentLineList();
133 ContentLine *cl; 133 ContentLine *cl;
134 134
135 for( cl = contentLines.first(); cl; cl = contentLines.next() ) { 135 for( cl = contentLines.first(); cl; cl = contentLines.next() ) {
136 QCString n = cl->name(); 136 QCString n = cl->name();
137 if ( n.left( 2 ) == "X-" ) { 137 if ( n.left( 2 ) == "X-" ) {
138 n = n.mid( 2 ); 138 n = n.mid( 2 );
139 int posDash = n.find( "-" ); 139 int posDash = n.find( "-" );
140 addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ), 140 addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ),
141 QString::fromUtf8( n.mid( posDash + 1 ) ), 141 QString::fromUtf8( n.mid( posDash + 1 ) ),
142 QString::fromUtf8( cl->value()->asString() ) ); 142 QString::fromUtf8( cl->value()->asString() ) );
143 continue; 143 continue;
144 } 144 }
145 145
146 EntityType type = cl->entityType(); 146 EntityType type = cl->entityType();
147 switch( type ) { 147 switch( type ) {
148 148
149 case EntityUID: 149 case EntityUID:
150 addressee.setUid( readTextValue( cl ) ); 150 addressee.setUid( readTextValue( cl ) );
151 break; 151 break;
152 152
153 case EntityEmail: 153 case EntityEmail:
154 addressee.insertEmail( readTextValue( cl ) ); 154 addressee.insertEmail( readTextValue( cl ) );
155 break; 155 break;
156 156
157 case EntityName: 157 case EntityName:
158 addressee.setName( readTextValue( cl ) ); 158 addressee.setName( readTextValue( cl ) );
159 break; 159 break;
160 160
161 case EntityFullName: 161 case EntityFullName:
162 addressee.setFormattedName( readTextValue( cl ) ); 162 addressee.setFormattedName( readTextValue( cl ) );
163 break; 163 break;
164 164
165 case EntityURL: 165 case EntityURL:
166 addressee.setUrl( KURL( readTextValue( cl ) ) ); 166 addressee.setUrl( KURL( readTextValue( cl ) ) );
167 break; 167 break;
168 168
169 case EntityNickname: 169 case EntityNickname:
170 addressee.setNickName( readTextValue( cl ) ); 170 addressee.setNickName( readTextValue( cl ) );
171 break; 171 break;
172 172
173 case EntityLabel: 173 case EntityLabel:
174 // not yet supported by kabc 174 // not yet supported by kabc
175 break; 175 break;
176 176
177 case EntityMailer: 177 case EntityMailer:
178 addressee.setMailer( readTextValue( cl ) ); 178 addressee.setMailer( readTextValue( cl ) );
179 break; 179 break;
180 180
181 case EntityTitle: 181 case EntityTitle:
182 addressee.setTitle( readTextValue( cl ) ); 182 addressee.setTitle( readTextValue( cl ) );
183 break; 183 break;
184 184
185 case EntityRole: 185 case EntityRole:
186 addressee.setRole( readTextValue( cl ) ); 186 addressee.setRole( readTextValue( cl ) );
187 break; 187 break;
188 188
189 case EntityOrganisation: 189 case EntityOrganisation:
190 addressee.setOrganization( readTextValue( cl ) ); 190 addressee.setOrganization( readTextValue( cl ) );
191 break; 191 break;
192 192
193 case EntityNote: 193 case EntityNote:
194 addressee.setNote( readTextValue( cl ) ); 194 addressee.setNote( readTextValue( cl ) );
195 break; 195 break;
196 196
197 case EntityProductID: 197 case EntityProductID:
198 addressee.setProductId( readTextValue( cl ) ); 198 addressee.setProductId( readTextValue( cl ) );
199 break; 199 break;
200 200
201 case EntitySortString: 201 case EntitySortString:
202 addressee.setSortString( readTextValue( cl ) ); 202 addressee.setSortString( readTextValue( cl ) );
203 break; 203 break;
204 204
205 case EntityN: 205 case EntityN:
206 readNValue( cl, addressee ); 206 readNValue( cl, addressee );
207 break; 207 break;
208 208
209 case EntityAddress: 209 case EntityAddress:
210 addressee.insertAddress( readAddressValue( cl ) ); 210 addressee.insertAddress( readAddressValue( cl ) );
211 break; 211 break;
212 212
213 case EntityTelephone: 213 case EntityTelephone:
214 addressee.insertPhoneNumber( readTelephoneValue( cl ) ); 214 addressee.insertPhoneNumber( readTelephoneValue( cl ) );
215 break; 215 break;
216 216
217 case EntityCategories: 217 case EntityCategories:
218 addressee.setCategories( QStringList::split( ",", readTextValue( cl ) ) ); 218 addressee.setCategories( QStringList::split( ",", readTextValue( cl ) ) );
219 break; 219 break;
220 220
221 case EntityBirthday: 221 case EntityBirthday:
222 addressee.setBirthday( readDateValue( cl ) ); 222 addressee.setBirthday( readDateValue( cl ) );
223 break; 223 break;
224 224
225 case EntityRevision: 225 case EntityRevision:
226 addressee.setRevision( readDateTimeValue( cl ) ); 226 addressee.setRevision( readDateTimeValue( cl ) );
227 break; 227 break;
228 228
229 case EntityGeo: 229 case EntityGeo:
230 addressee.setGeo( readGeoValue( cl ) ); 230 addressee.setGeo( readGeoValue( cl ) );
231 break; 231 break;
232 232
233 case EntityTimeZone: 233 case EntityTimeZone:
234 addressee.setTimeZone( readUTCValue( cl ) ); 234 addressee.setTimeZone( readUTCValue( cl ) );
235 break; 235 break;
236 236
237 case EntityVersion: 237 case EntityVersion:
238 break; 238 break;
239 239
240 case EntityClass: 240 case EntityClass:
241 addressee.setSecrecy( readClassValue( cl ) ); 241 addressee.setSecrecy( readClassValue( cl ) );
242 break; 242 break;
243 243
244 case EntityKey: 244 case EntityKey:
245 addressee.insertKey( readKeyValue( cl ) ); 245 addressee.insertKey( readKeyValue( cl ) );
246 break; 246 break;
247 247
248 case EntityPhoto: 248 case EntityPhoto:
249 addressee.setPhoto( readPictureValue( cl, EntityPhoto, addressee ) ); 249 addressee.setPhoto( readPictureValue( cl, EntityPhoto, addressee ) );
250 break; 250 break;
251 251
252 case EntityLogo: 252 case EntityLogo:
253 addressee.setLogo( readPictureValue( cl, EntityLogo, addressee ) ); 253 addressee.setLogo( readPictureValue( cl, EntityLogo, addressee ) );
254 break; 254 break;
255 255
256 case EntityAgent: 256 case EntityAgent:
257 addressee.setAgent( readAgentValue( cl ) ); 257 addressee.setAgent( readAgentValue( cl ) );
258 break; 258 break;
259 259
260 case EntitySound: 260 case EntitySound:
261 addressee.setSound( readSoundValue( cl, addressee ) ); 261 addressee.setSound( readSoundValue( cl, addressee ) );
262 break; 262 break;
263 263
264 default: 264 default:
265 kdDebug(5700) << "VCardFormat::load(): Unsupported entity: " 265 kdDebug(5700) << "VCardFormat::load(): Unsupported entity: "
266 << int( type ) << ": " << cl->asString() << endl; 266 << int( type ) << ": " << cl->asString() << endl;
267 qDebug("VCardFormat::load(): Unsupported entity: %i: %s ", int(type), (const char*)cl->asString()); 267 qDebug("VCardFormat::load(): Unsupported entity: %i: %s ", int(type), (const char*)cl->asString());
268 break; 268 break;
269 } 269 }
270 } 270 }
271 271
272 for( cl = contentLines.first(); cl; cl = contentLines.next() ) { 272 for( cl = contentLines.first(); cl; cl = contentLines.next() ) {
273 EntityType type = cl->entityType(); 273 EntityType type = cl->entityType();
274 if ( type == EntityLabel ) { 274 if ( type == EntityLabel ) {
275 int type = readAddressParam( cl ); 275 int type = readAddressParam( cl );
276 Address address = addressee.address( type ); 276 Address address = addressee.address( type );
277 if ( address.isEmpty() ) 277 if ( address.isEmpty() )
278 address.setType( type ); 278 address.setType( type );
279 279
280 address.setLabel( QString::fromUtf8( cl->value()->asString() ) ); 280 address.setLabel( QString::fromUtf8( cl->value()->asString() ) );
281 addressee.insertAddress( address ); 281 addressee.insertAddress( address );
282 } 282 }
283 } 283 }
284 addressee.makePhoneNumbersOLcompatible(); 284 addressee.makePhoneNumbersOLcompatible();
285 return true; 285 return true;
286} 286}
287 287
288void VCardFormatImpl::saveAddressee( const Addressee &addressee, VCard *v, bool intern ) 288void VCardFormatImpl::saveAddressee( const Addressee &addressee, VCard *v, bool intern )
289{ 289{
290//US ContentLine cl; 290//US ContentLine cl;
291//US QString value; 291//US QString value;
292 292
293 addTextValue( v, EntityName, addressee.name() ); 293 addTextValue( v, EntityName, addressee.name() );
294 addTextValue( v, EntityUID, addressee.uid() ); 294 addTextValue( v, EntityUID, addressee.uid() );
295 addTextValue( v, EntityFullName, addressee.formattedName() ); 295 addTextValue( v, EntityFullName, addressee.formattedName() );
296 296
297 QStringList emails = addressee.emails(); 297 QStringList emails = addressee.emails();
298 QStringList::ConstIterator it4; 298 QStringList::ConstIterator it4;
299 for( it4 = emails.begin(); it4 != emails.end(); ++it4 ) { 299 for( it4 = emails.begin(); it4 != emails.end(); ++it4 ) {
300 addTextValue( v, EntityEmail, *it4 ); 300 addTextValue( v, EntityEmail, *it4 );
301 } 301 }
302 302
303 QStringList customs = addressee.customs(); 303 QStringList customs = addressee.customs();
304 QStringList::ConstIterator it5; 304 QStringList::ConstIterator it5;
305 for( it5 = customs.begin(); it5 != customs.end(); ++it5 ) { 305 for( it5 = customs.begin(); it5 != customs.end(); ++it5 ) {
306 addCustomValue( v, *it5 ); 306 addCustomValue( v, *it5 );
307 } 307 }
308 308
309 addTextValue( v, EntityURL, addressee.url().url() ); 309 addTextValue( v, EntityURL, addressee.url().url() );
310 310
311 addNValue( v, addressee ); 311 addNValue( v, addressee );
312 312
313 addTextValue( v, EntityNickname, addressee.nickName() ); 313 addTextValue( v, EntityNickname, addressee.nickName() );
314 addTextValue( v, EntityMailer, addressee.mailer() ); 314 addTextValue( v, EntityMailer, addressee.mailer() );
315 addTextValue( v, EntityTitle, addressee.title() ); 315 addTextValue( v, EntityTitle, addressee.title() );
316 addTextValue( v, EntityRole, addressee.role() ); 316 addTextValue( v, EntityRole, addressee.role() );
317 addTextValue( v, EntityOrganisation, addressee.organization() ); 317 addTextValue( v, EntityOrganisation, addressee.organization() );
318 addTextValue( v, EntityNote, addressee.note() ); 318 addTextValue( v, EntityNote, addressee.note() );
319 addTextValue( v, EntityProductID, addressee.productId() ); 319 addTextValue( v, EntityProductID, addressee.productId() );
320 addTextValue( v, EntitySortString, addressee.sortString() ); 320 addTextValue( v, EntitySortString, addressee.sortString() );
321 321
322 Address::List addresses = addressee.addresses(); 322 Address::List addresses = addressee.addresses();
323 Address::List::ConstIterator it3; 323 Address::List::ConstIterator it3;
324 for( it3 = addresses.begin(); it3 != addresses.end(); ++it3 ) { 324 for( it3 = addresses.begin(); it3 != addresses.end(); ++it3 ) {
325 addAddressValue( v, *it3 ); 325 addAddressValue( v, *it3 );
326 addLabelValue( v, *it3 ); 326 addLabelValue( v, *it3 );
327 } 327 }
328 328
329 PhoneNumber::List phoneNumbers = addressee.phoneNumbers(); 329 PhoneNumber::List phoneNumbers = addressee.phoneNumbers();
330 PhoneNumber::List::ConstIterator it2; 330 PhoneNumber::List::ConstIterator it2;
331 for( it2 = phoneNumbers.begin(); it2 != phoneNumbers.end(); ++it2 ) { 331 for( it2 = phoneNumbers.begin(); it2 != phoneNumbers.end(); ++it2 ) {
332 addTelephoneValue( v, *it2 ); 332 addTelephoneValue( v, *it2 );
333 } 333 }
334 334
335 Key::List keys = addressee.keys(); 335 Key::List keys = addressee.keys();
336 Key::List::ConstIterator it6; 336 Key::List::ConstIterator it6;
337 for( it6 = keys.begin(); it6 != keys.end(); ++it6 ) { 337 for( it6 = keys.begin(); it6 != keys.end(); ++it6 ) {
338 addKeyValue( v, *it6 ); 338 addKeyValue( v, *it6 );
339 } 339 }
340 340
341 addTextValue( v, EntityCategories, addressee.categories().join(",") ); 341 addTextValue( v, EntityCategories, addressee.categories().join(",") );
342 342
343 addDateValue( v, EntityBirthday, addressee.birthday().date() ); 343 addDateValue( v, EntityBirthday, addressee.birthday().date() );
344 addDateTimeValue( v, EntityRevision, addressee.revision() ); 344 addDateTimeValue( v, EntityRevision, addressee.revision() );
345 addGeoValue( v, addressee.geo() ); 345 addGeoValue( v, addressee.geo() );
346 addUTCValue( v, addressee.timeZone() ); 346 addUTCValue( v, addressee.timeZone() );
347 347
348 addClassValue( v, addressee.secrecy() ); 348 addClassValue( v, addressee.secrecy() );
349 349
350 addPictureValue( v, EntityPhoto, addressee.photo(), addressee, intern ); 350 addPictureValue( v, EntityPhoto, addressee.photo(), addressee, intern );
351 addPictureValue( v, EntityLogo, addressee.logo(), addressee, intern ); 351 addPictureValue( v, EntityLogo, addressee.logo(), addressee, intern );
352 352
353 addAgentValue( v, addressee.agent() ); 353 addAgentValue( v, addressee.agent() );
354 354
355 addSoundValue( v, addressee.sound(), addressee, intern ); 355 addSoundValue( v, addressee.sound(), addressee, intern );
356} 356}
357 357
358void VCardFormatImpl::addCustomValue( VCard *v, const QString &txt ) 358void VCardFormatImpl::addCustomValue( VCard *v, const QString &txt )
359{ 359{
360 if ( txt.isEmpty() ) return; 360 if ( txt.isEmpty() ) return;
361 361
362 ContentLine cl; 362 ContentLine cl;
363 cl.setName( "X-" + txt.left( txt.find( ":" ) ).utf8() ); 363 cl.setName( "X-" + txt.left( txt.find( ":" ) ).utf8() );
364 QString value = txt.mid( txt.find( ":" ) + 1 ); 364 QString value = txt.mid( txt.find( ":" ) + 1 );
365 if ( value.isEmpty() ) 365 if ( value.isEmpty() )
366 return; 366 return;
367 cl.setValue( new TextValue( value.utf8() ) ); 367 cl.setValue( new TextValue( value.utf8() ) );
368 v->add(cl); 368 v->add(cl);
369} 369}
370 370
371void VCardFormatImpl::addTextValue( VCard *v, EntityType type, const QString &txt ) 371void VCardFormatImpl::addTextValue( VCard *v, EntityType type, const QString &txt )
372{ 372{
373 if ( txt.isEmpty() ) return; 373 if ( txt.isEmpty() ) return;
374 374
375 ContentLine cl; 375 ContentLine cl;
376 cl.setName( EntityTypeToParamName( type ) ); 376 cl.setName( EntityTypeToParamName( type ) );
377 cl.setValue( new TextValue( txt.utf8() ) ); 377 cl.setValue( new TextValue( txt.utf8() ) );
378 v->add(cl); 378 v->add(cl);
379} 379}
380 380
381void VCardFormatImpl::addDateValue( VCard *vcard, EntityType type, 381void VCardFormatImpl::addDateValue( VCard *vcard, EntityType type,
382 const QDate &date ) 382 const QDate &date )
383{ 383{
384 if ( !date.isValid() ) return; 384 if ( !date.isValid() ) return;
385 385
386 ContentLine cl; 386 ContentLine cl;
387 cl.setName( EntityTypeToParamName( type ) ); 387 cl.setName( EntityTypeToParamName( type ) );
388 388
389 DateValue *v = new DateValue( date ); 389 DateValue *v = new DateValue( date );
390 cl.setValue( v ); 390 cl.setValue( v );
391 vcard->add(cl); 391 vcard->add(cl);
392} 392}
393 393
394void VCardFormatImpl::addDateTimeValue( VCard *vcard, EntityType type, 394void VCardFormatImpl::addDateTimeValue( VCard *vcard, EntityType type,
395 const QDateTime &dateTime ) 395 const QDateTime &dateTime )
396{ 396{
397 if ( !dateTime.isValid() ) return; 397 if ( !dateTime.isValid() ) return;
398 398
399 ContentLine cl; 399 ContentLine cl;
400 cl.setName( EntityTypeToParamName( type ) ); 400 cl.setName( EntityTypeToParamName( type ) );
401 401
402 DateValue *v = new DateValue( dateTime ); 402 DateValue *v = new DateValue( dateTime );
403 cl.setValue( v ); 403 cl.setValue( v );
404 vcard->add(cl); 404 vcard->add(cl);
405} 405}
406 406
407void VCardFormatImpl::addAddressValue( VCard *vcard, const Address &a ) 407void VCardFormatImpl::addAddressValue( VCard *vcard, const Address &a )
408{ 408{
409 if ( a.isEmpty() ) 409 if ( a.isEmpty() )
410 return; 410 return;
411 411
412 ContentLine cl; 412 ContentLine cl;
413 cl.setName( EntityTypeToParamName( EntityAddress ) ); 413 cl.setName( EntityTypeToParamName( EntityAddress ) );
414 414
415 AdrValue *v = new AdrValue; 415 AdrValue *v = new AdrValue;
416 v->setPOBox( a.postOfficeBox().utf8() ); 416 v->setPOBox( a.postOfficeBox().utf8() );
417 v->setExtAddress( a.extended().utf8() ); 417 v->setExtAddress( a.extended().utf8() );
418 v->setStreet( a.street().utf8() ); 418 v->setStreet( a.street().utf8() );
419 v->setLocality( a.locality().utf8() ); 419 v->setLocality( a.locality().utf8() );
420 v->setRegion( a.region().utf8() ); 420 v->setRegion( a.region().utf8() );
421 v->setPostCode( a.postalCode().utf8() ); 421 v->setPostCode( a.postalCode().utf8() );
422 v->setCountryName( a.country().utf8() ); 422 v->setCountryName( a.country().utf8() );
423 cl.setValue( v ); 423 cl.setValue( v );
424 424
425 addAddressParam( &cl, a.type() ); 425 addAddressParam( &cl, a.type() );
426 426
427 vcard->add( cl ); 427 vcard->add( cl );
428} 428}
429 429
430void VCardFormatImpl::addLabelValue( VCard *vcard, const Address &a ) 430void VCardFormatImpl::addLabelValue( VCard *vcard, const Address &a )
431{ 431{
432 if ( a.label().isEmpty() ) return; 432 if ( a.label().isEmpty() ) return;
433 433
434 ContentLine cl; 434 ContentLine cl;
435 cl.setName( EntityTypeToParamName( EntityLabel ) ); 435 cl.setName( EntityTypeToParamName( EntityLabel ) );
436 cl.setValue( new TextValue( a.label().utf8() ) ); 436 cl.setValue( new TextValue( a.label().utf8() ) );
437 437
438 addAddressParam( &cl, a.type() ); 438 addAddressParam( &cl, a.type() );
439 439
440 vcard->add( cl ); 440 vcard->add( cl );
441} 441}
442 442
443void VCardFormatImpl::addAddressParam( ContentLine *cl, int type ) 443void VCardFormatImpl::addAddressParam( ContentLine *cl, int type )
444{ 444{
445 ParamList params; 445 ParamList params;
446 if ( type & Address::Dom ) params.append( new Param( "TYPE", "dom" ) ); 446 if ( type & Address::Dom ) params.append( new Param( "TYPE", "dom" ) );
447 if ( type & Address::Intl ) params.append( new Param( "TYPE", "intl" ) ); 447 if ( type & Address::Intl ) params.append( new Param( "TYPE", "intl" ) );
448 if ( type & Address::Parcel ) params.append( new Param( "TYPE", "parcel" ) ); 448 if ( type & Address::Parcel ) params.append( new Param( "TYPE", "parcel" ) );
449 if ( type & Address::Postal ) params.append( new Param( "TYPE", "postal" ) ); 449 if ( type & Address::Postal ) params.append( new Param( "TYPE", "postal" ) );
450 if ( type & Address::Work ) params.append( new Param( "TYPE", "work" ) ); 450 if ( type & Address::Work ) params.append( new Param( "TYPE", "work" ) );
451 if ( type & Address::Home ) params.append( new Param( "TYPE", "home" ) ); 451 if ( type & Address::Home ) params.append( new Param( "TYPE", "home" ) );
452 if ( type & Address::Pref ) params.append( new Param( "TYPE", "pref" ) ); 452 if ( type & Address::Pref ) params.append( new Param( "TYPE", "pref" ) );
453 cl->setParamList( params ); 453 cl->setParamList( params );
454} 454}
455 455
456void VCardFormatImpl::addGeoValue( VCard *vcard, const Geo &geo ) 456void VCardFormatImpl::addGeoValue( VCard *vcard, const Geo &geo )
457{ 457{
458 if ( !geo.isValid() ) return; 458 if ( !geo.isValid() ) return;
459 459
460 ContentLine cl; 460 ContentLine cl;
461 cl.setName( EntityTypeToParamName( EntityGeo ) ); 461 cl.setName( EntityTypeToParamName( EntityGeo ) );
462 462
463 GeoValue *v = new GeoValue; 463 GeoValue *v = new GeoValue;
464 v->setLatitude( geo.latitude() ); 464 v->setLatitude( geo.latitude() );
465 v->setLongitude( geo.longitude() ); 465 v->setLongitude( geo.longitude() );
466 466
467 cl.setValue( v ); 467 cl.setValue( v );
468 vcard->add(cl); 468 vcard->add(cl);
469} 469}
470 470
471void VCardFormatImpl::addUTCValue( VCard *vcard, const TimeZone &tz ) 471void VCardFormatImpl::addUTCValue( VCard *vcard, const TimeZone &tz )
472{ 472{
473 if ( !tz.isValid() ) return; 473 if ( !tz.isValid() ) return;
474 474
475 ContentLine cl; 475 ContentLine cl;
476 cl.setName( EntityTypeToParamName( EntityTimeZone ) ); 476 cl.setName( EntityTypeToParamName( EntityTimeZone ) );
477 477
478 UTCValue *v = new UTCValue; 478 UTCValue *v = new UTCValue;
479 479
480 v->setPositive( tz.offset() >= 0 ); 480 v->setPositive( tz.offset() >= 0 );
481 v->setHour( (tz.offset() / 60) * ( tz.offset() >= 0 ? 1 : -1 ) ); 481 v->setHour( (tz.offset() / 60) * ( tz.offset() >= 0 ? 1 : -1 ) );
482 v->setMinute( (tz.offset() % 60) * ( tz.offset() >= 0 ? 1 : -1 ) ); 482 v->setMinute( (tz.offset() % 60) * ( tz.offset() >= 0 ? 1 : -1 ) );
483 483
484 cl.setValue( v ); 484 cl.setValue( v );
485 vcard->add(cl); 485 vcard->add(cl);
486} 486}
487 487
488void VCardFormatImpl::addClassValue( VCard *vcard, const Secrecy &secrecy ) 488void VCardFormatImpl::addClassValue( VCard *vcard, const Secrecy &secrecy )
489{ 489{
490 ContentLine cl; 490 ContentLine cl;
491 cl.setName( EntityTypeToParamName( EntityClass ) ); 491 cl.setName( EntityTypeToParamName( EntityClass ) );
492 492
493 ClassValue *v = new ClassValue; 493 ClassValue *v = new ClassValue;
494 switch ( secrecy.type() ) { 494 switch ( secrecy.type() ) {
495 case Secrecy::Public: 495 case Secrecy::Public:
496 v->setType( (int)ClassValue::Public ); 496 v->setType( (int)ClassValue::Public );
497 break; 497 break;
498 case Secrecy::Private: 498 case Secrecy::Private:
499 v->setType( (int)ClassValue::Private ); 499 v->setType( (int)ClassValue::Private );
500 break; 500 break;
501 case Secrecy::Confidential: 501 case Secrecy::Confidential:
502 v->setType( (int)ClassValue::Confidential ); 502 v->setType( (int)ClassValue::Confidential );
503 break; 503 break;
504 } 504 }
505 505
506 cl.setValue( v ); 506 cl.setValue( v );
507 vcard->add(cl); 507 vcard->add(cl);
508} 508}
509 509
510 510
511Address VCardFormatImpl::readAddressValue( ContentLine *cl ) 511Address VCardFormatImpl::readAddressValue( ContentLine *cl )
512{ 512{
513 Address a; 513 Address a;
514 AdrValue *v = (AdrValue *)cl->value(); 514 AdrValue *v = (AdrValue *)cl->value();
515 a.setPostOfficeBox( QString::fromUtf8( v->poBox() ) ); 515 a.setPostOfficeBox( QString::fromUtf8( v->poBox() ) );
516 a.setExtended( QString::fromUtf8( v->extAddress() ) ); 516 a.setExtended( QString::fromUtf8( v->extAddress() ) );
517 a.setStreet( QString::fromUtf8( v->street() ) ); 517 a.setStreet( QString::fromUtf8( v->street() ) );
518 a.setLocality( QString::fromUtf8( v->locality() ) ); 518 a.setLocality( QString::fromUtf8( v->locality() ) );
519 a.setRegion( QString::fromUtf8( v->region() ) ); 519 a.setRegion( QString::fromUtf8( v->region() ) );
520 a.setPostalCode( QString::fromUtf8( v->postCode() ) ); 520 a.setPostalCode( QString::fromUtf8( v->postCode() ) );
521 a.setCountry( QString::fromUtf8( v->countryName() ) ); 521 a.setCountry( QString::fromUtf8( v->countryName() ) );
522 522
523 a.setType( readAddressParam( cl ) ); 523 a.setType( readAddressParam( cl ) );
524 524
525 return a; 525 return a;
526} 526}
527 527
528int VCardFormatImpl::readAddressParam( ContentLine *cl ) 528int VCardFormatImpl::readAddressParam( ContentLine *cl )
529{ 529{
530 int type = 0; 530 int type = 0;
531 ParamList params = cl->paramList(); 531 ParamList params = cl->paramList();
532 ParamListIterator it( params ); 532 ParamListIterator it( params );
533 QCString tmpStr; 533 QCString tmpStr;
534 for( ; it.current(); ++it ) { 534 for( ; it.current(); ++it ) {
535 if ( (*it)->name().upper() == "TYPE" ) { 535 if ( (*it)->name().upper() == "TYPE" ) {
536 tmpStr = (*it)->value().lower(); 536 tmpStr = (*it)->value().lower();
537 if ( tmpStr == "dom" ) type |= Address::Dom; 537 if ( tmpStr == "dom" ) type |= Address::Dom;
538 else if ( tmpStr == "intl" ) type |= Address::Intl; 538 else if ( tmpStr == "intl" ) type |= Address::Intl;
539 else if ( tmpStr == "parcel" ) type |= Address::Parcel; 539 else if ( tmpStr == "parcel" ) type |= Address::Parcel;
540 else if ( tmpStr == "postal" ) type |= Address::Postal; 540 else if ( tmpStr == "postal" ) type |= Address::Postal;
541 else if ( tmpStr == "work" ) type |= Address::Work; 541 else if ( tmpStr == "work" ) type |= Address::Work;
542 else if ( tmpStr == "home" ) type |= Address::Home; 542 else if ( tmpStr == "home" ) type |= Address::Home;
543 else if ( tmpStr == "pref" ) type |= Address::Pref; 543 else if ( tmpStr == "pref" ) type |= Address::Pref;
544 } 544 }
545 } 545 }
546 return type; 546 return type;
547} 547}
548 548
549void VCardFormatImpl::addNValue( VCard *vcard, const Addressee &a ) 549void VCardFormatImpl::addNValue( VCard *vcard, const Addressee &a )
550{ 550{
551 ContentLine cl; 551 ContentLine cl;
552 cl.setName(EntityTypeToParamName( EntityN ) ); 552 cl.setName(EntityTypeToParamName( EntityN ) );
553 NValue *v = new NValue; 553 NValue *v = new NValue;
554 v->setFamily( a.familyName().utf8() ); 554 v->setFamily( a.familyName().utf8() );
555 v->setGiven( a.givenName().utf8() ); 555 v->setGiven( a.givenName().utf8() );
556 v->setMiddle( a.additionalName().utf8() ); 556 v->setMiddle( a.additionalName().utf8() );
557 v->setPrefix( a.prefix().utf8() ); 557 v->setPrefix( a.prefix().utf8() );
558 v->setSuffix( a.suffix().utf8() ); 558 v->setSuffix( a.suffix().utf8() );
559 559
560 cl.setValue( v ); 560 cl.setValue( v );
561 vcard->add(cl); 561 vcard->add(cl);
562} 562}
563 563
564void VCardFormatImpl::readNValue( ContentLine *cl, Addressee &a ) 564void VCardFormatImpl::readNValue( ContentLine *cl, Addressee &a )
565{ 565{
566 NValue *v = (NValue *)cl->value(); 566 NValue *v = (NValue *)cl->value();
567 a.setFamilyName( QString::fromUtf8( v->family() ) ); 567 a.setFamilyName( QString::fromUtf8( v->family() ) );
568 a.setGivenName( QString::fromUtf8( v->given() ) ); 568 a.setGivenName( QString::fromUtf8( v->given() ) );
569 a.setAdditionalName( QString::fromUtf8( v->middle() ) ); 569 a.setAdditionalName( QString::fromUtf8( v->middle() ) );
570 a.setPrefix( QString::fromUtf8( v->prefix() ) ); 570 a.setPrefix( QString::fromUtf8( v->prefix() ) );
571 a.setSuffix( QString::fromUtf8( v->suffix() ) ); 571 a.setSuffix( QString::fromUtf8( v->suffix() ) );
572} 572}
573 573
574void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p ) 574void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p )
575{ 575{
576 if ( p.number().isEmpty() ) 576 if ( p.number().isEmpty() )
577 return; 577 return;
578 578
579 ContentLine cl; 579 ContentLine cl;
580 cl.setName(EntityTypeToParamName(EntityTelephone)); 580 cl.setName(EntityTypeToParamName(EntityTelephone));
581 cl.setValue(new TelValue( p.number().utf8() )); 581 cl.setValue(new TelValue( p.number().utf8() ));
582 582
583 ParamList params; 583 ParamList params;
584 if( p.type() & PhoneNumber::Home ) params.append( new Param( "TYPE", "home" ) ); 584 if( p.type() & PhoneNumber::Home ) params.append( new Param( "TYPE", "home" ) );
585 if( p.type() & PhoneNumber::Work ) params.append( new Param( "TYPE", "work" ) ); 585 if( p.type() & PhoneNumber::Work ) params.append( new Param( "TYPE", "work" ) );
586 if( p.type() & PhoneNumber::Msg ) params.append( new Param( "TYPE", "msg" ) ); 586 if( p.type() & PhoneNumber::Msg ) params.append( new Param( "TYPE", "msg" ) );
587 if( p.type() & PhoneNumber::Pref ) params.append( new Param( "TYPE", "pref" ) ); 587 if( p.type() & PhoneNumber::Pref ) params.append( new Param( "TYPE", "pref" ) );
588 if( p.type() & PhoneNumber::Voice ) params.append( new Param( "TYPE", "voice" ) ); 588 if( p.type() & PhoneNumber::Voice ) params.append( new Param( "TYPE", "voice" ) );
589 if( p.type() & PhoneNumber::Fax ) params.append( new Param( "TYPE", "fax" ) ); 589 if( p.type() & PhoneNumber::Fax ) params.append( new Param( "TYPE", "fax" ) );
590 if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) ); 590 if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) );
591 if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) ); 591 if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) );
592 if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) ); 592 if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) );
593 if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) ); 593 if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) );
594 if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) ); 594 if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) );
595 if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) ); 595 if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) );
596 if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) ); 596 if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) );
597 if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) ); 597 if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) );
598 cl.setParamList( params ); 598 cl.setParamList( params );
599 599
600 v->add(cl); 600 v->add(cl);
601} 601}
602 602
603PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl ) 603PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl )
604{ 604{
605 PhoneNumber p; 605 PhoneNumber p;
606 TelValue *value = (TelValue *)cl->value(); 606 TelValue *value = (TelValue *)cl->value();
607 p.setNumber( QString::fromUtf8( value->asString() ) ); 607 p.setNumber( QString::fromUtf8( value->asString() ) );
608 608
609 int type = 0; 609 int type = 0;
610 ParamList params = cl->paramList(); 610 ParamList params = cl->paramList();
611 ParamListIterator it( params ); 611 ParamListIterator it( params );
612 QCString tmpStr; 612 QCString tmpStr;
613 for( ; it.current(); ++it ) { 613 for( ; it.current(); ++it ) {
614 if ( (*it)->name() == "TYPE" ) { 614 if ( (*it)->name() == "TYPE" ) {
615 tmpStr = (*it)->value().lower(); 615 tmpStr = (*it)->value().lower();
616 if ( tmpStr == "home" ) type |= PhoneNumber::Home; 616 if ( tmpStr == "home" ) type |= PhoneNumber::Home;
617 else if ( tmpStr == "work" ) type |= PhoneNumber::Work; 617 else if ( tmpStr == "work" ) type |= PhoneNumber::Work;
618 else if ( tmpStr == "msg" ) type |= PhoneNumber::Msg; 618 else if ( tmpStr == "msg" ) type |= PhoneNumber::Msg;
619 else if ( tmpStr == "pref" ) type |= PhoneNumber::Pref; 619 else if ( tmpStr == "pref" ) type |= PhoneNumber::Pref;
620 else if ( tmpStr == "voice" ) type |= PhoneNumber::Voice; 620 else if ( tmpStr == "voice" ) type |= PhoneNumber::Voice;
621 else if ( tmpStr == "fax" ) type |= PhoneNumber::Fax; 621 else if ( tmpStr == "fax" ) type |= PhoneNumber::Fax;
622 else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell; 622 else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell;
623 else if ( tmpStr == "video" ) type |= PhoneNumber::Video; 623 else if ( tmpStr == "video" ) type |= PhoneNumber::Video;
624 else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs; 624 else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs;
625 else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem; 625 else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem;
626 else if ( tmpStr == "car" ) type |= PhoneNumber::Car; 626 else if ( tmpStr == "car" ) type |= PhoneNumber::Car;
627 else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn; 627 else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn;
628 else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs; 628 else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs;
629 else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager; 629 else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager;
630 } 630 }
631 } 631 }
632 p.setType( type ); 632 p.setType( type );
633 633
634 return p; 634 return p;
635} 635}
636 636
637QString VCardFormatImpl::readTextValue( ContentLine *cl ) 637QString VCardFormatImpl::readTextValue( ContentLine *cl )
638{ 638{
639 VCARD::Value *value = cl->value(); 639 VCARD::Value *value = cl->value();
640 if ( value ) { 640 if ( value ) {
641 return QString::fromUtf8( value->asString() ); 641 return QString::fromUtf8( value->asString() );
642 } else { 642 } else {
643 kdDebug(5700) << "No value: " << cl->asString() << endl; 643 kdDebug(5700) << "No value: " << cl->asString() << endl;
644 qDebug("No value: %s", (const char*)(cl->asString())); 644 qDebug("No value: %s", (const char*)(cl->asString()));
645 return QString::null; 645 return QString::null;
646 } 646 }
647} 647}
648 648
649QDate VCardFormatImpl::readDateValue( ContentLine *cl ) 649QDate VCardFormatImpl::readDateValue( ContentLine *cl )
650{ 650{
651 DateValue *dateValue = (DateValue *)cl->value(); 651 DateValue *dateValue = (DateValue *)cl->value();
652 if ( dateValue ) 652 if ( dateValue )
653 return dateValue->qdate(); 653 return dateValue->qdate();
654 else 654 else
655 return QDate(); 655 return QDate();
656} 656}
657 657
658QDateTime VCardFormatImpl::readDateTimeValue( ContentLine *cl ) 658QDateTime VCardFormatImpl::readDateTimeValue( ContentLine *cl )
659{ 659{
660 DateValue *dateValue = (DateValue *)cl->value(); 660 DateValue *dateValue = (DateValue *)cl->value();
661 if ( dateValue ) 661 if ( dateValue )
662 return dateValue->qdt(); 662 return dateValue->qdt();
663 else 663 else
664 return QDateTime(); 664 return QDateTime();
665} 665}
666 666
667Geo VCardFormatImpl::readGeoValue( ContentLine *cl ) 667Geo VCardFormatImpl::readGeoValue( ContentLine *cl )
668{ 668{
669 GeoValue *geoValue = (GeoValue *)cl->value(); 669 GeoValue *geoValue = (GeoValue *)cl->value();
670 if ( geoValue ) { 670 if ( geoValue ) {
671 Geo geo( geoValue->latitude(), geoValue->longitude() ); 671 Geo geo( geoValue->latitude(), geoValue->longitude() );
672 return geo; 672 return geo;
673 } else 673 } else
674 return Geo(); 674 return Geo();
675} 675}
676 676
677TimeZone VCardFormatImpl::readUTCValue( ContentLine *cl ) 677TimeZone VCardFormatImpl::readUTCValue( ContentLine *cl )
678{ 678{
679 UTCValue *utcValue = (UTCValue *)cl->value(); 679 UTCValue *utcValue = (UTCValue *)cl->value();
680 if ( utcValue ) { 680 if ( utcValue ) {
681 TimeZone tz; 681 TimeZone tz;
682 tz.setOffset(((utcValue->hour()*60)+utcValue->minute())*(utcValue->positive() ? 1 : -1)); 682 tz.setOffset(((utcValue->hour()*60)+utcValue->minute())*(utcValue->positive() ? 1 : -1));
683 return tz; 683 return tz;
684 } else 684 } else
685 return TimeZone(); 685 return TimeZone();
686} 686}
687 687
688Secrecy VCardFormatImpl::readClassValue( ContentLine *cl ) 688Secrecy VCardFormatImpl::readClassValue( ContentLine *cl )
689{ 689{
690 ClassValue *classValue = (ClassValue *)cl->value(); 690 ClassValue *classValue = (ClassValue *)cl->value();
691 if ( classValue ) { 691 if ( classValue ) {
692 Secrecy secrecy; 692 Secrecy secrecy;
693 switch ( classValue->type() ) { 693 switch ( classValue->type() ) {
694 case ClassValue::Public: 694 case ClassValue::Public:
695 secrecy.setType( Secrecy::Public ); 695 secrecy.setType( Secrecy::Public );
696 break; 696 break;
697 case ClassValue::Private: 697 case ClassValue::Private:
698 secrecy.setType( Secrecy::Private ); 698 secrecy.setType( Secrecy::Private );
699 break; 699 break;
700 case ClassValue::Confidential: 700 case ClassValue::Confidential:
701 secrecy.setType( Secrecy::Confidential ); 701 secrecy.setType( Secrecy::Confidential );
702 break; 702 break;
703 } 703 }
704 704
705 return secrecy; 705 return secrecy;
706 } else 706 } else
707 return Secrecy(); 707 return Secrecy();
708} 708}
709 709
710void VCardFormatImpl::addKeyValue( VCARD::VCard *vcard, const Key &key ) 710void VCardFormatImpl::addKeyValue( VCARD::VCard *vcard, const Key &key )
711{ 711{
712 ContentLine cl; 712 ContentLine cl;
713 cl.setName( EntityTypeToParamName( EntityKey ) ); 713 cl.setName( EntityTypeToParamName( EntityKey ) );
714 714
715 ParamList params; 715 ParamList params;
716 if ( key.isBinary() ) { 716 if ( key.isBinary() ) {
717 cl.setValue( new TextValue( KCodecs::base64Encode( key.binaryData() ) ) ); 717 cl.setValue( new TextValue( KCodecs::base64Encode( key.binaryData() ) ) );
718 params.append( new Param( "ENCODING", "b" ) ); 718 params.append( new Param( "ENCODING", "b" ) );
719 } else { 719 } else {
720 cl.setValue( new TextValue( key.textData().utf8() ) ); 720 cl.setValue( new TextValue( key.textData().utf8() ) );
721 } 721 }
722 722
723 switch ( key.type() ) { 723 switch ( key.type() ) {
724 case Key::X509: 724 case Key::X509:
725 params.append( new Param( "TYPE", "X509" ) ); 725 params.append( new Param( "TYPE", "X509" ) );
726 break; 726 break;
727 case Key::PGP: 727 case Key::PGP:
728 params.append( new Param( "TYPE", "PGP" ) ); 728 params.append( new Param( "TYPE", "PGP" ) );
729 break; 729 break;
730 case Key::Custom: 730 case Key::Custom:
731 params.append( new Param( "TYPE", key.customTypeString().utf8() ) ); 731 params.append( new Param( "TYPE", key.customTypeString().utf8() ) );
732 break; 732 break;
733 } 733 }
734 734
735 cl.setParamList( params ); 735 cl.setParamList( params );
736 vcard->add( cl ); 736 vcard->add( cl );
737} 737}
738 738
739Key VCardFormatImpl::readKeyValue( VCARD::ContentLine *cl ) 739Key VCardFormatImpl::readKeyValue( VCARD::ContentLine *cl )
740{ 740{
741 Key key; 741 Key key;
742 bool isBinary = false; 742 bool isBinary = false;
743 TextValue *v = (TextValue *)cl->value(); 743 TextValue *v = (TextValue *)cl->value();
744 744
745 ParamList params = cl->paramList(); 745 ParamList params = cl->paramList();
746 ParamListIterator it( params ); 746 ParamListIterator it( params );
747 for( ; it.current(); ++it ) { 747 for( ; it.current(); ++it ) {
748 if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" ) 748 if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" )
749 isBinary = true; 749 isBinary = true;
750 if ( (*it)->name() == "TYPE" ) { 750 if ( (*it)->name() == "TYPE" ) {
751 if ( (*it)->value().isEmpty() ) 751 if ( (*it)->value().isEmpty() )
752 continue; 752 continue;
753 if ( (*it)->value() == "X509" ) 753 if ( (*it)->value() == "X509" )
754 key.setType( Key::X509 ); 754 key.setType( Key::X509 );
755 else if ( (*it)->value() == "PGP" ) 755 else if ( (*it)->value() == "PGP" )
756 key.setType( Key::PGP ); 756 key.setType( Key::PGP );
757 else { 757 else {
758 key.setType( Key::Custom ); 758 key.setType( Key::Custom );
759 key.setCustomTypeString( QString::fromUtf8( (*it)->value() ) ); 759 key.setCustomTypeString( QString::fromUtf8( (*it)->value() ) );
760 } 760 }
761 } 761 }
762 } 762 }
763 763
764 764
765 if ( isBinary ) { 765 if ( isBinary ) {
766 QByteArray data; 766 QByteArray data;
767 KCodecs::base64Decode( v->asString().stripWhiteSpace(), data ); 767 KCodecs::base64Decode( v->asString().stripWhiteSpace(), data );
768 key.setBinaryData( data ); 768 key.setBinaryData( data );
769 } else { 769 } else {
770 key.setTextData( QString::fromUtf8( v->asString() ) ); 770 key.setTextData( QString::fromUtf8( v->asString() ) );
771 } 771 }
772 772
773 return key; 773 return key;
774} 774}
775 775
776 776
777void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent ) 777void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent )
778{ 778{
779 if ( agent.isIntern() && !agent.addressee() ) 779 if ( agent.isIntern() && !agent.addressee() )
780 return; 780 return;
781 781
782 if ( !agent.isIntern() && agent.url().isEmpty() ) 782 if ( !agent.isIntern() && agent.url().isEmpty() )
783 return; 783 return;
784 784
785 ContentLine cl; 785 ContentLine cl;
786 cl.setName( EntityTypeToParamName( EntityAgent ) ); 786 cl.setName( EntityTypeToParamName( EntityAgent ) );
787 787
788 ParamList params; 788 ParamList params;
789 if ( agent.isIntern() ) { 789 if ( agent.isIntern() ) {
790 QString vstr; 790 QString vstr;
791 Addressee *addr = agent.addressee(); 791 Addressee *addr = agent.addressee();
792 if ( addr ) { 792 if ( addr ) {
793 writeToString( (*addr), vstr ); 793 writeToString( (*addr), vstr );
794 794
795 qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct"); 795 qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct");
796/*US 796/*US
797 vstr.replace( ":", "\\:" ); 797 vstr.replace( ":", "\\:" );
798 vstr.replace( ",", "\\," ); 798 vstr.replace( ",", "\\," );
799 vstr.replace( ";", "\\;" ); 799 vstr.replace( ";", "\\;" );
800 vstr.replace( "\r\n", "\\n" ); 800 vstr.replace( "\r\n", "\\n" );
801*/ 801*/
802 vstr.replace( QRegExp(":"), "\\:" ); 802 vstr.replace( QRegExp(":"), "\\:" );
803 vstr.replace( QRegExp(","), "\\," ); 803 vstr.replace( QRegExp(","), "\\," );
804 vstr.replace( QRegExp(";"), "\\;" ); 804 vstr.replace( QRegExp(";"), "\\;" );
805 vstr.replace( QRegExp("\r\n"), "\\n" ); 805 vstr.replace( QRegExp("\r\n"), "\\n" );
806 806
807 cl.setValue( new TextValue( vstr.utf8() ) ); 807 cl.setValue( new TextValue( vstr.utf8() ) );
808 } else 808 } else
809 return; 809 return;
810 } else { 810 } else {
811 cl.setValue( new TextValue( agent.url().utf8() ) ); 811 cl.setValue( new TextValue( agent.url().utf8() ) );
812 params.append( new Param( "VALUE", "uri" ) ); 812 params.append( new Param( "VALUE", "uri" ) );
813 } 813 }
814 814
815 cl.setParamList( params ); 815 cl.setParamList( params );
816 vcard->add( cl ); 816 vcard->add( cl );
817} 817}
818 818
819Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl ) 819Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl )
820{ 820{
821 Agent agent; 821 Agent agent;
822 bool isIntern = true; 822 bool isIntern = true;
823 TextValue *v = (TextValue *)cl->value(); 823 TextValue *v = (TextValue *)cl->value();
824 824
825 ParamList params = cl->paramList(); 825 ParamList params = cl->paramList();
826 ParamListIterator it( params ); 826 ParamListIterator it( params );
827 for( ; it.current(); ++it ) { 827 for( ; it.current(); ++it ) {
828 if ( (*it)->name() == "VALUE" && (*it)->value() == "uri" ) 828 if ( (*it)->name() == "VALUE" && (*it)->value() == "uri" )
829 isIntern = false; 829 isIntern = false;
830 } 830 }
831 831
832 if ( isIntern ) { 832 if ( isIntern ) {
833 QString vstr = QString::fromUtf8( v->asString() ); 833 QString vstr = QString::fromUtf8( v->asString() );
834 qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct"); 834 qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct");
835/*US 835/*US
836 vstr.replace( "\\n", "\r\n" ); 836 vstr.replace( "\\n", "\r\n" );
837 vstr.replace( "\\:", ":" ); 837 vstr.replace( "\\:", ":" );
838 vstr.replace( "\\,", "," ); 838 vstr.replace( "\\,", "," );
839 vstr.replace( "\\;", ";" ); 839 vstr.replace( "\\;", ";" );
840*/ 840*/
841 vstr.replace( QRegExp("\\\\n"), "\r\n" ); 841 vstr.replace( QRegExp("\\\\n"), "\r\n" );
842 vstr.replace( QRegExp("\\\\:"), ":" ); 842 vstr.replace( QRegExp("\\\\:"), ":" );
843 vstr.replace( QRegExp("\\\\,"), "," ); 843 vstr.replace( QRegExp("\\\\,"), "," );
844 vstr.replace( QRegExp("\\\\;"), ";" ); 844 vstr.replace( QRegExp("\\\\;"), ";" );
845 845
846 Addressee *addr = new Addressee; 846 Addressee *addr = new Addressee;
847 readFromString( vstr, *addr ); 847 readFromString( vstr, *addr );
848 agent.setAddressee( addr ); 848 agent.setAddressee( addr );
849 } else { 849 } else {
850 agent.setUrl( QString::fromUtf8( v->asString() ) ); 850 agent.setUrl( QString::fromUtf8( v->asString() ) );
851 } 851 }
852 852
853 return agent; 853 return agent;
854} 854}
855 855
856#include <qstringlist.h>
856void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType type, const Picture &pic, const Addressee &addr, bool intern ) 857void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType type, const Picture &pic, const Addressee &addr, bool intern )
857{ 858{
858 ContentLine cl; 859 ContentLine cl;
859 cl.setName( EntityTypeToParamName( type ) ); 860 cl.setName( EntityTypeToParamName( type ) );
860 861 // qDebug( "IIIMMMMM %s",QImage::outputFormatList ().join("-").latin1() );
861 if ( pic.isIntern() && pic.data().isNull() ) 862 if ( pic.isIntern() && pic.data().isNull() )
862 return; 863 return;
863 864
864 if ( !pic.isIntern() && pic.url().isEmpty() ) 865 if ( !pic.isIntern() && pic.url().isEmpty() )
865 return; 866 return;
866 867
867 ParamList params; 868 ParamList params;
868 if ( pic.isIntern() ) { 869 if ( pic.isIntern() ) {
869 QImage img = pic.data(); 870 QImage img = pic.data();
870 if ( intern ) { // only for vCard export we really write the data inline 871 if ( intern ) { // only for vCard export we really write the data inline
871 QByteArray data; 872 QByteArray data;
872 QDataStream s( data, IO_WriteOnly ); 873 QDataStream s( data, IO_WriteOnly );
873 s.setVersion( 4 ); // to produce valid png files 874 s.setVersion( 4 ); // to produce valid png files
874 s << img; 875 s << img;
875 cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) ); 876 cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) );
876 877 params.append( new Param( "ENCODING", "b" ) );
878 if ( !pic.type().isEmpty() )
879 params.append( new Param( "TYPE", pic.type().utf8() ) );
877 } else { // save picture in cache 880 } else { // save picture in cache
878 QString dir; 881 QString dir;
879 if ( type == EntityPhoto ) 882 if ( type == EntityPhoto )
880 dir = "photos"; 883 dir = "photos";
881 if ( type == EntityLogo ) 884 if ( type == EntityLogo )
882 dir = "logos"; 885 dir = "logos";
883 886 QString imUrl = locateLocal( "data", "kabc/" + dir + "/" + addr.uid() );
884 img.save( locateLocal( "data", "kabc/" + dir + "/" + addr.uid() ), pic.type().utf8() ); 887 KABC::Picture* ppic =(KABC::Picture*) &pic;
885 cl.setValue( new TextValue( "<dummy>" ) ); 888 ppic->setUrl( imUrl );
889 img.save(imUrl, "PNG" );
890 cl.setValue( new TextValue( pic.url().utf8() ) );
891 params.append( new Param( "VALUE", "uri" ) );
886 } 892 }
887 params.append( new Param( "ENCODING", "b" ) ); 893
888 if ( !pic.type().isEmpty() )
889 params.append( new Param( "TYPE", pic.type().utf8() ) );
890 } else { 894 } else {
891 895
892 cl.setValue( new TextValue( pic.url().utf8() ) ); 896 cl.setValue( new TextValue( pic.url().utf8() ) );
893 params.append( new Param( "VALUE", "uri" ) ); 897 params.append( new Param( "VALUE", "uri" ) );
894 } 898 }
895 899
896 cl.setParamList( params ); 900 cl.setParamList( params );
897 vcard->add( cl ); 901 vcard->add( cl );
898} 902}
899 903
900Picture VCardFormatImpl::readPictureValue( VCARD::ContentLine *cl, VCARD::EntityType type, const Addressee &addr ) 904Picture VCardFormatImpl::readPictureValue( VCARD::ContentLine *cl, VCARD::EntityType type, const Addressee &addr )
901{ 905{
902 Picture pic; 906 Picture pic;
903 bool isInline = false; 907 bool isInline = false;
904 QString picType; 908 QString picType;
905 TextValue *v = (TextValue *)cl->value(); 909 TextValue *v = (TextValue *)cl->value();
906 910
907 ParamList params = cl->paramList(); 911 ParamList params = cl->paramList();
908 ParamListIterator it( params ); 912 ParamListIterator it( params );
909 for( ; it.current(); ++it ) { 913 for( ; it.current(); ++it ) {
910 if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" ) 914 if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" )
911 isInline = true; 915 isInline = true;
912 if ( (*it)->name() == "TYPE" && !(*it)->value().isEmpty() ) 916 if ( (*it)->name() == "TYPE" && !(*it)->value().isEmpty() )
913 picType = QString::fromUtf8( (*it)->value() ); 917 picType = QString::fromUtf8( (*it)->value() );
914 } 918 }
915 919
916 if ( isInline ) { 920 if ( isInline ) {
917 QImage img; 921 QImage img;
918 if ( v->asString() == "<dummy>" ) { // no picture inline stored => picture is in cache 922 if ( v->asString() == "<dummy>" ) { // no picture inline stored => picture is in cache
919 QString dir; 923 QString dir;
920 if ( type == EntityPhoto ) 924 if ( type == EntityPhoto )
921 dir = "photos"; 925 dir = "photos";
922 if ( type == EntityLogo ) 926 if ( type == EntityLogo )
923 dir = "logos"; 927 dir = "logos";
924 928
925 img.load( locateLocal( "data", "kabc/" + dir + "/" + addr.uid() ) ); 929 img.load( locateLocal( "data", "kabc/" + dir + "/" + addr.uid() ) );
926 } else { 930 } else {
927 QByteArray data; 931 QByteArray data;
928 KCodecs::base64Decode( v->asString(), data ); 932 KCodecs::base64Decode( v->asString(), data );
929 img.loadFromData( data ); 933 img.loadFromData( data );
930 } 934 }
931 pic.setData( img ); 935 pic.setData( img );
932 pic.setType( picType ); 936 pic.setType( picType );
933 } else { 937 } else {
934 pic.setUrl( QString::fromUtf8( v->asString() ) ); 938 pic.setUrl( QString::fromUtf8( v->asString() ) );
935 } 939 }
936 940
937 return pic; 941 return pic;
938} 942}
939 943
940void VCardFormatImpl::addSoundValue( VCARD::VCard *vcard, const Sound &sound, const Addressee &addr, bool intern ) 944void VCardFormatImpl::addSoundValue( VCARD::VCard *vcard, const Sound &sound, const Addressee &addr, bool intern )
941{ 945{
942 ContentLine cl; 946 ContentLine cl;
943 cl.setName( EntityTypeToParamName( EntitySound ) ); 947 cl.setName( EntityTypeToParamName( EntitySound ) );
944 948
945 if ( sound.isIntern() && sound.data().isNull() ) 949 if ( sound.isIntern() && sound.data().isNull() )
946 return; 950 return;
947 951
948 if ( !sound.isIntern() && sound.url().isEmpty() ) 952 if ( !sound.isIntern() && sound.url().isEmpty() )
949 return; 953 return;
950 954
951 ParamList params; 955 ParamList params;
952 if ( sound.isIntern() ) { 956 if ( sound.isIntern() ) {
953 QByteArray data = sound.data(); 957 QByteArray data = sound.data();
954 if ( intern ) { // only for vCard export we really write the data inline 958 if ( intern ) { // only for vCard export we really write the data inline
955 cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) ); 959 cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) );
956 } else { // save sound in cache 960 } else { // save sound in cache
957 QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) ); 961 QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) );
958 if ( file.open( IO_WriteOnly ) ) { 962 if ( file.open( IO_WriteOnly ) ) {
959 file.writeBlock( data ); 963 file.writeBlock( data );
960 } 964 }
961 cl.setValue( new TextValue( "<dummy>" ) ); 965 cl.setValue( new TextValue( "<dummy>" ) );
962 } 966 }
963 params.append( new Param( "ENCODING", "b" ) ); 967 params.append( new Param( "ENCODING", "b" ) );
964 } else { 968 } else {
965 cl.setValue( new TextValue( sound.url().utf8() ) ); 969 cl.setValue( new TextValue( sound.url().utf8() ) );
966 params.append( new Param( "VALUE", "uri" ) ); 970 params.append( new Param( "VALUE", "uri" ) );
967 } 971 }
968 972
969 cl.setParamList( params ); 973 cl.setParamList( params );
970 vcard->add( cl ); 974 vcard->add( cl );
971} 975}
972 976
973Sound VCardFormatImpl::readSoundValue( VCARD::ContentLine *cl, const Addressee &addr ) 977Sound VCardFormatImpl::readSoundValue( VCARD::ContentLine *cl, const Addressee &addr )
974{ 978{
975 Sound sound; 979 Sound sound;
976 bool isInline = false; 980 bool isInline = false;
977 TextValue *v = (TextValue *)cl->value(); 981 TextValue *v = (TextValue *)cl->value();
978 982
979 ParamList params = cl->paramList(); 983 ParamList params = cl->paramList();
980 ParamListIterator it( params ); 984 ParamListIterator it( params );
981 for( ; it.current(); ++it ) { 985 for( ; it.current(); ++it ) {
982 if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" ) 986 if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" )
983 isInline = true; 987 isInline = true;
984 } 988 }
985 989
986 if ( isInline ) { 990 if ( isInline ) {
987 QByteArray data; 991 QByteArray data;
988 if ( v->asString() == "<dummy>" ) { // no sound inline stored => sound is in cache 992 if ( v->asString() == "<dummy>" ) { // no sound inline stored => sound is in cache
989 QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) ); 993 QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) );
990 if ( file.open( IO_ReadOnly ) ) { 994 if ( file.open( IO_ReadOnly ) ) {
991 data = file.readAll(); 995 data = file.readAll();
992 file.close(); 996 file.close();
993 } 997 }
994 } else { 998 } else {
995 KCodecs::base64Decode( v->asString(), data ); 999 KCodecs::base64Decode( v->asString(), data );
996 } 1000 }
997 sound.setData( data ); 1001 sound.setData( data );
998 } else { 1002 } else {
999 sound.setUrl( QString::fromUtf8( v->asString() ) ); 1003 sound.setUrl( QString::fromUtf8( v->asString() ) );
1000 } 1004 }
1001 1005
1002 return sound; 1006 return sound;
1003} 1007}
1004 1008
1005bool VCardFormatImpl::readFromString( const QString &vcard, Addressee &addressee ) 1009bool VCardFormatImpl::readFromString( const QString &vcard, Addressee &addressee )
1006{ 1010{
1007 VCardEntity e( vcard.utf8() ); 1011 VCardEntity e( vcard.utf8() );
1008 VCardListIterator it( e.cardList() ); 1012 VCardListIterator it( e.cardList() );
1009 1013
1010 if ( it.current() ) { 1014 if ( it.current() ) {
1011//US VCard v(*it.current()); 1015//US VCard v(*it.current());
1012//US loadAddressee( addressee, v ); 1016//US loadAddressee( addressee, v );
1013 loadAddressee( addressee, it.current() ); 1017 loadAddressee( addressee, it.current() );
1014 return true; 1018 return true;
1015 } 1019 }
1016 1020
1017 return false; 1021 return false;
1018} 1022}
1019 1023
1020bool VCardFormatImpl::writeToString( const Addressee &addressee, QString &vcard ) 1024bool VCardFormatImpl::writeToString( const Addressee &addressee, QString &vcard )
1021{ 1025{
1022 VCardEntity vcards; 1026 VCardEntity vcards;
1023 VCardList vcardlist; 1027 VCardList vcardlist;
1024 vcardlist.setAutoDelete( true ); 1028 vcardlist.setAutoDelete( true );
1025 1029
1026 VCard *v = new VCard; 1030 VCard *v = new VCard;
1027 1031
1028 saveAddressee( addressee, v, true ); 1032 saveAddressee( addressee, v, true );
1029 1033
1030 vcardlist.append( v ); 1034 vcardlist.append( v );
1031 vcards.setCardList( vcardlist ); 1035 vcards.setCardList( vcardlist );
1032 vcard = QString::fromUtf8( vcards.asString() ); 1036 vcard = QString::fromUtf8( vcards.asString() );
1033 1037
1034 return true; 1038 return true;
1035} 1039}