author | zautrix <zautrix> | 2005-01-06 00:18:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-06 00:18:02 (UTC) |
commit | 5e7c3e3e51fa939e97b73e6443089edcec8dc663 (patch) (unidiff) | |
tree | 213be239777ec911d364f736f9e6cef1f62a7c68 /kabc | |
parent | 0618fbee69bfde7f7f3c4a54b5cc45dac446abd3 (diff) | |
download | kdepimpi-5e7c3e3e51fa939e97b73e6443089edcec8dc663.zip kdepimpi-5e7c3e3e51fa939e97b73e6443089edcec8dc663.tar.gz kdepimpi-5e7c3e3e51fa939e97b73e6443089edcec8dc663.tar.bz2 |
kapi pic fix
-rw-r--r-- | kabc/vcardformatimpl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index c31af46..b9fe6ff 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp | |||
@@ -1,382 +1,382 @@ | |||
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 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (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 | 30 | ||
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kmdcodec.h> | 32 | #include <kmdcodec.h> |
33 | #include <kstandarddirs.h> | 33 | #include <kstandarddirs.h> |
34 | #include <ktempfile.h> | 34 | #include <ktempfile.h> |
35 | 35 | ||
36 | #include <VCard.h> | 36 | #include <VCard.h> |
37 | 37 | ||
38 | #include "addressbook.h" | 38 | #include "addressbook.h" |
39 | #include "vcardformatimpl.h" | 39 | #include "vcardformatimpl.h" |
40 | 40 | ||
41 | using namespace KABC; | 41 | using namespace KABC; |
42 | using namespace VCARD; | 42 | using namespace VCARD; |
43 | 43 | ||
44 | int VCardFormatImpl::debug = -1; | 44 | int VCardFormatImpl::debug = -1; |
45 | 45 | ||
46 | VCardFormatImpl::VCardFormatImpl() | 46 | VCardFormatImpl::VCardFormatImpl() |
47 | { | 47 | { |
48 | debug = (getenv("KABC_DEBUG") != 0); | 48 | debug = (getenv("KABC_DEBUG") != 0); |
49 | } | 49 | } |
50 | 50 | ||
51 | bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) | 51 | bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) |
52 | { | 52 | { |
53 | kdDebug(5700) << "VCardFormat::load()" << endl; | 53 | kdDebug(5700) << "VCardFormat::load()" << endl; |
54 | 54 | ||
55 | QByteArray fdata = file->readAll(); | 55 | QByteArray fdata = file->readAll(); |
56 | QCString data(fdata.data(), fdata.size()+1); | 56 | QCString data(fdata.data(), fdata.size()+1); |
57 | 57 | ||
58 | VCardEntity e( data ); | 58 | VCardEntity e( data ); |
59 | 59 | ||
60 | VCardListIterator it( e.cardList() ); | 60 | VCardListIterator it( e.cardList() ); |
61 | 61 | ||
62 | if ( it.current() ) { | 62 | if ( it.current() ) { |
63 | //US VCard v(*it.current()); | 63 | //US VCard v(*it.current()); |
64 | //US loadAddressee( addressee, v ); | 64 | //US loadAddressee( addressee, v ); |
65 | loadAddressee( addressee, it.current() ); | 65 | loadAddressee( addressee, it.current() ); |
66 | return true; | 66 | return true; |
67 | } | 67 | } |
68 | 68 | ||
69 | return false; | 69 | return false; |
70 | } | 70 | } |
71 | 71 | ||
72 | bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 72 | bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) |
73 | { | 73 | { |
74 | kdDebug(5700) << "VCardFormat::loadAll()" << endl; | 74 | kdDebug(5700) << "VCardFormat::loadAll()" << endl; |
75 | 75 | ||
76 | QByteArray fdata = file->readAll(); | 76 | QByteArray fdata = file->readAll(); |
77 | QCString data(fdata.data(), fdata.size()+1); | 77 | QCString data(fdata.data(), fdata.size()+1); |
78 | 78 | ||
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 | 95 | ||
96 | return true; | 96 | return true; |
97 | } | 97 | } |
98 | 98 | ||
99 | void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) | 99 | void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) |
100 | { | 100 | { |
101 | VCardEntity vcards; | 101 | VCardEntity vcards; |
102 | VCardList vcardlist; | 102 | VCardList vcardlist; |
103 | vcardlist.setAutoDelete( true ); | 103 | vcardlist.setAutoDelete( true ); |
104 | 104 | ||
105 | VCard *v = new VCard; | 105 | VCard *v = new VCard; |
106 | 106 | ||
107 | saveAddressee( addressee, v, false ); | 107 | saveAddressee( addressee, v, false ); |
108 | 108 | ||
109 | vcardlist.append( v ); | 109 | vcardlist.append( v ); |
110 | vcards.setCardList( vcardlist ); | 110 | vcards.setCardList( vcardlist ); |
111 | 111 | ||
112 | QCString vcardData = vcards.asString(); | 112 | QCString vcardData = vcards.asString(); |
113 | file->writeBlock( (const char*)vcardData, vcardData.length() ); | 113 | file->writeBlock( (const char*)vcardData, vcardData.length() ); |
114 | } | 114 | } |
115 | 115 | ||
116 | void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file ) | 116 | void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file ) |
117 | { | 117 | { |
118 | VCardEntity vcards; | 118 | VCardEntity vcards; |
119 | VCardList vcardlist; | 119 | VCardList vcardlist; |
120 | vcardlist.setAutoDelete( true ); | 120 | vcardlist.setAutoDelete( true ); |
121 | 121 | ||
122 | AddressBook::Iterator it; | 122 | AddressBook::Iterator it; |
123 | for ( it = ab->begin(); it != ab->end(); ++it ) { | 123 | for ( it = ab->begin(); it != ab->end(); ++it ) { |
124 | if ( (*it).resource() == resource ) { | 124 | if ( (*it).resource() == resource ) { |
125 | VCard *v = new VCard; | 125 | VCard *v = new VCard; |
126 | saveAddressee( (*it), v, false ); | 126 | saveAddressee( (*it), v, true ); |
127 | (*it).setChanged( false ); | 127 | (*it).setChanged( false ); |
128 | vcardlist.append( v ); | 128 | vcardlist.append( v ); |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | vcards.setCardList( vcardlist ); | 132 | vcards.setCardList( vcardlist ); |
133 | 133 | ||
134 | QCString vcardData = vcards.asString(); | 134 | QCString vcardData = vcards.asString(); |
135 | file->writeBlock( (const char*)vcardData, vcardData.length() ); | 135 | file->writeBlock( (const char*)vcardData, vcardData.length() ); |
136 | } | 136 | } |
137 | 137 | ||
138 | bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) | 138 | bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) |
139 | { | 139 | { |
140 | QPtrList<ContentLine> contentLines = v->contentLineList(); | 140 | QPtrList<ContentLine> contentLines = v->contentLineList(); |
141 | ContentLine *cl; | 141 | ContentLine *cl; |
142 | 142 | ||
143 | for( cl = contentLines.first(); cl; cl = contentLines.next() ) { | 143 | for( cl = contentLines.first(); cl; cl = contentLines.next() ) { |
144 | QCString n = cl->name(); | 144 | QCString n = cl->name(); |
145 | if ( n.left( 2 ) == "X-" ) { | 145 | if ( n.left( 2 ) == "X-" ) { |
146 | n = n.mid( 2 ); | 146 | n = n.mid( 2 ); |
147 | int posDash = n.find( "-" ); | 147 | int posDash = n.find( "-" ); |
148 | addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ), | 148 | addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ), |
149 | QString::fromUtf8( n.mid( posDash + 1 ) ), | 149 | QString::fromUtf8( n.mid( posDash + 1 ) ), |
150 | QString::fromUtf8( cl->value()->asString() ) ); | 150 | QString::fromUtf8( cl->value()->asString() ) ); |
151 | continue; | 151 | continue; |
152 | } | 152 | } |
153 | 153 | ||
154 | EntityType type = cl->entityType(); | 154 | EntityType type = cl->entityType(); |
155 | switch( type ) { | 155 | switch( type ) { |
156 | 156 | ||
157 | case EntityUID: | 157 | case EntityUID: |
158 | addressee.setUid( readTextValue( cl ) ); | 158 | addressee.setUid( readTextValue( cl ) ); |
159 | break; | 159 | break; |
160 | 160 | ||
161 | case EntityEmail: | 161 | case EntityEmail: |
162 | addressee.insertEmail( readTextValue( cl ) ); | 162 | addressee.insertEmail( readTextValue( cl ) ); |
163 | break; | 163 | break; |
164 | 164 | ||
165 | case EntityName: | 165 | case EntityName: |
166 | addressee.setName( readTextValue( cl ) ); | 166 | addressee.setName( readTextValue( cl ) ); |
167 | break; | 167 | break; |
168 | 168 | ||
169 | case EntityFullName: | 169 | case EntityFullName: |
170 | addressee.setFormattedName( readTextValue( cl ) ); | 170 | addressee.setFormattedName( readTextValue( cl ) ); |
171 | break; | 171 | break; |
172 | 172 | ||
173 | case EntityURL: | 173 | case EntityURL: |
174 | addressee.setUrl( KURL( readTextValue( cl ) ) ); | 174 | addressee.setUrl( KURL( readTextValue( cl ) ) ); |
175 | break; | 175 | break; |
176 | 176 | ||
177 | case EntityNickname: | 177 | case EntityNickname: |
178 | addressee.setNickName( readTextValue( cl ) ); | 178 | addressee.setNickName( readTextValue( cl ) ); |
179 | break; | 179 | break; |
180 | 180 | ||
181 | case EntityLabel: | 181 | case EntityLabel: |
182 | // not yet supported by kabc | 182 | // not yet supported by kabc |
183 | break; | 183 | break; |
184 | 184 | ||
185 | case EntityMailer: | 185 | case EntityMailer: |
186 | addressee.setMailer( readTextValue( cl ) ); | 186 | addressee.setMailer( readTextValue( cl ) ); |
187 | break; | 187 | break; |
188 | 188 | ||
189 | case EntityTitle: | 189 | case EntityTitle: |
190 | addressee.setTitle( readTextValue( cl ) ); | 190 | addressee.setTitle( readTextValue( cl ) ); |
191 | break; | 191 | break; |
192 | 192 | ||
193 | case EntityRole: | 193 | case EntityRole: |
194 | addressee.setRole( readTextValue( cl ) ); | 194 | addressee.setRole( readTextValue( cl ) ); |
195 | break; | 195 | break; |
196 | 196 | ||
197 | case EntityOrganisation: | 197 | case EntityOrganisation: |
198 | addressee.setOrganization( readTextValue( cl ) ); | 198 | addressee.setOrganization( readTextValue( cl ) ); |
199 | break; | 199 | break; |
200 | 200 | ||
201 | case EntityNote: | 201 | case EntityNote: |
202 | addressee.setNote( readTextValue( cl ) ); | 202 | addressee.setNote( readTextValue( cl ) ); |
203 | break; | 203 | break; |
204 | 204 | ||
205 | case EntityProductID: | 205 | case EntityProductID: |
206 | addressee.setProductId( readTextValue( cl ) ); | 206 | addressee.setProductId( readTextValue( cl ) ); |
207 | break; | 207 | break; |
208 | 208 | ||
209 | case EntitySortString: | 209 | case EntitySortString: |
210 | addressee.setSortString( readTextValue( cl ) ); | 210 | addressee.setSortString( readTextValue( cl ) ); |
211 | break; | 211 | break; |
212 | 212 | ||
213 | case EntityN: | 213 | case EntityN: |
214 | readNValue( cl, addressee ); | 214 | readNValue( cl, addressee ); |
215 | break; | 215 | break; |
216 | 216 | ||
217 | case EntityAddress: | 217 | case EntityAddress: |
218 | addressee.insertAddress( readAddressValue( cl ) ); | 218 | addressee.insertAddress( readAddressValue( cl ) ); |
219 | break; | 219 | break; |
220 | 220 | ||
221 | case EntityTelephone: | 221 | case EntityTelephone: |
222 | addressee.insertPhoneNumber( readTelephoneValue( cl ) ); | 222 | addressee.insertPhoneNumber( readTelephoneValue( cl ) ); |
223 | break; | 223 | break; |
224 | 224 | ||
225 | case EntityCategories: | 225 | case EntityCategories: |
226 | addressee.setCategories( QStringList::split( ",", readTextValue( cl ) ) ); | 226 | addressee.setCategories( QStringList::split( ",", readTextValue( cl ) ) ); |
227 | break; | 227 | break; |
228 | 228 | ||
229 | case EntityBirthday: | 229 | case EntityBirthday: |
230 | addressee.setBirthday( readDateValue( cl ) ); | 230 | addressee.setBirthday( readDateValue( cl ) ); |
231 | break; | 231 | break; |
232 | 232 | ||
233 | case EntityRevision: | 233 | case EntityRevision: |
234 | addressee.setRevision( readDateTimeValue( cl ) ); | 234 | addressee.setRevision( readDateTimeValue( cl ) ); |
235 | break; | 235 | break; |
236 | 236 | ||
237 | case EntityGeo: | 237 | case EntityGeo: |
238 | addressee.setGeo( readGeoValue( cl ) ); | 238 | addressee.setGeo( readGeoValue( cl ) ); |
239 | break; | 239 | break; |
240 | 240 | ||
241 | case EntityTimeZone: | 241 | case EntityTimeZone: |
242 | addressee.setTimeZone( readUTCValue( cl ) ); | 242 | addressee.setTimeZone( readUTCValue( cl ) ); |
243 | break; | 243 | break; |
244 | 244 | ||
245 | case EntityVersion: | 245 | case EntityVersion: |
246 | break; | 246 | break; |
247 | 247 | ||
248 | case EntityClass: | 248 | case EntityClass: |
249 | addressee.setSecrecy( readClassValue( cl ) ); | 249 | addressee.setSecrecy( readClassValue( cl ) ); |
250 | break; | 250 | break; |
251 | 251 | ||
252 | case EntityKey: | 252 | case EntityKey: |
253 | addressee.insertKey( readKeyValue( cl ) ); | 253 | addressee.insertKey( readKeyValue( cl ) ); |
254 | break; | 254 | break; |
255 | 255 | ||
256 | case EntityPhoto: | 256 | case EntityPhoto: |
257 | addressee.setPhoto( readPictureValue( cl, EntityPhoto, addressee ) ); | 257 | addressee.setPhoto( readPictureValue( cl, EntityPhoto, addressee ) ); |
258 | break; | 258 | break; |
259 | 259 | ||
260 | case EntityLogo: | 260 | case EntityLogo: |
261 | addressee.setLogo( readPictureValue( cl, EntityLogo, addressee ) ); | 261 | addressee.setLogo( readPictureValue( cl, EntityLogo, addressee ) ); |
262 | break; | 262 | break; |
263 | 263 | ||
264 | case EntityAgent: | 264 | case EntityAgent: |
265 | addressee.setAgent( readAgentValue( cl ) ); | 265 | addressee.setAgent( readAgentValue( cl ) ); |
266 | break; | 266 | break; |
267 | 267 | ||
268 | case EntitySound: | 268 | case EntitySound: |
269 | addressee.setSound( readSoundValue( cl, addressee ) ); | 269 | addressee.setSound( readSoundValue( cl, addressee ) ); |
270 | break; | 270 | break; |
271 | 271 | ||
272 | default: | 272 | default: |
273 | kdDebug(5700) << "VCardFormat::load(): Unsupported entity: " | 273 | kdDebug(5700) << "VCardFormat::load(): Unsupported entity: " |
274 | << int( type ) << ": " << cl->asString() << endl; | 274 | << int( type ) << ": " << cl->asString() << endl; |
275 | qDebug("VCardFormat::load(): Unsupported entity: %i: %s ", int(type), (const char*)cl->asString()); | 275 | qDebug("VCardFormat::load(): Unsupported entity: %i: %s ", int(type), (const char*)cl->asString()); |
276 | break; | 276 | break; |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | for( cl = contentLines.first(); cl; cl = contentLines.next() ) { | 280 | for( cl = contentLines.first(); cl; cl = contentLines.next() ) { |
281 | EntityType type = cl->entityType(); | 281 | EntityType type = cl->entityType(); |
282 | if ( type == EntityLabel ) { | 282 | if ( type == EntityLabel ) { |
283 | int type = readAddressParam( cl ); | 283 | int type = readAddressParam( cl ); |
284 | Address address = addressee.address( type ); | 284 | Address address = addressee.address( type ); |
285 | if ( address.isEmpty() ) | 285 | if ( address.isEmpty() ) |
286 | address.setType( type ); | 286 | address.setType( type ); |
287 | 287 | ||
288 | address.setLabel( QString::fromUtf8( cl->value()->asString() ) ); | 288 | address.setLabel( QString::fromUtf8( cl->value()->asString() ) ); |
289 | addressee.insertAddress( address ); | 289 | addressee.insertAddress( address ); |
290 | } | 290 | } |
291 | } | 291 | } |
292 | 292 | ||
293 | return true; | 293 | return true; |
294 | } | 294 | } |
295 | 295 | ||
296 | void VCardFormatImpl::saveAddressee( const Addressee &addressee, VCard *v, bool intern ) | 296 | void VCardFormatImpl::saveAddressee( const Addressee &addressee, VCard *v, bool intern ) |
297 | { | 297 | { |
298 | //US ContentLine cl; | 298 | //US ContentLine cl; |
299 | //US QString value; | 299 | //US QString value; |
300 | 300 | ||
301 | addTextValue( v, EntityName, addressee.name() ); | 301 | addTextValue( v, EntityName, addressee.name() ); |
302 | addTextValue( v, EntityUID, addressee.uid() ); | 302 | addTextValue( v, EntityUID, addressee.uid() ); |
303 | addTextValue( v, EntityFullName, addressee.formattedName() ); | 303 | addTextValue( v, EntityFullName, addressee.formattedName() ); |
304 | 304 | ||
305 | QStringList emails = addressee.emails(); | 305 | QStringList emails = addressee.emails(); |
306 | QStringList::ConstIterator it4; | 306 | QStringList::ConstIterator it4; |
307 | for( it4 = emails.begin(); it4 != emails.end(); ++it4 ) { | 307 | for( it4 = emails.begin(); it4 != emails.end(); ++it4 ) { |
308 | addTextValue( v, EntityEmail, *it4 ); | 308 | addTextValue( v, EntityEmail, *it4 ); |
309 | } | 309 | } |
310 | 310 | ||
311 | QStringList customs = addressee.customs(); | 311 | QStringList customs = addressee.customs(); |
312 | QStringList::ConstIterator it5; | 312 | QStringList::ConstIterator it5; |
313 | for( it5 = customs.begin(); it5 != customs.end(); ++it5 ) { | 313 | for( it5 = customs.begin(); it5 != customs.end(); ++it5 ) { |
314 | addCustomValue( v, *it5 ); | 314 | addCustomValue( v, *it5 ); |
315 | } | 315 | } |
316 | 316 | ||
317 | addTextValue( v, EntityURL, addressee.url().url() ); | 317 | addTextValue( v, EntityURL, addressee.url().url() ); |
318 | 318 | ||
319 | addNValue( v, addressee ); | 319 | addNValue( v, addressee ); |
320 | 320 | ||
321 | addTextValue( v, EntityNickname, addressee.nickName() ); | 321 | addTextValue( v, EntityNickname, addressee.nickName() ); |
322 | addTextValue( v, EntityMailer, addressee.mailer() ); | 322 | addTextValue( v, EntityMailer, addressee.mailer() ); |
323 | addTextValue( v, EntityTitle, addressee.title() ); | 323 | addTextValue( v, EntityTitle, addressee.title() ); |
324 | addTextValue( v, EntityRole, addressee.role() ); | 324 | addTextValue( v, EntityRole, addressee.role() ); |
325 | addTextValue( v, EntityOrganisation, addressee.organization() ); | 325 | addTextValue( v, EntityOrganisation, addressee.organization() ); |
326 | addTextValue( v, EntityNote, addressee.note() ); | 326 | addTextValue( v, EntityNote, addressee.note() ); |
327 | addTextValue( v, EntityProductID, addressee.productId() ); | 327 | addTextValue( v, EntityProductID, addressee.productId() ); |
328 | addTextValue( v, EntitySortString, addressee.sortString() ); | 328 | addTextValue( v, EntitySortString, addressee.sortString() ); |
329 | 329 | ||
330 | Address::List addresses = addressee.addresses(); | 330 | Address::List addresses = addressee.addresses(); |
331 | Address::List::ConstIterator it3; | 331 | Address::List::ConstIterator it3; |
332 | for( it3 = addresses.begin(); it3 != addresses.end(); ++it3 ) { | 332 | for( it3 = addresses.begin(); it3 != addresses.end(); ++it3 ) { |
333 | addAddressValue( v, *it3 ); | 333 | addAddressValue( v, *it3 ); |
334 | addLabelValue( v, *it3 ); | 334 | addLabelValue( v, *it3 ); |
335 | } | 335 | } |
336 | 336 | ||
337 | PhoneNumber::List phoneNumbers = addressee.phoneNumbers(); | 337 | PhoneNumber::List phoneNumbers = addressee.phoneNumbers(); |
338 | PhoneNumber::List::ConstIterator it2; | 338 | PhoneNumber::List::ConstIterator it2; |
339 | for( it2 = phoneNumbers.begin(); it2 != phoneNumbers.end(); ++it2 ) { | 339 | for( it2 = phoneNumbers.begin(); it2 != phoneNumbers.end(); ++it2 ) { |
340 | addTelephoneValue( v, *it2 ); | 340 | addTelephoneValue( v, *it2 ); |
341 | } | 341 | } |
342 | 342 | ||
343 | Key::List keys = addressee.keys(); | 343 | Key::List keys = addressee.keys(); |
344 | Key::List::ConstIterator it6; | 344 | Key::List::ConstIterator it6; |
345 | for( it6 = keys.begin(); it6 != keys.end(); ++it6 ) { | 345 | for( it6 = keys.begin(); it6 != keys.end(); ++it6 ) { |
346 | addKeyValue( v, *it6 ); | 346 | addKeyValue( v, *it6 ); |
347 | } | 347 | } |
348 | 348 | ||
349 | addTextValue( v, EntityCategories, addressee.categories().join(",") ); | 349 | addTextValue( v, EntityCategories, addressee.categories().join(",") ); |
350 | 350 | ||
351 | addDateValue( v, EntityBirthday, addressee.birthday().date() ); | 351 | addDateValue( v, EntityBirthday, addressee.birthday().date() ); |
352 | addDateTimeValue( v, EntityRevision, addressee.revision() ); | 352 | addDateTimeValue( v, EntityRevision, addressee.revision() ); |
353 | addGeoValue( v, addressee.geo() ); | 353 | addGeoValue( v, addressee.geo() ); |
354 | addUTCValue( v, addressee.timeZone() ); | 354 | addUTCValue( v, addressee.timeZone() ); |
355 | 355 | ||
356 | addClassValue( v, addressee.secrecy() ); | 356 | addClassValue( v, addressee.secrecy() ); |
357 | 357 | ||
358 | addPictureValue( v, EntityPhoto, addressee.photo(), addressee, intern ); | 358 | addPictureValue( v, EntityPhoto, addressee.photo(), addressee, intern ); |
359 | addPictureValue( v, EntityLogo, addressee.logo(), addressee, intern ); | 359 | addPictureValue( v, EntityLogo, addressee.logo(), addressee, intern ); |
360 | 360 | ||
361 | addAgentValue( v, addressee.agent() ); | 361 | addAgentValue( v, addressee.agent() ); |
362 | 362 | ||
363 | addSoundValue( v, addressee.sound(), addressee, intern ); | 363 | addSoundValue( v, addressee.sound(), addressee, intern ); |
364 | } | 364 | } |
365 | 365 | ||
366 | void VCardFormatImpl::addCustomValue( VCard *v, const QString &txt ) | 366 | void VCardFormatImpl::addCustomValue( VCard *v, const QString &txt ) |
367 | { | 367 | { |
368 | if ( txt.isEmpty() ) return; | 368 | if ( txt.isEmpty() ) return; |
369 | 369 | ||
370 | ContentLine cl; | 370 | ContentLine cl; |
371 | cl.setName( "X-" + txt.left( txt.find( ":" ) ).utf8() ); | 371 | cl.setName( "X-" + txt.left( txt.find( ":" ) ).utf8() ); |
372 | QString value = txt.mid( txt.find( ":" ) + 1 ); | 372 | QString value = txt.mid( txt.find( ":" ) + 1 ); |
373 | if ( value.isEmpty() ) | 373 | if ( value.isEmpty() ) |
374 | return; | 374 | return; |
375 | cl.setValue( new TextValue( value.utf8() ) ); | 375 | cl.setValue( new TextValue( value.utf8() ) ); |
376 | v->add(cl); | 376 | v->add(cl); |
377 | } | 377 | } |
378 | 378 | ||
379 | void VCardFormatImpl::addTextValue( VCard *v, EntityType type, const QString &txt ) | 379 | void VCardFormatImpl::addTextValue( VCard *v, EntityType type, const QString &txt ) |
380 | { | 380 | { |
381 | if ( txt.isEmpty() ) return; | 381 | if ( txt.isEmpty() ) return; |
382 | 382 | ||