-rw-r--r-- | kabc/vcard21parser.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/kabc/vcard21parser.cpp b/kabc/vcard21parser.cpp index 277de22..60d02b8 100644 --- a/kabc/vcard21parser.cpp +++ b/kabc/vcard21parser.cpp | |||
@@ -77,331 +77,329 @@ bool VCardLineX::isValid() const | |||
77 | return true; | 77 | return true; |
78 | break; | 78 | break; |
79 | 79 | ||
80 | case 'e': | 80 | case 'e': |
81 | if ( name == VCARD_EMAIL && qualified && | 81 | if ( name == VCARD_EMAIL && qualified && |
82 | (qualifiers.contains(VCARD_EMAIL_INTERNET) || | 82 | (qualifiers.contains(VCARD_EMAIL_INTERNET) || |
83 | qualifiers.contains(VCARD_EMAIL_PREF) || | 83 | qualifiers.contains(VCARD_EMAIL_PREF) || |
84 | qualifiers.contains(VCARD_EMAIL_X400) | 84 | qualifiers.contains(VCARD_EMAIL_X400) |
85 | ) ) | 85 | ) ) |
86 | return true; | 86 | return true; |
87 | break; | 87 | break; |
88 | 88 | ||
89 | case 'f': | 89 | case 'f': |
90 | if ( name == VCARD_FN ) | 90 | if ( name == VCARD_FN ) |
91 | return true; | 91 | return true; |
92 | break; | 92 | break; |
93 | 93 | ||
94 | case 'g': | 94 | case 'g': |
95 | if ( name == VCARD_GEO ) | 95 | if ( name == VCARD_GEO ) |
96 | return true; | 96 | return true; |
97 | break; | 97 | break; |
98 | 98 | ||
99 | case 'k': | 99 | case 'k': |
100 | if ( name == VCARD_KEY && qualified && | 100 | if ( name == VCARD_KEY && qualified && |
101 | (qualifiers.contains(VCARD_KEY_X509) || | 101 | (qualifiers.contains(VCARD_KEY_X509) || |
102 | qualifiers.contains(VCARD_KEY_PGP) | 102 | qualifiers.contains(VCARD_KEY_PGP) |
103 | ) ) | 103 | ) ) |
104 | return true; | 104 | return true; |
105 | break; | 105 | break; |
106 | 106 | ||
107 | case 'l': | 107 | case 'l': |
108 | if ( name == VCARD_LABEL ) | 108 | if ( name == VCARD_LABEL ) |
109 | return true; | 109 | return true; |
110 | if ( name == VCARD_LOGO ) | 110 | if ( name == VCARD_LOGO ) |
111 | return true; | 111 | return true; |
112 | break; | 112 | break; |
113 | 113 | ||
114 | case 'm': | 114 | case 'm': |
115 | if ( name == VCARD_MAILER ) | 115 | if ( name == VCARD_MAILER ) |
116 | return true; | 116 | return true; |
117 | break; | 117 | break; |
118 | 118 | ||
119 | case 'n': | 119 | case 'n': |
120 | if ( name == VCARD_N ) | 120 | if ( name == VCARD_N ) |
121 | return true; | 121 | return true; |
122 | if ( name == VCARD_NAME ) | 122 | if ( name == VCARD_NAME ) |
123 | return true; | 123 | return true; |
124 | if ( name == VCARD_NICKNAME ) | 124 | if ( name == VCARD_NICKNAME ) |
125 | return true; | 125 | return true; |
126 | if ( name == VCARD_NOTE ) | 126 | if ( name == VCARD_NOTE ) |
127 | return true; | 127 | return true; |
128 | break; | 128 | break; |
129 | 129 | ||
130 | case 'o': | 130 | case 'o': |
131 | if ( name == VCARD_ORG ) | 131 | if ( name == VCARD_ORG ) |
132 | return true; | 132 | return true; |
133 | break; | 133 | break; |
134 | 134 | ||
135 | case 'p': | 135 | case 'p': |
136 | if ( name == VCARD_PHOTO ) | 136 | if ( name == VCARD_PHOTO ) |
137 | return true; | 137 | return true; |
138 | if ( name == VCARD_PROFILE ) | 138 | if ( name == VCARD_PROFILE ) |
139 | return true; | 139 | return true; |
140 | if ( name == VCARD_PRODID ) | 140 | if ( name == VCARD_PRODID ) |
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) | ||
175 | ) ) | 174 | ) ) |
176 | return true; | 175 | return true; |
177 | if ( name == VCARD_TZ ) | 176 | if ( name == VCARD_TZ ) |
178 | return true; | 177 | return true; |
179 | if ( name == VCARD_TITLE ) | 178 | if ( name == VCARD_TITLE ) |
180 | return true; | 179 | return true; |
181 | break; | 180 | break; |
182 | 181 | ||
183 | case 'u': | 182 | case 'u': |
184 | if ( name == VCARD_URL ) | 183 | if ( name == VCARD_URL ) |
185 | return true; | 184 | return true; |
186 | if ( name == VCARD_UID ) | 185 | if ( name == VCARD_UID ) |
187 | return true; | 186 | return true; |
188 | break; | 187 | break; |
189 | 188 | ||
190 | case 'v': | 189 | case 'v': |
191 | if ( name == VCARD_VERSION ) | 190 | if ( name == VCARD_VERSION ) |
192 | return true; | 191 | return true; |
193 | break; | 192 | break; |
194 | default: | 193 | default: |
195 | break; | 194 | break; |
196 | } | 195 | } |
197 | 196 | ||
198 | return false; | 197 | return false; |
199 | } | 198 | } |
200 | 199 | ||
201 | 200 | ||
202 | VCard21Parser::VCard21Parser() | 201 | VCard21Parser::VCard21Parser() |
203 | { | 202 | { |
204 | } | 203 | } |
205 | 204 | ||
206 | VCard21Parser::~VCard21Parser() | 205 | VCard21Parser::~VCard21Parser() |
207 | { | 206 | { |
208 | } | 207 | } |
209 | 208 | ||
210 | void VCard21Parser::readFromString(KABC::AddressBook *addressbook, const QString &data) | 209 | void VCard21Parser::readFromString(KABC::AddressBook *addressbook, const QString &data) |
211 | { | 210 | { |
212 | KABC::Addressee mAddressee = readFromString(data); | 211 | KABC::Addressee mAddressee = readFromString(data); |
213 | addressbook->insertAddressee(mAddressee); | 212 | addressbook->insertAddressee(mAddressee); |
214 | } | 213 | } |
215 | 214 | ||
216 | KABC::Addressee VCard21Parser::readFromString( const QString &data) | 215 | KABC::Addressee VCard21Parser::readFromString( const QString &data) |
217 | { | 216 | { |
218 | KABC::Addressee addressee; | 217 | KABC::Addressee addressee; |
219 | VCard21ParserImpl *mVCard = VCard21ParserImpl::parseVCard(data); | 218 | VCard21ParserImpl *mVCard = VCard21ParserImpl::parseVCard(data); |
220 | QString tmpStr; | 219 | QString tmpStr; |
221 | 220 | ||
222 | // Check if parsing failed | 221 | // Check if parsing failed |
223 | if (mVCard == 0) | 222 | if (mVCard == 0) |
224 | { | 223 | { |
225 | kdDebug() << "Parsing failed" << endl; | 224 | kdDebug() << "Parsing failed" << endl; |
226 | return addressee; | 225 | return addressee; |
227 | } | 226 | } |
228 | //set the addressees name and formated name | 227 | //set the addressees name and formated name |
229 | QStringList tmpList = mVCard->getValues(VCARD_N); | 228 | QStringList tmpList = mVCard->getValues(VCARD_N); |
230 | QString formattedName = ""; | 229 | QString formattedName = ""; |
231 | if (tmpList.count() > 0) | 230 | if (tmpList.count() > 0) |
232 | addressee.setFamilyName(tmpList[0]); | 231 | addressee.setFamilyName(tmpList[0]); |
233 | if (tmpList.count() > 1) | 232 | if (tmpList.count() > 1) |
234 | addressee.setGivenName(tmpList[1]); | 233 | addressee.setGivenName(tmpList[1]); |
235 | if (tmpList.count() > 2) | 234 | if (tmpList.count() > 2) |
236 | addressee.setAdditionalName(tmpList[2]); | 235 | addressee.setAdditionalName(tmpList[2]); |
237 | if (tmpList.count() > 3) | 236 | if (tmpList.count() > 3) |
238 | addressee.setPrefix(tmpList[3]); | 237 | addressee.setPrefix(tmpList[3]); |
239 | if (tmpList.count() > 4) | 238 | if (tmpList.count() > 4) |
240 | addressee.setSuffix(tmpList[4]); | 239 | addressee.setSuffix(tmpList[4]); |
241 | 240 | ||
242 | tmpStr = (mVCard->getValue(VCARD_FN)); | 241 | tmpStr = (mVCard->getValue(VCARD_FN)); |
243 | if (!tmpStr.isEmpty()) | 242 | if (!tmpStr.isEmpty()) |
244 | addressee.setFormattedName(tmpStr); | 243 | addressee.setFormattedName(tmpStr); |
245 | 244 | ||
246 | //set the addressee's nick name | 245 | //set the addressee's nick name |
247 | tmpStr = mVCard->getValue(VCARD_NICKNAME); | 246 | tmpStr = mVCard->getValue(VCARD_NICKNAME); |
248 | addressee.setNickName(tmpStr); | 247 | addressee.setNickName(tmpStr); |
249 | //set the addressee's organisation | 248 | //set the addressee's organisation |
250 | tmpStr = mVCard->getValue(VCARD_ORG); | 249 | tmpStr = mVCard->getValue(VCARD_ORG); |
251 | addressee.setOrganization(tmpStr); | 250 | addressee.setOrganization(tmpStr); |
252 | //set the addressee's title | 251 | //set the addressee's title |
253 | tmpStr = mVCard->getValue(VCARD_TITLE); | 252 | tmpStr = mVCard->getValue(VCARD_TITLE); |
254 | addressee.setTitle(tmpStr); | 253 | addressee.setTitle(tmpStr); |
255 | //set the addressee's email - we can only deal with two. The preferenced one and one other. | 254 | //set the addressee's email - we can only deal with two. The preferenced one and one other. |
256 | tmpStr = mVCard->getValue(VCARD_EMAIL, VCARD_EMAIL_INTERNET); | 255 | tmpStr = mVCard->getValue(VCARD_EMAIL, VCARD_EMAIL_INTERNET); |
257 | addressee.insertEmail(tmpStr, false); | 256 | addressee.insertEmail(tmpStr, false); |
258 | tmpStr = mVCard->getValue(VCARD_EMAIL,VCARD_EMAIL_PREF); | 257 | tmpStr = mVCard->getValue(VCARD_EMAIL,VCARD_EMAIL_PREF); |
259 | addressee.insertEmail(tmpStr, true); | 258 | addressee.insertEmail(tmpStr, true); |
260 | //set the addressee's url | 259 | //set the addressee's url |
261 | tmpStr = mVCard->getValue(VCARD_URL); | 260 | tmpStr = mVCard->getValue(VCARD_URL); |
262 | if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_WORK); | 261 | if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_WORK); |
263 | if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_HOME); | 262 | if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_HOME); |
264 | if (!tmpStr.isEmpty()) { | 263 | if (!tmpStr.isEmpty()) { |
265 | addressee.setUrl(KURL(tmpStr)); | 264 | addressee.setUrl(KURL(tmpStr)); |
266 | } | 265 | } |
267 | 266 | ||
268 | //set the addressee's birthday | 267 | //set the addressee's birthday |
269 | tmpStr = mVCard->getValue(VCARD_BDAY); | 268 | tmpStr = mVCard->getValue(VCARD_BDAY); |
270 | addressee.setBirthday(VCardStringToDate(tmpStr)); | 269 | addressee.setBirthday(VCardStringToDate(tmpStr)); |
271 | 270 | ||
272 | //set the addressee's phone numbers | 271 | //set the addressee's phone numbers |
273 | for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { | 272 | for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { |
274 | if ( (*i).name == VCARD_TEL ) { | 273 | if ( (*i).name == VCARD_TEL ) { |
275 | int type = 0; | 274 | int type = 0; |
276 | if ( (*i).qualified ) { | 275 | if ( (*i).qualified ) { |
277 | if ( (*i).qualifiers.contains( VCARD_TEL_HOME ) ) | 276 | if ( (*i).qualifiers.contains( VCARD_TEL_HOME ) ) |
278 | type |= PhoneNumber::Home; | 277 | type |= PhoneNumber::Home; |
279 | if ( (*i).qualifiers.contains( VCARD_TEL_WORK ) ) | 278 | if ( (*i).qualifiers.contains( VCARD_TEL_WORK ) ) |
280 | type |= PhoneNumber::Work; | 279 | type |= PhoneNumber::Work; |
281 | if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) ) | 280 | if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) ) |
282 | type |= PhoneNumber::Pref; | 281 | type |= PhoneNumber::Pref; |
283 | // if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) ) | 282 | if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) ) |
284 | // type |= PhoneNumber::Voice; | 283 | type |= PhoneNumber::Voice; |
285 | if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) ) | 284 | if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) ) |
286 | type |= PhoneNumber::Fax; | 285 | type |= PhoneNumber::Fax; |
287 | if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) ) | 286 | if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) ) |
288 | type |= PhoneNumber::Msg; | 287 | type |= PhoneNumber::Msg; |
289 | if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) ) | 288 | if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) ) |
290 | type |= PhoneNumber::Cell; | 289 | type |= PhoneNumber::Cell; |
291 | if ( (*i).qualifiers.contains( VCARD_TEL_PAGER ) ) | 290 | if ( (*i).qualifiers.contains( VCARD_TEL_PAGER ) ) |
292 | type |= PhoneNumber::Pager; | 291 | type |= PhoneNumber::Pager; |
293 | if ( (*i).qualifiers.contains( VCARD_TEL_BBS ) ) | 292 | if ( (*i).qualifiers.contains( VCARD_TEL_BBS ) ) |
294 | type |= PhoneNumber::Bbs; | 293 | type |= PhoneNumber::Bbs; |
295 | if ( (*i).qualifiers.contains( VCARD_TEL_MODEM ) ) | 294 | if ( (*i).qualifiers.contains( VCARD_TEL_MODEM ) ) |
296 | type |= PhoneNumber::Modem; | 295 | type |= PhoneNumber::Modem; |
297 | if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) ) | 296 | if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) ) |
298 | type |= PhoneNumber::Car; | 297 | type |= PhoneNumber::Car; |
299 | if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) ) | 298 | if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) ) |
300 | type |= PhoneNumber::Isdn; | 299 | type |= PhoneNumber::Isdn; |
301 | if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) ) | 300 | if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) ) |
302 | type |= PhoneNumber::Video; | 301 | type |= PhoneNumber::Video; |
303 | if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) ) | 302 | if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) ) |
304 | type |= PhoneNumber::Pcs; | 303 | type |= PhoneNumber::Pcs; |
305 | if ( (*i).qualifiers.contains( VCARD_TEL_SIP ) ) | 304 | |
306 | type |= PhoneNumber::Sip; | ||
307 | } | 305 | } |
308 | addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) ); | 306 | addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) ); |
309 | } | 307 | } |
310 | } | 308 | } |
311 | 309 | addressee.makePhoneNumbersOLcompatible(); | |
312 | //set the addressee's addresses | 310 | //set the addressee's addresses |
313 | for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { | 311 | for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { |
314 | if ( (*i).name == VCARD_ADR ) { | 312 | if ( (*i).name == VCARD_ADR ) { |
315 | int type = 0; | 313 | int type = 0; |
316 | if ( (*i).qualified ) { | 314 | if ( (*i).qualified ) { |
317 | if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) ) | 315 | if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) ) |
318 | type |= Address::Dom; | 316 | type |= Address::Dom; |
319 | if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) ) | 317 | if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) ) |
320 | type |= Address::Intl; | 318 | type |= Address::Intl; |
321 | if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) ) | 319 | if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) ) |
322 | type |= Address::Postal; | 320 | type |= Address::Postal; |
323 | if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) ) | 321 | if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) ) |
324 | type |= Address::Parcel; | 322 | type |= Address::Parcel; |
325 | if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) ) | 323 | if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) ) |
326 | type |= Address::Home; | 324 | type |= Address::Home; |
327 | if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) ) | 325 | if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) ) |
328 | type |= Address::Work; | 326 | type |= Address::Work; |
329 | if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) ) | 327 | if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) ) |
330 | type |= Address::Pref; | 328 | type |= Address::Pref; |
331 | } | 329 | } |
332 | addressee.insertAddress( readAddressFromQStringList( (*i).parameters, type ) ); | 330 | addressee.insertAddress( readAddressFromQStringList( (*i).parameters, type ) ); |
333 | } | 331 | } |
334 | } | 332 | } |
335 | 333 | ||
336 | //set the addressee's delivery label | 334 | //set the addressee's delivery label |
337 | tmpStr = mVCard->getValue(VCARD_LABEL); | 335 | tmpStr = mVCard->getValue(VCARD_LABEL); |
338 | if (!tmpStr.isEmpty()) { | 336 | if (!tmpStr.isEmpty()) { |
339 | qDebug("VCard21Parser::readFromString please verify if replace is correct"); | 337 | qDebug("VCard21Parser::readFromString please verify if replace is correct"); |
340 | //US tmpStr.replace("\r\n","\n"); | 338 | //US tmpStr.replace("\r\n","\n"); |
341 | tmpStr.replace( QRegExp("\r\n"), "\n" ); | 339 | tmpStr.replace( QRegExp("\r\n"), "\n" ); |
342 | Address tmpAddress; | 340 | Address tmpAddress; |
343 | tmpAddress.setLabel(tmpStr); | 341 | tmpAddress.setLabel(tmpStr); |
344 | addressee.insertAddress(tmpAddress); | 342 | addressee.insertAddress(tmpAddress); |
345 | } | 343 | } |
346 | 344 | ||
347 | //set the addressee's notes | 345 | //set the addressee's notes |
348 | tmpStr = mVCard->getValue(VCARD_NOTE); | 346 | tmpStr = mVCard->getValue(VCARD_NOTE); |
349 | qDebug("VCard21Parser::readFromString please verify if correct"); | 347 | qDebug("VCard21Parser::readFromString please verify if correct"); |
350 | //US tmpStr.replace("\r\n","\n"); | 348 | //US tmpStr.replace("\r\n","\n"); |
351 | tmpStr.replace( QRegExp("\r\n"), "\n" ); | 349 | tmpStr.replace( QRegExp("\r\n"), "\n" ); |
352 | addressee.setNote(tmpStr); | 350 | addressee.setNote(tmpStr); |
353 | 351 | ||
354 | //set the addressee's timezone | 352 | //set the addressee's timezone |
355 | tmpStr = mVCard->getValue(VCARD_TZ); | 353 | tmpStr = mVCard->getValue(VCARD_TZ); |
356 | TimeZone tmpZone(tmpStr.toInt()); | 354 | TimeZone tmpZone(tmpStr.toInt()); |
357 | addressee.setTimeZone(tmpZone); | 355 | addressee.setTimeZone(tmpZone); |
358 | 356 | ||
359 | //set the addressee's geographical position | 357 | //set the addressee's geographical position |
360 | tmpList = mVCard->getValues(VCARD_GEO); | 358 | tmpList = mVCard->getValues(VCARD_GEO); |
361 | if (tmpList.count()==2) | 359 | if (tmpList.count()==2) |
362 | { | 360 | { |
363 | tmpStr = tmpList[0]; | 361 | tmpStr = tmpList[0]; |
364 | float glat = tmpStr.toFloat(); | 362 | float glat = tmpStr.toFloat(); |
365 | tmpStr = tmpList[1]; | 363 | tmpStr = tmpList[1]; |
366 | float glong = tmpStr.toFloat(); | 364 | float glong = tmpStr.toFloat(); |
367 | Geo tmpGeo(glat,glong); | 365 | Geo tmpGeo(glat,glong); |
368 | addressee.setGeo(tmpGeo); | 366 | addressee.setGeo(tmpGeo); |
369 | } | 367 | } |
370 | 368 | ||
371 | //set the last revision date | 369 | //set the last revision date |
372 | tmpStr = mVCard->getValue(VCARD_REV); | 370 | tmpStr = mVCard->getValue(VCARD_REV); |
373 | addressee.setRevision(VCardStringToDate(tmpStr)); | 371 | addressee.setRevision(VCardStringToDate(tmpStr)); |
374 | 372 | ||
375 | //set the role of the addressee | 373 | //set the role of the addressee |
376 | tmpStr = mVCard->getValue(VCARD_ROLE); | 374 | tmpStr = mVCard->getValue(VCARD_ROLE); |
377 | addressee.setRole(tmpStr); | 375 | addressee.setRole(tmpStr); |
378 | 376 | ||
379 | return addressee; | 377 | return addressee; |
380 | } | 378 | } |
381 | 379 | ||
382 | 380 | ||
383 | 381 | ||
384 | KABC::Address VCard21Parser::readAddressFromQStringList ( const QStringList &data, const int type ) | 382 | KABC::Address VCard21Parser::readAddressFromQStringList ( const QStringList &data, const int type ) |
385 | { | 383 | { |
386 | KABC::Address mAddress; | 384 | KABC::Address mAddress; |
387 | mAddress.setType( type ); | 385 | mAddress.setType( type ); |
388 | 386 | ||
389 | if ( data.count() > 0 ) | 387 | if ( data.count() > 0 ) |
390 | mAddress.setPostOfficeBox( data[0] ); | 388 | mAddress.setPostOfficeBox( data[0] ); |
391 | if ( data.count() > 1 ) | 389 | if ( data.count() > 1 ) |
392 | mAddress.setExtended( data[1] ); | 390 | mAddress.setExtended( data[1] ); |
393 | if ( data.count() > 2 ) | 391 | if ( data.count() > 2 ) |
394 | mAddress.setStreet( data[2] ); | 392 | mAddress.setStreet( data[2] ); |
395 | if ( data.count() > 3 ) | 393 | if ( data.count() > 3 ) |
396 | mAddress.setLocality( data[3] ); | 394 | mAddress.setLocality( data[3] ); |
397 | if ( data.count() > 4 ) | 395 | if ( data.count() > 4 ) |
398 | mAddress.setRegion( data[4] ); | 396 | mAddress.setRegion( data[4] ); |
399 | if ( data.count() > 5 ) | 397 | if ( data.count() > 5 ) |
400 | mAddress.setPostalCode( data[5] ); | 398 | mAddress.setPostalCode( data[5] ); |
401 | if ( data.count() > 6 ) | 399 | if ( data.count() > 6 ) |
402 | mAddress.setCountry( data[6] ); | 400 | mAddress.setCountry( data[6] ); |
403 | 401 | ||
404 | return mAddress; | 402 | return mAddress; |
405 | } | 403 | } |
406 | 404 | ||
407 | 405 | ||