summaryrefslogtreecommitdiffabout
path: root/kabc/vcard21parser.cpp
Unidiff
Diffstat (limited to 'kabc/vcard21parser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard21parser.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/kabc/vcard21parser.cpp b/kabc/vcard21parser.cpp
index b02aac4..277de22 100644
--- a/kabc/vcard21parser.cpp
+++ b/kabc/vcard21parser.cpp
@@ -141,65 +141,66 @@ bool VCardLineX::isValid() const
141 return true; 141 return true;
142 break; 142 break;
143 143
144 case 'r': 144 case 'r':
145 if ( name == VCARD_ROLE ) 145 if ( name == VCARD_ROLE )
146 return true; 146 return true;
147 if ( name == VCARD_REV ) 147 if ( name == VCARD_REV )
148 return true; 148 return true;
149 break; 149 break;
150 150
151 case 's': 151 case 's':
152 if ( name == VCARD_SOURCE ) 152 if ( name == VCARD_SOURCE )
153 return true; 153 return true;
154 if ( name == VCARD_SOUND ) 154 if ( name == VCARD_SOUND )
155 return true; 155 return true;
156 break; 156 break;
157 157
158 case 't': 158 case 't':
159 if ( name == VCARD_TEL && qualified && 159 if ( name == VCARD_TEL && qualified &&
160 (qualifiers.contains(VCARD_TEL_HOME) || 160 (qualifiers.contains(VCARD_TEL_HOME) ||
161 qualifiers.contains(VCARD_TEL_WORK) || 161 qualifiers.contains(VCARD_TEL_WORK) ||
162 qualifiers.contains(VCARD_TEL_PREF) || 162 qualifiers.contains(VCARD_TEL_PREF) ||
163 qualifiers.contains(VCARD_TEL_VOICE) || 163 qualifiers.contains(VCARD_TEL_VOICE) ||
164 qualifiers.contains(VCARD_TEL_FAX) || 164 qualifiers.contains(VCARD_TEL_FAX) ||
165 qualifiers.contains(VCARD_TEL_MSG) || 165 qualifiers.contains(VCARD_TEL_MSG) ||
166 qualifiers.contains(VCARD_TEL_CELL) || 166 qualifiers.contains(VCARD_TEL_CELL) ||
167 qualifiers.contains(VCARD_TEL_PAGER) || 167 qualifiers.contains(VCARD_TEL_PAGER) ||
168 qualifiers.contains(VCARD_TEL_BBS) || 168 qualifiers.contains(VCARD_TEL_BBS) ||
169 qualifiers.contains(VCARD_TEL_MODEM) || 169 qualifiers.contains(VCARD_TEL_MODEM) ||
170 qualifiers.contains(VCARD_TEL_CAR) || 170 qualifiers.contains(VCARD_TEL_CAR) ||
171 qualifiers.contains(VCARD_TEL_ISDN) || 171 qualifiers.contains(VCARD_TEL_ISDN) ||
172 qualifiers.contains(VCARD_TEL_VIDEO) || 172 qualifiers.contains(VCARD_TEL_VIDEO) ||
173 qualifiers.contains(VCARD_TEL_PCS) 173 qualifiers.contains(VCARD_TEL_PCS) ||
174 qualifiers.contains(VCARD_TEL_SIP)
174 ) ) 175 ) )
175 return true; 176 return true;
176 if ( name == VCARD_TZ ) 177 if ( name == VCARD_TZ )
177 return true; 178 return true;
178 if ( name == VCARD_TITLE ) 179 if ( name == VCARD_TITLE )
179 return true; 180 return true;
180 break; 181 break;
181 182
182 case 'u': 183 case 'u':
183 if ( name == VCARD_URL ) 184 if ( name == VCARD_URL )
184 return true; 185 return true;
185 if ( name == VCARD_UID ) 186 if ( name == VCARD_UID )
186 return true; 187 return true;
187 break; 188 break;
188 189
189 case 'v': 190 case 'v':
190 if ( name == VCARD_VERSION ) 191 if ( name == VCARD_VERSION )
191 return true; 192 return true;
192 break; 193 break;
193 default: 194 default:
194 break; 195 break;
195 } 196 }
196 197
197 return false; 198 return false;
198} 199}
199 200
200 201
201VCard21Parser::VCard21Parser() 202VCard21Parser::VCard21Parser()
202{ 203{
203} 204}
204 205
205VCard21Parser::~VCard21Parser() 206VCard21Parser::~VCard21Parser()
@@ -272,64 +273,66 @@ KABC::Addressee VCard21Parser::readFromString( const QString &data)
272 for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { 273 for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
273 if ( (*i).name == VCARD_TEL ) { 274 if ( (*i).name == VCARD_TEL ) {
274 int type = 0; 275 int type = 0;
275 if ( (*i).qualified ) { 276 if ( (*i).qualified ) {
276 if ( (*i).qualifiers.contains( VCARD_TEL_HOME ) ) 277 if ( (*i).qualifiers.contains( VCARD_TEL_HOME ) )
277 type |= PhoneNumber::Home; 278 type |= PhoneNumber::Home;
278 if ( (*i).qualifiers.contains( VCARD_TEL_WORK ) ) 279 if ( (*i).qualifiers.contains( VCARD_TEL_WORK ) )
279 type |= PhoneNumber::Work; 280 type |= PhoneNumber::Work;
280 if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) ) 281 if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) )
281 type |= PhoneNumber::Pref; 282 type |= PhoneNumber::Pref;
282 // if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) ) 283 // if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) )
283 // type |= PhoneNumber::Voice; 284 // type |= PhoneNumber::Voice;
284 if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) ) 285 if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) )
285 type |= PhoneNumber::Fax; 286 type |= PhoneNumber::Fax;
286 if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) ) 287 if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) )
287 type |= PhoneNumber::Msg; 288 type |= PhoneNumber::Msg;
288 if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) ) 289 if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) )
289 type |= PhoneNumber::Cell; 290 type |= PhoneNumber::Cell;
290 if ( (*i).qualifiers.contains( VCARD_TEL_PAGER ) ) 291 if ( (*i).qualifiers.contains( VCARD_TEL_PAGER ) )
291 type |= PhoneNumber::Pager; 292 type |= PhoneNumber::Pager;
292 if ( (*i).qualifiers.contains( VCARD_TEL_BBS ) ) 293 if ( (*i).qualifiers.contains( VCARD_TEL_BBS ) )
293 type |= PhoneNumber::Bbs; 294 type |= PhoneNumber::Bbs;
294 if ( (*i).qualifiers.contains( VCARD_TEL_MODEM ) ) 295 if ( (*i).qualifiers.contains( VCARD_TEL_MODEM ) )
295 type |= PhoneNumber::Modem; 296 type |= PhoneNumber::Modem;
296 if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) ) 297 if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) )
297 type |= PhoneNumber::Car; 298 type |= PhoneNumber::Car;
298 if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) ) 299 if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) )
299 type |= PhoneNumber::Isdn; 300 type |= PhoneNumber::Isdn;
300 if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) ) 301 if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) )
301 type |= PhoneNumber::Video; 302 type |= PhoneNumber::Video;
302 if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) ) 303 if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) )
303 type |= PhoneNumber::Pcs; 304 type |= PhoneNumber::Pcs;
305 if ( (*i).qualifiers.contains( VCARD_TEL_SIP ) )
306 type |= PhoneNumber::Sip;
304 } 307 }
305 addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) ); 308 addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) );
306 } 309 }
307 } 310 }
308 311
309 //set the addressee's addresses 312 //set the addressee's addresses
310 for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { 313 for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
311 if ( (*i).name == VCARD_ADR ) { 314 if ( (*i).name == VCARD_ADR ) {
312 int type = 0; 315 int type = 0;
313 if ( (*i).qualified ) { 316 if ( (*i).qualified ) {
314 if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) ) 317 if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) )
315 type |= Address::Dom; 318 type |= Address::Dom;
316 if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) ) 319 if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) )
317 type |= Address::Intl; 320 type |= Address::Intl;
318 if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) ) 321 if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) )
319 type |= Address::Postal; 322 type |= Address::Postal;
320 if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) ) 323 if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) )
321 type |= Address::Parcel; 324 type |= Address::Parcel;
322 if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) ) 325 if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) )
323 type |= Address::Home; 326 type |= Address::Home;
324 if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) ) 327 if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) )
325 type |= Address::Work; 328 type |= Address::Work;
326 if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) ) 329 if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) )
327 type |= Address::Pref; 330 type |= Address::Pref;
328 } 331 }
329 addressee.insertAddress( readAddressFromQStringList( (*i).parameters, type ) ); 332 addressee.insertAddress( readAddressFromQStringList( (*i).parameters, type ) );
330 } 333 }
331 } 334 }
332 335
333 //set the addressee's delivery label 336 //set the addressee's delivery label
334 tmpStr = mVCard->getValue(VCARD_LABEL); 337 tmpStr = mVCard->getValue(VCARD_LABEL);
335 if (!tmpStr.isEmpty()) { 338 if (!tmpStr.isEmpty()) {