-rw-r--r-- | libopie/pim/ocontact.cpp | 11 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.cpp | 11 |
2 files changed, 12 insertions, 10 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp index 9230b8b..178559b 100644 --- a/libopie/pim/ocontact.cpp +++ b/libopie/pim/ocontact.cpp | |||
@@ -95,926 +95,927 @@ OContact::~OContact() | |||
95 | Sets the first name of the contact to \a str. | 95 | Sets the first name of the contact to \a str. |
96 | */ | 96 | */ |
97 | 97 | ||
98 | /*! \fn void OContact::setMiddleName( const QString &str ) | 98 | /*! \fn void OContact::setMiddleName( const QString &str ) |
99 | Sets the middle name of the contact to \a str. | 99 | Sets the middle name of the contact to \a str. |
100 | */ | 100 | */ |
101 | 101 | ||
102 | /*! \fn void OContact::setLastName( const QString &str ) | 102 | /*! \fn void OContact::setLastName( const QString &str ) |
103 | Sets the last name of the contact to \a str. | 103 | Sets the last name of the contact to \a str. |
104 | */ | 104 | */ |
105 | 105 | ||
106 | /*! \fn void OContact::setSuffix( const QString &str ) | 106 | /*! \fn void OContact::setSuffix( const QString &str ) |
107 | Sets the suffix of the contact to \a str. | 107 | Sets the suffix of the contact to \a str. |
108 | */ | 108 | */ |
109 | 109 | ||
110 | /*! \fn void OContact::setFileAs( const QString &str ) | 110 | /*! \fn void OContact::setFileAs( const QString &str ) |
111 | Sets the contact to filed as \a str. | 111 | Sets the contact to filed as \a str. |
112 | */ | 112 | */ |
113 | 113 | ||
114 | /*! \fn void OContact::setDefaultEmail( const QString &str ) | 114 | /*! \fn void OContact::setDefaultEmail( const QString &str ) |
115 | Sets the default email of the contact to \a str. | 115 | Sets the default email of the contact to \a str. |
116 | */ | 116 | */ |
117 | 117 | ||
118 | /*! \fn void OContact::setHomeStreet( const QString &str ) | 118 | /*! \fn void OContact::setHomeStreet( const QString &str ) |
119 | Sets the home street address of the contact to \a str. | 119 | Sets the home street address of the contact to \a str. |
120 | */ | 120 | */ |
121 | 121 | ||
122 | /*! \fn void OContact::setHomeCity( const QString &str ) | 122 | /*! \fn void OContact::setHomeCity( const QString &str ) |
123 | Sets the home city of the contact to \a str. | 123 | Sets the home city of the contact to \a str. |
124 | */ | 124 | */ |
125 | 125 | ||
126 | /*! \fn void OContact::setHomeState( const QString &str ) | 126 | /*! \fn void OContact::setHomeState( const QString &str ) |
127 | Sets the home state of the contact to \a str. | 127 | Sets the home state of the contact to \a str. |
128 | */ | 128 | */ |
129 | 129 | ||
130 | /*! \fn void OContact::setHomeZip( const QString &str ) | 130 | /*! \fn void OContact::setHomeZip( const QString &str ) |
131 | Sets the home zip code of the contact to \a str. | 131 | Sets the home zip code of the contact to \a str. |
132 | */ | 132 | */ |
133 | 133 | ||
134 | /*! \fn void OContact::setHomeCountry( const QString &str ) | 134 | /*! \fn void OContact::setHomeCountry( const QString &str ) |
135 | Sets the home country of the contact to \a str. | 135 | Sets the home country of the contact to \a str. |
136 | */ | 136 | */ |
137 | 137 | ||
138 | /*! \fn void OContact::setHomePhone( const QString &str ) | 138 | /*! \fn void OContact::setHomePhone( const QString &str ) |
139 | Sets the home phone number of the contact to \a str. | 139 | Sets the home phone number of the contact to \a str. |
140 | */ | 140 | */ |
141 | 141 | ||
142 | /*! \fn void OContact::setHomeFax( const QString &str ) | 142 | /*! \fn void OContact::setHomeFax( const QString &str ) |
143 | Sets the home fax number of the contact to \a str. | 143 | Sets the home fax number of the contact to \a str. |
144 | */ | 144 | */ |
145 | 145 | ||
146 | /*! \fn void OContact::setHomeMobile( const QString &str ) | 146 | /*! \fn void OContact::setHomeMobile( const QString &str ) |
147 | Sets the home mobile phone number of the contact to \a str. | 147 | Sets the home mobile phone number of the contact to \a str. |
148 | */ | 148 | */ |
149 | 149 | ||
150 | /*! \fn void OContact::setHomeWebpage( const QString &str ) | 150 | /*! \fn void OContact::setHomeWebpage( const QString &str ) |
151 | Sets the home webpage of the contact to \a str. | 151 | Sets the home webpage of the contact to \a str. |
152 | */ | 152 | */ |
153 | 153 | ||
154 | /*! \fn void OContact::setCompany( const QString &str ) | 154 | /*! \fn void OContact::setCompany( const QString &str ) |
155 | Sets the company for contact to \a str. | 155 | Sets the company for contact to \a str. |
156 | */ | 156 | */ |
157 | 157 | ||
158 | /*! \fn void OContact::setJobTitle( const QString &str ) | 158 | /*! \fn void OContact::setJobTitle( const QString &str ) |
159 | Sets the job title of the contact to \a str. | 159 | Sets the job title of the contact to \a str. |
160 | */ | 160 | */ |
161 | 161 | ||
162 | /*! \fn void OContact::setDepartment( const QString &str ) | 162 | /*! \fn void OContact::setDepartment( const QString &str ) |
163 | Sets the department for contact to \a str. | 163 | Sets the department for contact to \a str. |
164 | */ | 164 | */ |
165 | 165 | ||
166 | /*! \fn void OContact::setOffice( const QString &str ) | 166 | /*! \fn void OContact::setOffice( const QString &str ) |
167 | Sets the office for contact to \a str. | 167 | Sets the office for contact to \a str. |
168 | */ | 168 | */ |
169 | 169 | ||
170 | /*! \fn void OContact::setBusinessStreet( const QString &str ) | 170 | /*! \fn void OContact::setBusinessStreet( const QString &str ) |
171 | Sets the business street address of the contact to \a str. | 171 | Sets the business street address of the contact to \a str. |
172 | */ | 172 | */ |
173 | 173 | ||
174 | /*! \fn void OContact::setBusinessCity( const QString &str ) | 174 | /*! \fn void OContact::setBusinessCity( const QString &str ) |
175 | Sets the business city of the contact to \a str. | 175 | Sets the business city of the contact to \a str. |
176 | */ | 176 | */ |
177 | 177 | ||
178 | /*! \fn void OContact::setBusinessState( const QString &str ) | 178 | /*! \fn void OContact::setBusinessState( const QString &str ) |
179 | Sets the business state of the contact to \a str. | 179 | Sets the business state of the contact to \a str. |
180 | */ | 180 | */ |
181 | 181 | ||
182 | /*! \fn void OContact::setBusinessZip( const QString &str ) | 182 | /*! \fn void OContact::setBusinessZip( const QString &str ) |
183 | Sets the business zip code of the contact to \a str. | 183 | Sets the business zip code of the contact to \a str. |
184 | */ | 184 | */ |
185 | 185 | ||
186 | /*! \fn void OContact::setBusinessCountry( const QString &str ) | 186 | /*! \fn void OContact::setBusinessCountry( const QString &str ) |
187 | Sets the business country of the contact to \a str. | 187 | Sets the business country of the contact to \a str. |
188 | */ | 188 | */ |
189 | 189 | ||
190 | /*! \fn void OContact::setBusinessPhone( const QString &str ) | 190 | /*! \fn void OContact::setBusinessPhone( const QString &str ) |
191 | Sets the business phone number of the contact to \a str. | 191 | Sets the business phone number of the contact to \a str. |
192 | */ | 192 | */ |
193 | 193 | ||
194 | /*! \fn void OContact::setBusinessFax( const QString &str ) | 194 | /*! \fn void OContact::setBusinessFax( const QString &str ) |
195 | Sets the business fax number of the contact to \a str. | 195 | Sets the business fax number of the contact to \a str. |
196 | */ | 196 | */ |
197 | 197 | ||
198 | /*! \fn void OContact::setBusinessMobile( const QString &str ) | 198 | /*! \fn void OContact::setBusinessMobile( const QString &str ) |
199 | Sets the business mobile phone number of the contact to \a str. | 199 | Sets the business mobile phone number of the contact to \a str. |
200 | */ | 200 | */ |
201 | 201 | ||
202 | /*! \fn void OContact::setBusinessPager( const QString &str ) | 202 | /*! \fn void OContact::setBusinessPager( const QString &str ) |
203 | Sets the business pager number of the contact to \a str. | 203 | Sets the business pager number of the contact to \a str. |
204 | */ | 204 | */ |
205 | 205 | ||
206 | /*! \fn void OContact::setBusinessWebpage( const QString &str ) | 206 | /*! \fn void OContact::setBusinessWebpage( const QString &str ) |
207 | Sets the business webpage of the contact to \a str. | 207 | Sets the business webpage of the contact to \a str. |
208 | */ | 208 | */ |
209 | 209 | ||
210 | /*! \fn void OContact::setProfession( const QString &str ) | 210 | /*! \fn void OContact::setProfession( const QString &str ) |
211 | Sets the profession of the contact to \a str. | 211 | Sets the profession of the contact to \a str. |
212 | */ | 212 | */ |
213 | 213 | ||
214 | /*! \fn void OContact::setAssistant( const QString &str ) | 214 | /*! \fn void OContact::setAssistant( const QString &str ) |
215 | Sets the assistant of the contact to \a str. | 215 | Sets the assistant of the contact to \a str. |
216 | */ | 216 | */ |
217 | 217 | ||
218 | /*! \fn void OContact::setManager( const QString &str ) | 218 | /*! \fn void OContact::setManager( const QString &str ) |
219 | Sets the manager of the contact to \a str. | 219 | Sets the manager of the contact to \a str. |
220 | */ | 220 | */ |
221 | 221 | ||
222 | /*! \fn void OContact::setSpouse( const QString &str ) | 222 | /*! \fn void OContact::setSpouse( const QString &str ) |
223 | Sets the spouse of the contact to \a str. | 223 | Sets the spouse of the contact to \a str. |
224 | */ | 224 | */ |
225 | 225 | ||
226 | /*! \fn void OContact::setGender( const QString &str ) | 226 | /*! \fn void OContact::setGender( const QString &str ) |
227 | Sets the gender of the contact to \a str. | 227 | Sets the gender of the contact to \a str. |
228 | */ | 228 | */ |
229 | 229 | ||
230 | /*! \fn void OContact::setNickname( const QString &str ) | 230 | /*! \fn void OContact::setNickname( const QString &str ) |
231 | Sets the nickname of the contact to \a str. | 231 | Sets the nickname of the contact to \a str. |
232 | */ | 232 | */ |
233 | 233 | ||
234 | /*! \fn void OContact::setNotes( const QString &str ) | 234 | /*! \fn void OContact::setNotes( const QString &str ) |
235 | Sets the notes about the contact to \a str. | 235 | Sets the notes about the contact to \a str. |
236 | */ | 236 | */ |
237 | 237 | ||
238 | /*! \fn QString OContact::title() const | 238 | /*! \fn QString OContact::title() const |
239 | Returns the title of the contact. | 239 | Returns the title of the contact. |
240 | */ | 240 | */ |
241 | 241 | ||
242 | /*! \fn QString OContact::firstName() const | 242 | /*! \fn QString OContact::firstName() const |
243 | Returns the first name of the contact. | 243 | Returns the first name of the contact. |
244 | */ | 244 | */ |
245 | 245 | ||
246 | /*! \fn QString OContact::middleName() const | 246 | /*! \fn QString OContact::middleName() const |
247 | Returns the middle name of the contact. | 247 | Returns the middle name of the contact. |
248 | */ | 248 | */ |
249 | 249 | ||
250 | /*! \fn QString OContact::lastName() const | 250 | /*! \fn QString OContact::lastName() const |
251 | Returns the last name of the contact. | 251 | Returns the last name of the contact. |
252 | */ | 252 | */ |
253 | 253 | ||
254 | /*! \fn QString OContact::suffix() const | 254 | /*! \fn QString OContact::suffix() const |
255 | Returns the suffix of the contact. | 255 | Returns the suffix of the contact. |
256 | */ | 256 | */ |
257 | 257 | ||
258 | /*! \fn QString OContact::fileAs() const | 258 | /*! \fn QString OContact::fileAs() const |
259 | Returns the string the contact is filed as. | 259 | Returns the string the contact is filed as. |
260 | */ | 260 | */ |
261 | 261 | ||
262 | /*! \fn QString OContact::defaultEmail() const | 262 | /*! \fn QString OContact::defaultEmail() const |
263 | Returns the default email address of the contact. | 263 | Returns the default email address of the contact. |
264 | */ | 264 | */ |
265 | 265 | ||
266 | /*! \fn QString OContact::emails() const | 266 | /*! \fn QString OContact::emails() const |
267 | Returns the list of email address for a contact separated by ';'s in a single | 267 | Returns the list of email address for a contact separated by ';'s in a single |
268 | string. | 268 | string. |
269 | */ | 269 | */ |
270 | 270 | ||
271 | /*! \fn QString OContact::homeStreet() const | 271 | /*! \fn QString OContact::homeStreet() const |
272 | Returns the home street address of the contact. | 272 | Returns the home street address of the contact. |
273 | */ | 273 | */ |
274 | 274 | ||
275 | /*! \fn QString OContact::homeCity() const | 275 | /*! \fn QString OContact::homeCity() const |
276 | Returns the home city of the contact. | 276 | Returns the home city of the contact. |
277 | */ | 277 | */ |
278 | 278 | ||
279 | /*! \fn QString OContact::homeState() const | 279 | /*! \fn QString OContact::homeState() const |
280 | Returns the home state of the contact. | 280 | Returns the home state of the contact. |
281 | */ | 281 | */ |
282 | 282 | ||
283 | /*! \fn QString OContact::homeZip() const | 283 | /*! \fn QString OContact::homeZip() const |
284 | Returns the home zip of the contact. | 284 | Returns the home zip of the contact. |
285 | */ | 285 | */ |
286 | 286 | ||
287 | /*! \fn QString OContact::homeCountry() const | 287 | /*! \fn QString OContact::homeCountry() const |
288 | Returns the home country of the contact. | 288 | Returns the home country of the contact. |
289 | */ | 289 | */ |
290 | 290 | ||
291 | /*! \fn QString OContact::homePhone() const | 291 | /*! \fn QString OContact::homePhone() const |
292 | Returns the home phone number of the contact. | 292 | Returns the home phone number of the contact. |
293 | */ | 293 | */ |
294 | 294 | ||
295 | /*! \fn QString OContact::homeFax() const | 295 | /*! \fn QString OContact::homeFax() const |
296 | Returns the home fax number of the contact. | 296 | Returns the home fax number of the contact. |
297 | */ | 297 | */ |
298 | 298 | ||
299 | /*! \fn QString OContact::homeMobile() const | 299 | /*! \fn QString OContact::homeMobile() const |
300 | Returns the home mobile number of the contact. | 300 | Returns the home mobile number of the contact. |
301 | */ | 301 | */ |
302 | 302 | ||
303 | /*! \fn QString OContact::homeWebpage() const | 303 | /*! \fn QString OContact::homeWebpage() const |
304 | Returns the home webpage of the contact. | 304 | Returns the home webpage of the contact. |
305 | */ | 305 | */ |
306 | 306 | ||
307 | /*! \fn QString OContact::company() const | 307 | /*! \fn QString OContact::company() const |
308 | Returns the company for the contact. | 308 | Returns the company for the contact. |
309 | */ | 309 | */ |
310 | 310 | ||
311 | /*! \fn QString OContact::department() const | 311 | /*! \fn QString OContact::department() const |
312 | Returns the department for the contact. | 312 | Returns the department for the contact. |
313 | */ | 313 | */ |
314 | 314 | ||
315 | /*! \fn QString OContact::office() const | 315 | /*! \fn QString OContact::office() const |
316 | Returns the office for the contact. | 316 | Returns the office for the contact. |
317 | */ | 317 | */ |
318 | 318 | ||
319 | /*! \fn QString OContact::jobTitle() const | 319 | /*! \fn QString OContact::jobTitle() const |
320 | Returns the job title of the contact. | 320 | Returns the job title of the contact. |
321 | */ | 321 | */ |
322 | 322 | ||
323 | /*! \fn QString OContact::profession() const | 323 | /*! \fn QString OContact::profession() const |
324 | Returns the profession of the contact. | 324 | Returns the profession of the contact. |
325 | */ | 325 | */ |
326 | 326 | ||
327 | /*! \fn QString OContact::assistant() const | 327 | /*! \fn QString OContact::assistant() const |
328 | Returns the assistant of the contact. | 328 | Returns the assistant of the contact. |
329 | */ | 329 | */ |
330 | 330 | ||
331 | /*! \fn QString OContact::manager() const | 331 | /*! \fn QString OContact::manager() const |
332 | Returns the manager of the contact. | 332 | Returns the manager of the contact. |
333 | */ | 333 | */ |
334 | 334 | ||
335 | /*! \fn QString OContact::businessStreet() const | 335 | /*! \fn QString OContact::businessStreet() const |
336 | Returns the business street address of the contact. | 336 | Returns the business street address of the contact. |
337 | */ | 337 | */ |
338 | 338 | ||
339 | /*! \fn QString OContact::businessCity() const | 339 | /*! \fn QString OContact::businessCity() const |
340 | Returns the business city of the contact. | 340 | Returns the business city of the contact. |
341 | */ | 341 | */ |
342 | 342 | ||
343 | /*! \fn QString OContact::businessState() const | 343 | /*! \fn QString OContact::businessState() const |
344 | Returns the business state of the contact. | 344 | Returns the business state of the contact. |
345 | */ | 345 | */ |
346 | 346 | ||
347 | /*! \fn QString OContact::businessZip() const | 347 | /*! \fn QString OContact::businessZip() const |
348 | Returns the business zip of the contact. | 348 | Returns the business zip of the contact. |
349 | */ | 349 | */ |
350 | 350 | ||
351 | /*! \fn QString OContact::businessCountry() const | 351 | /*! \fn QString OContact::businessCountry() const |
352 | Returns the business country of the contact. | 352 | Returns the business country of the contact. |
353 | */ | 353 | */ |
354 | 354 | ||
355 | /*! \fn QString OContact::businessPhone() const | 355 | /*! \fn QString OContact::businessPhone() const |
356 | Returns the business phone number of the contact. | 356 | Returns the business phone number of the contact. |
357 | */ | 357 | */ |
358 | 358 | ||
359 | /*! \fn QString OContact::businessFax() const | 359 | /*! \fn QString OContact::businessFax() const |
360 | Returns the business fax number of the contact. | 360 | Returns the business fax number of the contact. |
361 | */ | 361 | */ |
362 | 362 | ||
363 | /*! \fn QString OContact::businessMobile() const | 363 | /*! \fn QString OContact::businessMobile() const |
364 | Returns the business mobile number of the contact. | 364 | Returns the business mobile number of the contact. |
365 | */ | 365 | */ |
366 | 366 | ||
367 | /*! \fn QString OContact::businessPager() const | 367 | /*! \fn QString OContact::businessPager() const |
368 | Returns the business pager number of the contact. | 368 | Returns the business pager number of the contact. |
369 | */ | 369 | */ |
370 | 370 | ||
371 | /*! \fn QString OContact::businessWebpage() const | 371 | /*! \fn QString OContact::businessWebpage() const |
372 | Returns the business webpage of the contact. | 372 | Returns the business webpage of the contact. |
373 | */ | 373 | */ |
374 | 374 | ||
375 | /*! \fn QString OContact::spouse() const | 375 | /*! \fn QString OContact::spouse() const |
376 | Returns the spouse of the contact. | 376 | Returns the spouse of the contact. |
377 | */ | 377 | */ |
378 | 378 | ||
379 | /*! \fn QString OContact::gender() const | 379 | /*! \fn QString OContact::gender() const |
380 | Returns the gender of the contact. | 380 | Returns the gender of the contact. |
381 | */ | 381 | */ |
382 | 382 | ||
383 | /*! \fn QString OContact::nickname() const | 383 | /*! \fn QString OContact::nickname() const |
384 | Returns the nickname of the contact. | 384 | Returns the nickname of the contact. |
385 | */ | 385 | */ |
386 | 386 | ||
387 | /*! \fn QString OContact::children() const | 387 | /*! \fn QString OContact::children() const |
388 | Returns the children of the contact. | 388 | Returns the children of the contact. |
389 | */ | 389 | */ |
390 | 390 | ||
391 | /*! \fn QString OContact::notes() const | 391 | /*! \fn QString OContact::notes() const |
392 | Returns the notes relating to the the contact. | 392 | Returns the notes relating to the the contact. |
393 | */ | 393 | */ |
394 | 394 | ||
395 | /*! \fn QString OContact::groups() const | 395 | /*! \fn QString OContact::groups() const |
396 | \internal | 396 | \internal |
397 | Returns the groups for the contact. | 397 | Returns the groups for the contact. |
398 | */ | 398 | */ |
399 | 399 | ||
400 | /*! \fn QStringList OContact::groupList() const | 400 | /*! \fn QStringList OContact::groupList() const |
401 | \internal | 401 | \internal |
402 | */ | 402 | */ |
403 | 403 | ||
404 | /*! \fn QString OContact::field(int) const | 404 | /*! \fn QString OContact::field(int) const |
405 | \internal | 405 | \internal |
406 | */ | 406 | */ |
407 | 407 | ||
408 | /*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) | 408 | /*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) |
409 | \internal | 409 | \internal |
410 | */ | 410 | */ |
411 | 411 | ||
412 | /*! \fn void OContact::setUid( int id ) | 412 | /*! \fn void OContact::setUid( int id ) |
413 | \internal | 413 | \internal |
414 | Sets the uid for this record to \a id. | 414 | Sets the uid for this record to \a id. |
415 | */ | 415 | */ |
416 | 416 | ||
417 | /*! \enum OContact::journal_action | 417 | /*! \enum OContact::journal_action |
418 | \internal | 418 | \internal |
419 | */ | 419 | */ |
420 | 420 | ||
421 | /*! | 421 | /*! |
422 | \internal | 422 | \internal |
423 | */ | 423 | */ |
424 | QMap<int, QString> OContact::toMap() const | 424 | QMap<int, QString> OContact::toMap() const |
425 | { | 425 | { |
426 | QMap<int, QString> map = mMap; | 426 | QMap<int, QString> map = mMap; |
427 | QString cats = idsToString( categories() ); | 427 | QString cats = idsToString( categories() ); |
428 | if ( !cats.isEmpty() ) | 428 | if ( !cats.isEmpty() ) |
429 | map.insert( Qtopia::AddressCategory, cats ); | 429 | map.insert( Qtopia::AddressCategory, cats ); |
430 | return map; | 430 | return map; |
431 | } | 431 | } |
432 | 432 | ||
433 | /*! | 433 | /*! |
434 | Returns a rich text formatted QString representing the contents the contact. | 434 | Returns a rich text formatted QString representing the contents the contact. |
435 | */ | 435 | */ |
436 | QString OContact::toRichText() const | 436 | QString OContact::toRichText() const |
437 | { | 437 | { |
438 | QString text; | 438 | QString text; |
439 | QString value, comp, state; | 439 | QString value, comp, state; |
440 | QString str; | 440 | QString str; |
441 | bool marker = false; | 441 | bool marker = false; |
442 | 442 | ||
443 | // name, jobtitle and company | 443 | // name, jobtitle and company |
444 | if ( !(value = fullName()).isEmpty() ) | 444 | if ( !(value = fullName()).isEmpty() ) |
445 | text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>"; | 445 | text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>"; |
446 | if ( !(value = jobTitle()).isEmpty() ) | 446 | if ( !(value = jobTitle()).isEmpty() ) |
447 | text += Qtopia::escapeString(value) + "<br>"; | 447 | text += Qtopia::escapeString(value) + "<br>"; |
448 | 448 | ||
449 | comp = company(); | 449 | comp = company(); |
450 | if ( !(value = department()).isEmpty() ) { | 450 | if ( !(value = department()).isEmpty() ) { |
451 | text += Qtopia::escapeString(value); | 451 | text += Qtopia::escapeString(value); |
452 | if ( comp ) | 452 | if ( comp ) |
453 | text += ", "; | 453 | text += ", "; |
454 | else | 454 | else |
455 | text += "<br>"; | 455 | text += "<br>"; |
456 | } | 456 | } |
457 | if ( !comp.isEmpty() ) | 457 | if ( !comp.isEmpty() ) |
458 | text += Qtopia::escapeString(comp) + "<br>"; | 458 | text += Qtopia::escapeString(comp) + "<br>"; |
459 | 459 | ||
460 | QString defEmail = defaultEmail(); | 460 | QString defEmail = defaultEmail(); |
461 | if ( !defEmail.isEmpty() ) | 461 | if ( !defEmail.isEmpty() ) |
462 | text += "<b>" + QObject::tr("Default Email: ") + "</b>" | 462 | text += "<b>" + QObject::tr("Default Email: ") + "</b>" |
463 | + Qtopia::escapeString(defEmail) + "<br>"; | 463 | + Qtopia::escapeString(defEmail) + "<br>"; |
464 | 464 | ||
465 | text += "<hr>"; | 465 | text += "<hr>"; |
466 | 466 | ||
467 | // business address | 467 | // business address |
468 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || | 468 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || |
469 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { | 469 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { |
470 | text += "<br>"; | 470 | text += "<br>"; |
471 | text += QObject::tr( "<b>Work Address:</b>" ); | 471 | text += QObject::tr( "<b>Work Address:</b>" ); |
472 | text += "<br>"; | 472 | text += "<br>"; |
473 | marker = true; | 473 | marker = true; |
474 | } | 474 | } |
475 | 475 | ||
476 | if ( !(value = businessStreet()).isEmpty() ) | 476 | if ( !(value = businessStreet()).isEmpty() ) |
477 | text += Qtopia::escapeString(value) + "<br>"; | 477 | text += Qtopia::escapeString(value) + "<br>"; |
478 | state = businessState(); | 478 | state = businessState(); |
479 | if ( !(value = businessZip()).isEmpty() ) | ||
480 | text += Qtopia::escapeString(value) + " "; | ||
479 | if ( !(value = businessCity()).isEmpty() ) { | 481 | if ( !(value = businessCity()).isEmpty() ) { |
480 | text += Qtopia::escapeString(value); | 482 | text += Qtopia::escapeString(value); |
481 | if ( state ) | 483 | if ( state ) |
482 | text += ", " + Qtopia::escapeString(state); | 484 | text += ", " + Qtopia::escapeString(state); |
483 | text += "<br>"; | 485 | text += "<br>"; |
484 | } else if ( !state.isEmpty() ) | 486 | } else if ( !state.isEmpty() ) |
485 | text += Qtopia::escapeString(state) + "<br>"; | 487 | text += Qtopia::escapeString(state) + "<br>"; |
486 | if ( !(value = businessZip()).isEmpty() ) | 488 | |
487 | text += Qtopia::escapeString(value) + "<br>"; | ||
488 | if ( !(value = businessCountry()).isEmpty() ) | 489 | if ( !(value = businessCountry()).isEmpty() ) |
489 | text += Qtopia::escapeString(value) + "<br>"; | 490 | text += Qtopia::escapeString(value) + "<br>"; |
490 | 491 | ||
491 | // rest of Business data | 492 | // rest of Business data |
492 | str = office(); | 493 | str = office(); |
493 | if ( !str.isEmpty() ){ | 494 | if ( !str.isEmpty() ){ |
494 | text += "<b>" + QObject::tr("Office: ") + "</b>" | 495 | text += "<b>" + QObject::tr("Office: ") + "</b>" |
495 | + Qtopia::escapeString(str) + "<br>"; | 496 | + Qtopia::escapeString(str) + "<br>"; |
496 | marker = true; | 497 | marker = true; |
497 | } | 498 | } |
498 | str = businessWebpage(); | 499 | str = businessWebpage(); |
499 | if ( !str.isEmpty() ){ | 500 | if ( !str.isEmpty() ){ |
500 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" | 501 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" |
501 | + Qtopia::escapeString(str) + "<br>"; | 502 | + Qtopia::escapeString(str) + "<br>"; |
502 | marker = true; | 503 | marker = true; |
503 | } | 504 | } |
504 | str = businessPhone(); | 505 | str = businessPhone(); |
505 | if ( !str.isEmpty() ){ | 506 | if ( !str.isEmpty() ){ |
506 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" | 507 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" |
507 | + Qtopia::escapeString(str) + "<br>"; | 508 | + Qtopia::escapeString(str) + "<br>"; |
508 | marker = true; | 509 | marker = true; |
509 | } | 510 | } |
510 | str = businessFax(); | 511 | str = businessFax(); |
511 | if ( !str.isEmpty() ){ | 512 | if ( !str.isEmpty() ){ |
512 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" | 513 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" |
513 | + Qtopia::escapeString(str) + "<br>"; | 514 | + Qtopia::escapeString(str) + "<br>"; |
514 | marker = true; | 515 | marker = true; |
515 | } | 516 | } |
516 | str = businessMobile(); | 517 | str = businessMobile(); |
517 | if ( !str.isEmpty() ){ | 518 | if ( !str.isEmpty() ){ |
518 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" | 519 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" |
519 | + Qtopia::escapeString(str) + "<br>"; | 520 | + Qtopia::escapeString(str) + "<br>"; |
520 | marker = true; | 521 | marker = true; |
521 | } | 522 | } |
522 | str = businessPager(); | 523 | str = businessPager(); |
523 | if ( !str.isEmpty() ){ | 524 | if ( !str.isEmpty() ){ |
524 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" | 525 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" |
525 | + Qtopia::escapeString(str) + "<br>"; | 526 | + Qtopia::escapeString(str) + "<br>"; |
526 | marker = true; | 527 | marker = true; |
527 | } | 528 | } |
528 | 529 | ||
529 | // home address | 530 | // home address |
530 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || | 531 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || |
531 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { | 532 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { |
532 | text += "<br>"; | 533 | text += "<br>"; |
533 | text += QObject::tr( "<b>Home Address:</b>" ); | 534 | text += QObject::tr( "<b>Home Address:</b>" ); |
534 | text += "<br>"; | 535 | text += "<br>"; |
535 | } | 536 | } |
536 | 537 | ||
537 | if ( !(value = homeStreet()).isEmpty() ) | 538 | if ( !(value = homeStreet()).isEmpty() ) |
538 | text += Qtopia::escapeString(value) + "<br>"; | 539 | text += Qtopia::escapeString(value) + "<br>"; |
539 | state = homeState(); | 540 | state = homeState(); |
541 | if ( !(value = homeZip()).isEmpty() ) | ||
542 | text += Qtopia::escapeString(value) + " "; | ||
540 | if ( !(value = homeCity()).isEmpty() ) { | 543 | if ( !(value = homeCity()).isEmpty() ) { |
541 | text += Qtopia::escapeString(value); | 544 | text += Qtopia::escapeString(value); |
542 | if ( !state.isEmpty() ) | 545 | if ( !state.isEmpty() ) |
543 | text += ", " + Qtopia::escapeString(state); | 546 | text += ", " + Qtopia::escapeString(state); |
544 | text += "<br>"; | 547 | text += "<br>"; |
545 | } else if (!state.isEmpty()) | 548 | } else if (!state.isEmpty()) |
546 | text += Qtopia::escapeString(state) + "<br>"; | 549 | text += Qtopia::escapeString(state) + "<br>"; |
547 | if ( !(value = homeZip()).isEmpty() ) | ||
548 | text += Qtopia::escapeString(value) + "<br>"; | ||
549 | if ( !(value = homeCountry()).isEmpty() ) | 550 | if ( !(value = homeCountry()).isEmpty() ) |
550 | text += Qtopia::escapeString(value) + "<br>"; | 551 | text += Qtopia::escapeString(value) + "<br>"; |
551 | 552 | ||
552 | // rest of Home data | 553 | // rest of Home data |
553 | str = homeWebpage(); | 554 | str = homeWebpage(); |
554 | if ( !str.isEmpty() ){ | 555 | if ( !str.isEmpty() ){ |
555 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" | 556 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" |
556 | + Qtopia::escapeString(str) + "<br>"; | 557 | + Qtopia::escapeString(str) + "<br>"; |
557 | marker = true; | 558 | marker = true; |
558 | } | 559 | } |
559 | str = homePhone(); | 560 | str = homePhone(); |
560 | if ( !str.isEmpty() ){ | 561 | if ( !str.isEmpty() ){ |
561 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" | 562 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" |
562 | + Qtopia::escapeString(str) + "<br>"; | 563 | + Qtopia::escapeString(str) + "<br>"; |
563 | marker = true; | 564 | marker = true; |
564 | } | 565 | } |
565 | str = homeFax(); | 566 | str = homeFax(); |
566 | if ( !str.isEmpty() ){ | 567 | if ( !str.isEmpty() ){ |
567 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" | 568 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" |
568 | + Qtopia::escapeString(str) + "<br>"; | 569 | + Qtopia::escapeString(str) + "<br>"; |
569 | marker = true; | 570 | marker = true; |
570 | } | 571 | } |
571 | str = homeMobile(); | 572 | str = homeMobile(); |
572 | if ( !str.isEmpty() ){ | 573 | if ( !str.isEmpty() ){ |
573 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" | 574 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" |
574 | + Qtopia::escapeString(str) + "<br>"; | 575 | + Qtopia::escapeString(str) + "<br>"; |
575 | marker = true; | 576 | marker = true; |
576 | } | 577 | } |
577 | 578 | ||
578 | if ( marker ) | 579 | if ( marker ) |
579 | text += "<br><hr><br>"; | 580 | text += "<br><hr><br>"; |
580 | // the others... | 581 | // the others... |
581 | str = emails(); | 582 | str = emails(); |
582 | if ( !str.isEmpty() && ( str != defEmail ) ) | 583 | if ( !str.isEmpty() && ( str != defEmail ) ) |
583 | text += "<b>" + QObject::tr("All Emails: ") + "</b>" | 584 | text += "<b>" + QObject::tr("All Emails: ") + "</b>" |
584 | + Qtopia::escapeString(str) + "<br>"; | 585 | + Qtopia::escapeString(str) + "<br>"; |
585 | str = profession(); | 586 | str = profession(); |
586 | if ( !str.isEmpty() ) | 587 | if ( !str.isEmpty() ) |
587 | text += "<b>" + QObject::tr("Profession: ") + "</b>" | 588 | text += "<b>" + QObject::tr("Profession: ") + "</b>" |
588 | + Qtopia::escapeString(str) + "<br>"; | 589 | + Qtopia::escapeString(str) + "<br>"; |
589 | str = assistant(); | 590 | str = assistant(); |
590 | if ( !str.isEmpty() ) | 591 | if ( !str.isEmpty() ) |
591 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" | 592 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" |
592 | + Qtopia::escapeString(str) + "<br>"; | 593 | + Qtopia::escapeString(str) + "<br>"; |
593 | str = manager(); | 594 | str = manager(); |
594 | if ( !str.isEmpty() ) | 595 | if ( !str.isEmpty() ) |
595 | text += "<b>" + QObject::tr("Manager: ") + "</b>" | 596 | text += "<b>" + QObject::tr("Manager: ") + "</b>" |
596 | + Qtopia::escapeString(str) + "<br>"; | 597 | + Qtopia::escapeString(str) + "<br>"; |
597 | str = gender(); | 598 | str = gender(); |
598 | if ( !str.isEmpty() && str.toInt() != 0 ) { | 599 | if ( !str.isEmpty() && str.toInt() != 0 ) { |
599 | if ( str.toInt() == 1 ) | 600 | if ( str.toInt() == 1 ) |
600 | str = QObject::tr( "Male" ); | 601 | str = QObject::tr( "Male" ); |
601 | else if ( str.toInt() == 2 ) | 602 | else if ( str.toInt() == 2 ) |
602 | str = QObject::tr( "Female" ); | 603 | str = QObject::tr( "Female" ); |
603 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; | 604 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; |
604 | } | 605 | } |
605 | str = spouse(); | 606 | str = spouse(); |
606 | if ( !str.isEmpty() ) | 607 | if ( !str.isEmpty() ) |
607 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" | 608 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" |
608 | + Qtopia::escapeString(str) + "<br>"; | 609 | + Qtopia::escapeString(str) + "<br>"; |
609 | if ( birthday().isValid() ){ | 610 | if ( birthday().isValid() ){ |
610 | str = TimeString::numberDateString( birthday() ); | 611 | str = TimeString::numberDateString( birthday() ); |
611 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" | 612 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" |
612 | + Qtopia::escapeString(str) + "<br>"; | 613 | + Qtopia::escapeString(str) + "<br>"; |
613 | } | 614 | } |
614 | if ( anniversary().isValid() ){ | 615 | if ( anniversary().isValid() ){ |
615 | str = TimeString::numberDateString( anniversary() ); | 616 | str = TimeString::numberDateString( anniversary() ); |
616 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" | 617 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" |
617 | + Qtopia::escapeString(str) + "<br>"; | 618 | + Qtopia::escapeString(str) + "<br>"; |
618 | } | 619 | } |
619 | str = children(); | 620 | str = children(); |
620 | if ( !str.isEmpty() ) | 621 | if ( !str.isEmpty() ) |
621 | text += "<b>" + QObject::tr("Children: ") + "</b>" | 622 | text += "<b>" + QObject::tr("Children: ") + "</b>" |
622 | + Qtopia::escapeString(str) + "<br>"; | 623 | + Qtopia::escapeString(str) + "<br>"; |
623 | 624 | ||
624 | str = nickname(); | 625 | str = nickname(); |
625 | if ( !str.isEmpty() ) | 626 | if ( !str.isEmpty() ) |
626 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" | 627 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" |
627 | + Qtopia::escapeString(str) + "<br>"; | 628 | + Qtopia::escapeString(str) + "<br>"; |
628 | 629 | ||
629 | if ( categoryNames().count() ){ | 630 | if ( categoryNames().count() ){ |
630 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 631 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
631 | text += categoryNames().join(", "); | 632 | text += categoryNames().join(", "); |
632 | text += "<br>"; | 633 | text += "<br>"; |
633 | } | 634 | } |
634 | 635 | ||
635 | // notes last | 636 | // notes last |
636 | if ( (value = notes()) ) { | 637 | if ( !(value = notes()).isEmpty() ) { |
637 | text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; | 638 | text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; |
638 | QRegExp reg("\n"); | 639 | QRegExp reg("\n"); |
639 | 640 | ||
640 | //QString tmp = Qtopia::escapeString(value); | 641 | //QString tmp = Qtopia::escapeString(value); |
641 | QString tmp = QStyleSheet::convertFromPlainText(value); | 642 | QString tmp = QStyleSheet::convertFromPlainText(value); |
642 | //tmp.replace( reg, "<br>" ); | 643 | //tmp.replace( reg, "<br>" ); |
643 | text += "<br>" + tmp + "<br>"; | 644 | text += "<br>" + tmp + "<br>"; |
644 | } | 645 | } |
645 | return text; | 646 | return text; |
646 | } | 647 | } |
647 | 648 | ||
648 | /*! | 649 | /*! |
649 | \internal | 650 | \internal |
650 | */ | 651 | */ |
651 | void OContact::insert( int key, const QString &v ) | 652 | void OContact::insert( int key, const QString &v ) |
652 | { | 653 | { |
653 | QString value = v.stripWhiteSpace(); | 654 | QString value = v.stripWhiteSpace(); |
654 | if ( value.isEmpty() ) | 655 | if ( value.isEmpty() ) |
655 | mMap.remove( key ); | 656 | mMap.remove( key ); |
656 | else | 657 | else |
657 | mMap.insert( key, value ); | 658 | mMap.insert( key, value ); |
658 | } | 659 | } |
659 | 660 | ||
660 | /*! | 661 | /*! |
661 | \internal | 662 | \internal |
662 | */ | 663 | */ |
663 | void OContact::replace( int key, const QString & v ) | 664 | void OContact::replace( int key, const QString & v ) |
664 | { | 665 | { |
665 | QString value = v.stripWhiteSpace(); | 666 | QString value = v.stripWhiteSpace(); |
666 | if ( value.isEmpty() ) | 667 | if ( value.isEmpty() ) |
667 | mMap.remove( key ); | 668 | mMap.remove( key ); |
668 | else | 669 | else |
669 | mMap.replace( key, value ); | 670 | mMap.replace( key, value ); |
670 | } | 671 | } |
671 | 672 | ||
672 | /*! | 673 | /*! |
673 | \internal | 674 | \internal |
674 | */ | 675 | */ |
675 | QString OContact::find( int key ) const | 676 | QString OContact::find( int key ) const |
676 | { | 677 | { |
677 | return mMap[key]; | 678 | return mMap[key]; |
678 | } | 679 | } |
679 | 680 | ||
680 | /*! | 681 | /*! |
681 | \internal | 682 | \internal |
682 | */ | 683 | */ |
683 | QString OContact::displayAddress( const QString &street, | 684 | QString OContact::displayAddress( const QString &street, |
684 | const QString &city, | 685 | const QString &city, |
685 | const QString &state, | 686 | const QString &state, |
686 | const QString &zip, | 687 | const QString &zip, |
687 | const QString &country ) const | 688 | const QString &country ) const |
688 | { | 689 | { |
689 | QString s = street; | 690 | QString s = street; |
690 | if ( !street.isEmpty() ) | 691 | if ( !street.isEmpty() ) |
691 | s+= "\n"; | 692 | s+= "\n"; |
692 | s += city; | 693 | s += city; |
693 | if ( !city.isEmpty() && !state.isEmpty() ) | 694 | if ( !city.isEmpty() && !state.isEmpty() ) |
694 | s += ", "; | 695 | s += ", "; |
695 | s += state; | 696 | s += state; |
696 | if ( !state.isEmpty() && !zip.isEmpty() ) | 697 | if ( !state.isEmpty() && !zip.isEmpty() ) |
697 | s += " "; | 698 | s += " "; |
698 | s += zip; | 699 | s += zip; |
699 | if ( !country.isEmpty() && !s.isEmpty() ) | 700 | if ( !country.isEmpty() && !s.isEmpty() ) |
700 | s += "\n"; | 701 | s += "\n"; |
701 | s += country; | 702 | s += country; |
702 | return s; | 703 | return s; |
703 | } | 704 | } |
704 | 705 | ||
705 | /*! | 706 | /*! |
706 | \internal | 707 | \internal |
707 | */ | 708 | */ |
708 | QString OContact::displayBusinessAddress() const | 709 | QString OContact::displayBusinessAddress() const |
709 | { | 710 | { |
710 | return displayAddress( businessStreet(), businessCity(), | 711 | return displayAddress( businessStreet(), businessCity(), |
711 | businessState(), businessZip(), | 712 | businessState(), businessZip(), |
712 | businessCountry() ); | 713 | businessCountry() ); |
713 | } | 714 | } |
714 | 715 | ||
715 | /*! | 716 | /*! |
716 | \internal | 717 | \internal |
717 | */ | 718 | */ |
718 | QString OContact::displayHomeAddress() const | 719 | QString OContact::displayHomeAddress() const |
719 | { | 720 | { |
720 | return displayAddress( homeStreet(), homeCity(), | 721 | return displayAddress( homeStreet(), homeCity(), |
721 | homeState(), homeZip(), | 722 | homeState(), homeZip(), |
722 | homeCountry() ); | 723 | homeCountry() ); |
723 | } | 724 | } |
724 | 725 | ||
725 | /*! | 726 | /*! |
726 | Returns the full name of the contact | 727 | Returns the full name of the contact |
727 | */ | 728 | */ |
728 | QString OContact::fullName() const | 729 | QString OContact::fullName() const |
729 | { | 730 | { |
730 | QString title = find( Qtopia::Title ); | 731 | QString title = find( Qtopia::Title ); |
731 | QString firstName = find( Qtopia::FirstName ); | 732 | QString firstName = find( Qtopia::FirstName ); |
732 | QString middleName = find( Qtopia::MiddleName ); | 733 | QString middleName = find( Qtopia::MiddleName ); |
733 | QString lastName = find( Qtopia::LastName ); | 734 | QString lastName = find( Qtopia::LastName ); |
734 | QString suffix = find( Qtopia::Suffix ); | 735 | QString suffix = find( Qtopia::Suffix ); |
735 | 736 | ||
736 | QString name = title; | 737 | QString name = title; |
737 | if ( !firstName.isEmpty() ) { | 738 | if ( !firstName.isEmpty() ) { |
738 | if ( !name.isEmpty() ) | 739 | if ( !name.isEmpty() ) |
739 | name += " "; | 740 | name += " "; |
740 | name += firstName; | 741 | name += firstName; |
741 | } | 742 | } |
742 | if ( !middleName.isEmpty() ) { | 743 | if ( !middleName.isEmpty() ) { |
743 | if ( !name.isEmpty() ) | 744 | if ( !name.isEmpty() ) |
744 | name += " "; | 745 | name += " "; |
745 | name += middleName; | 746 | name += middleName; |
746 | } | 747 | } |
747 | if ( !lastName.isEmpty() ) { | 748 | if ( !lastName.isEmpty() ) { |
748 | if ( !name.isEmpty() ) | 749 | if ( !name.isEmpty() ) |
749 | name += " "; | 750 | name += " "; |
750 | name += lastName; | 751 | name += lastName; |
751 | } | 752 | } |
752 | if ( !suffix.isEmpty() ) { | 753 | if ( !suffix.isEmpty() ) { |
753 | if ( !name.isEmpty() ) | 754 | if ( !name.isEmpty() ) |
754 | name += " "; | 755 | name += " "; |
755 | name += suffix; | 756 | name += suffix; |
756 | } | 757 | } |
757 | return name.simplifyWhiteSpace(); | 758 | return name.simplifyWhiteSpace(); |
758 | } | 759 | } |
759 | 760 | ||
760 | /*! | 761 | /*! |
761 | Returns a list of the names of the children of the contact. | 762 | Returns a list of the names of the children of the contact. |
762 | */ | 763 | */ |
763 | QStringList OContact::childrenList() const | 764 | QStringList OContact::childrenList() const |
764 | { | 765 | { |
765 | return QStringList::split( " ", find( Qtopia::Children ) ); | 766 | return QStringList::split( " ", find( Qtopia::Children ) ); |
766 | } | 767 | } |
767 | 768 | ||
768 | /*! \fn void OContact::insertEmail( const QString &email ) | 769 | /*! \fn void OContact::insertEmail( const QString &email ) |
769 | 770 | ||
770 | Insert \a email into the email list. Ensures \a email can only be added | 771 | Insert \a email into the email list. Ensures \a email can only be added |
771 | once. If there is no default email address set, it sets it to the \a email. | 772 | once. If there is no default email address set, it sets it to the \a email. |
772 | */ | 773 | */ |
773 | 774 | ||
774 | /*! \fn void OContact::removeEmail( const QString &email ) | 775 | /*! \fn void OContact::removeEmail( const QString &email ) |
775 | 776 | ||
776 | Removes the \a email from the email list. If the default email was \a email, | 777 | Removes the \a email from the email list. If the default email was \a email, |
777 | then the default email address is assigned to the first email in the | 778 | then the default email address is assigned to the first email in the |
778 | email list | 779 | email list |
779 | */ | 780 | */ |
780 | 781 | ||
781 | /*! \fn void OContact::clearEmails() | 782 | /*! \fn void OContact::clearEmails() |
782 | 783 | ||
783 | Clears the email list. | 784 | Clears the email list. |
784 | */ | 785 | */ |
785 | 786 | ||
786 | /*! \fn void OContact::insertEmails( const QStringList &emailList ) | 787 | /*! \fn void OContact::insertEmails( const QStringList &emailList ) |
787 | 788 | ||
788 | Appends the \a emailList to the exiting email list | 789 | Appends the \a emailList to the exiting email list |
789 | */ | 790 | */ |
790 | 791 | ||
791 | /*! | 792 | /*! |
792 | Returns a list of email addresses belonging to the contact, including | 793 | Returns a list of email addresses belonging to the contact, including |
793 | the default email address. | 794 | the default email address. |
794 | */ | 795 | */ |
795 | QStringList OContact::emailList() const | 796 | QStringList OContact::emailList() const |
796 | { | 797 | { |
797 | QString emailStr = emails(); | 798 | QString emailStr = emails(); |
798 | 799 | ||
799 | QStringList r; | 800 | QStringList r; |
800 | if ( !emailStr.isEmpty() ) { | 801 | if ( !emailStr.isEmpty() ) { |
801 | qDebug(" emailstr "); | 802 | qDebug(" emailstr "); |
802 | QStringList l = QStringList::split( emailSeparator(), emailStr ); | 803 | QStringList l = QStringList::split( emailSeparator(), emailStr ); |
803 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) | 804 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) |
804 | r += (*it).simplifyWhiteSpace(); | 805 | r += (*it).simplifyWhiteSpace(); |
805 | } | 806 | } |
806 | 807 | ||
807 | return r; | 808 | return r; |
808 | } | 809 | } |
809 | 810 | ||
810 | /*! | 811 | /*! |
811 | \overload | 812 | \overload |
812 | 813 | ||
813 | Generates the string for the contact to be filed as from the first, | 814 | Generates the string for the contact to be filed as from the first, |
814 | middle and last name of the contact. | 815 | middle and last name of the contact. |
815 | */ | 816 | */ |
816 | void OContact::setFileAs() | 817 | void OContact::setFileAs() |
817 | { | 818 | { |
818 | QString lastName, firstName, middleName, fileas; | 819 | QString lastName, firstName, middleName, fileas; |
819 | 820 | ||
820 | lastName = find( Qtopia::LastName ); | 821 | lastName = find( Qtopia::LastName ); |
821 | firstName = find( Qtopia::FirstName ); | 822 | firstName = find( Qtopia::FirstName ); |
822 | middleName = find( Qtopia::MiddleName ); | 823 | middleName = find( Qtopia::MiddleName ); |
823 | if ( !lastName.isEmpty() && !firstName.isEmpty() | 824 | if ( !lastName.isEmpty() && !firstName.isEmpty() |
824 | && !middleName.isEmpty() ) | 825 | && !middleName.isEmpty() ) |
825 | fileas = lastName + ", " + firstName + " " + middleName; | 826 | fileas = lastName + ", " + firstName + " " + middleName; |
826 | else if ( !lastName.isEmpty() && !firstName.isEmpty() ) | 827 | else if ( !lastName.isEmpty() && !firstName.isEmpty() ) |
827 | fileas = lastName + ", " + firstName; | 828 | fileas = lastName + ", " + firstName; |
828 | else if ( !lastName.isEmpty() || !firstName.isEmpty() || | 829 | else if ( !lastName.isEmpty() || !firstName.isEmpty() || |
829 | !middleName.isEmpty() ) | 830 | !middleName.isEmpty() ) |
830 | fileas = firstName + ( firstName.isEmpty() ? "" : " " ) | 831 | fileas = firstName + ( firstName.isEmpty() ? "" : " " ) |
831 | + middleName + ( middleName.isEmpty() ? "" : " " ) | 832 | + middleName + ( middleName.isEmpty() ? "" : " " ) |
832 | + lastName; | 833 | + lastName; |
833 | 834 | ||
834 | replace( Qtopia::FileAs, fileas ); | 835 | replace( Qtopia::FileAs, fileas ); |
835 | } | 836 | } |
836 | 837 | ||
837 | /*! | 838 | /*! |
838 | \internal | 839 | \internal |
839 | Appends the contact information to \a buf. | 840 | Appends the contact information to \a buf. |
840 | */ | 841 | */ |
841 | void OContact::save( QString &buf ) const | 842 | void OContact::save( QString &buf ) const |
842 | { | 843 | { |
843 | static const QStringList SLFIELDS = fields(); | 844 | static const QStringList SLFIELDS = fields(); |
844 | // I'm expecting "<Contact " in front of this... | 845 | // I'm expecting "<Contact " in front of this... |
845 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); | 846 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); |
846 | it != mMap.end(); ++it ) { | 847 | it != mMap.end(); ++it ) { |
847 | const QString &value = it.data(); | 848 | const QString &value = it.data(); |
848 | int key = it.key(); | 849 | int key = it.key(); |
849 | if ( !value.isEmpty() ) { | 850 | if ( !value.isEmpty() ) { |
850 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) | 851 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) |
851 | continue; | 852 | continue; |
852 | 853 | ||
853 | key -= Qtopia::AddressCategory+1; | 854 | key -= Qtopia::AddressCategory+1; |
854 | buf += SLFIELDS[key]; | 855 | buf += SLFIELDS[key]; |
855 | buf += "=\"" + Qtopia::escapeString(value) + "\" "; | 856 | buf += "=\"" + Qtopia::escapeString(value) + "\" "; |
856 | } | 857 | } |
857 | } | 858 | } |
858 | buf += customToXml(); | 859 | buf += customToXml(); |
859 | if ( categories().count() > 0 ) | 860 | if ( categories().count() > 0 ) |
860 | buf += "Categories=\"" + idsToString( categories() ) + "\" "; | 861 | buf += "Categories=\"" + idsToString( categories() ) + "\" "; |
861 | buf += "Uid=\"" + QString::number( uid() ) + "\" "; | 862 | buf += "Uid=\"" + QString::number( uid() ) + "\" "; |
862 | // You need to close this yourself | 863 | // You need to close this yourself |
863 | } | 864 | } |
864 | 865 | ||
865 | 866 | ||
866 | /*! | 867 | /*! |
867 | \internal | 868 | \internal |
868 | Returns the list of fields belonging to a contact | 869 | Returns the list of fields belonging to a contact |
869 | Never change order of this list ! It has to be regarding | 870 | Never change order of this list ! It has to be regarding |
870 | enum AddressBookFields !! | 871 | enum AddressBookFields !! |
871 | */ | 872 | */ |
872 | QStringList OContact::fields() | 873 | QStringList OContact::fields() |
873 | { | 874 | { |
874 | QStringList list; | 875 | QStringList list; |
875 | 876 | ||
876 | list.append( "Title" ); // Not Used! | 877 | list.append( "Title" ); // Not Used! |
877 | list.append( "FirstName" ); | 878 | list.append( "FirstName" ); |
878 | list.append( "MiddleName" ); | 879 | list.append( "MiddleName" ); |
879 | list.append( "LastName" ); | 880 | list.append( "LastName" ); |
880 | list.append( "Suffix" ); | 881 | list.append( "Suffix" ); |
881 | list.append( "FileAs" ); | 882 | list.append( "FileAs" ); |
882 | 883 | ||
883 | list.append( "JobTitle" ); | 884 | list.append( "JobTitle" ); |
884 | list.append( "Department" ); | 885 | list.append( "Department" ); |
885 | list.append( "Company" ); | 886 | list.append( "Company" ); |
886 | list.append( "BusinessPhone" ); | 887 | list.append( "BusinessPhone" ); |
887 | list.append( "BusinessFax" ); | 888 | list.append( "BusinessFax" ); |
888 | list.append( "BusinessMobile" ); | 889 | list.append( "BusinessMobile" ); |
889 | 890 | ||
890 | list.append( "DefaultEmail" ); | 891 | list.append( "DefaultEmail" ); |
891 | list.append( "Emails" ); | 892 | list.append( "Emails" ); |
892 | 893 | ||
893 | list.append( "HomePhone" ); | 894 | list.append( "HomePhone" ); |
894 | list.append( "HomeFax" ); | 895 | list.append( "HomeFax" ); |
895 | list.append( "HomeMobile" ); | 896 | list.append( "HomeMobile" ); |
896 | 897 | ||
897 | list.append( "BusinessStreet" ); | 898 | list.append( "BusinessStreet" ); |
898 | list.append( "BusinessCity" ); | 899 | list.append( "BusinessCity" ); |
899 | list.append( "BusinessState" ); | 900 | list.append( "BusinessState" ); |
900 | list.append( "BusinessZip" ); | 901 | list.append( "BusinessZip" ); |
901 | list.append( "BusinessCountry" ); | 902 | list.append( "BusinessCountry" ); |
902 | list.append( "BusinessPager" ); | 903 | list.append( "BusinessPager" ); |
903 | list.append( "BusinessWebPage" ); | 904 | list.append( "BusinessWebPage" ); |
904 | 905 | ||
905 | list.append( "Office" ); | 906 | list.append( "Office" ); |
906 | list.append( "Profession" ); | 907 | list.append( "Profession" ); |
907 | list.append( "Assistant" ); | 908 | list.append( "Assistant" ); |
908 | list.append( "Manager" ); | 909 | list.append( "Manager" ); |
909 | 910 | ||
910 | list.append( "HomeStreet" ); | 911 | list.append( "HomeStreet" ); |
911 | list.append( "HomeCity" ); | 912 | list.append( "HomeCity" ); |
912 | list.append( "HomeState" ); | 913 | list.append( "HomeState" ); |
913 | list.append( "HomeZip" ); | 914 | list.append( "HomeZip" ); |
914 | list.append( "HomeCountry" ); | 915 | list.append( "HomeCountry" ); |
915 | list.append( "HomeWebPage" ); | 916 | list.append( "HomeWebPage" ); |
916 | 917 | ||
917 | list.append( "Spouse" ); | 918 | list.append( "Spouse" ); |
918 | list.append( "Gender" ); | 919 | list.append( "Gender" ); |
919 | list.append( "Birthday" ); | 920 | list.append( "Birthday" ); |
920 | list.append( "Anniversary" ); | 921 | list.append( "Anniversary" ); |
921 | list.append( "Nickname" ); | 922 | list.append( "Nickname" ); |
922 | list.append( "Children" ); | 923 | list.append( "Children" ); |
923 | 924 | ||
924 | list.append( "Notes" ); | 925 | list.append( "Notes" ); |
925 | list.append( "Groups" ); | 926 | list.append( "Groups" ); |
926 | 927 | ||
927 | return list; | 928 | return list; |
928 | } | 929 | } |
929 | 930 | ||
930 | 931 | ||
931 | /*! | 932 | /*! |
932 | Sets the list of email address for contact to those contained in \a str. | 933 | Sets the list of email address for contact to those contained in \a str. |
933 | Email address should be separated by ';'s. | 934 | Email address should be separated by ';'s. |
934 | */ | 935 | */ |
935 | void OContact::setEmails( const QString &str ) | 936 | void OContact::setEmails( const QString &str ) |
936 | { | 937 | { |
937 | replace( Qtopia::Emails, str ); | 938 | replace( Qtopia::Emails, str ); |
938 | if ( str.isEmpty() ) | 939 | if ( str.isEmpty() ) |
939 | setDefaultEmail( QString::null ); | 940 | setDefaultEmail( QString::null ); |
940 | } | 941 | } |
941 | 942 | ||
942 | /*! | 943 | /*! |
943 | Sets the list of children for the contact to those contained in \a str. | 944 | Sets the list of children for the contact to those contained in \a str. |
944 | */ | 945 | */ |
945 | void OContact::setChildren( const QString &str ) | 946 | void OContact::setChildren( const QString &str ) |
946 | { | 947 | { |
947 | replace( Qtopia::Children, str ); | 948 | replace( Qtopia::Children, str ); |
948 | } | 949 | } |
949 | 950 | ||
950 | /*! | 951 | /*! |
951 | Returns TRUE if the contact matches the regular expression \a regexp. | 952 | Returns TRUE if the contact matches the regular expression \a regexp. |
952 | Otherwise returns FALSE. | 953 | Otherwise returns FALSE. |
953 | */ | 954 | */ |
954 | bool OContact::match( const QString ®exp ) const | 955 | bool OContact::match( const QString ®exp ) const |
955 | { | 956 | { |
956 | return match(QRegExp(regexp)); | 957 | return match(QRegExp(regexp)); |
957 | } | 958 | } |
958 | 959 | ||
959 | /*! | 960 | /*! |
960 | \overload | 961 | \overload |
961 | Returns TRUE if the contact matches the regular expression \a regexp. | 962 | Returns TRUE if the contact matches the regular expression \a regexp. |
962 | Otherwise returns FALSE. | 963 | Otherwise returns FALSE. |
963 | */ | 964 | */ |
964 | bool OContact::match( const QRegExp &r ) const | 965 | bool OContact::match( const QRegExp &r ) const |
965 | { | 966 | { |
966 | bool match; | 967 | bool match; |
967 | match = false; | 968 | match = false; |
968 | QMap<int, QString>::ConstIterator it; | 969 | QMap<int, QString>::ConstIterator it; |
969 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { | 970 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { |
970 | if ( (*it).find( r ) > -1 ) { | 971 | if ( (*it).find( r ) > -1 ) { |
971 | match = true; | 972 | match = true; |
972 | break; | 973 | break; |
973 | } | 974 | } |
974 | } | 975 | } |
975 | return match; | 976 | return match; |
976 | } | 977 | } |
977 | 978 | ||
978 | 979 | ||
979 | QString OContact::toShortText() const | 980 | QString OContact::toShortText() const |
980 | { | 981 | { |
981 | return ( fullName() ); | 982 | return ( fullName() ); |
982 | } | 983 | } |
983 | QString OContact::type() const | 984 | QString OContact::type() const |
984 | { | 985 | { |
985 | return QString::fromLatin1( "OContact" ); | 986 | return QString::fromLatin1( "OContact" ); |
986 | } | 987 | } |
987 | 988 | ||
988 | // Definition is missing ! (se) | 989 | // Definition is missing ! (se) |
989 | QMap<QString,QString> OContact::toExtraMap() const | 990 | QMap<QString,QString> OContact::toExtraMap() const |
990 | { | 991 | { |
991 | qWarning ("Function not implemented: OContact::toExtraMap()"); | 992 | qWarning ("Function not implemented: OContact::toExtraMap()"); |
992 | QMap <QString,QString> useless; | 993 | QMap <QString,QString> useless; |
993 | return useless; | 994 | return useless; |
994 | } | 995 | } |
995 | 996 | ||
996 | class QString OContact::recordField( int pos ) const | 997 | class QString OContact::recordField( int pos ) const |
997 | { | 998 | { |
998 | QStringList SLFIELDS = fields(); // ?? why this ? (se) | 999 | QStringList SLFIELDS = fields(); // ?? why this ? (se) |
999 | return SLFIELDS[pos]; | 1000 | return SLFIELDS[pos]; |
1000 | } | 1001 | } |
1001 | 1002 | ||
1002 | // In future releases, we should store birthday and anniversary | 1003 | // In future releases, we should store birthday and anniversary |
1003 | // internally as QDate instead of QString ! | 1004 | // internally as QDate instead of QString ! |
1004 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) | 1005 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) |
1005 | 1006 | ||
1006 | /*! \fn void OContact::setBirthday( const QDate& date ) | 1007 | /*! \fn void OContact::setBirthday( const QDate& date ) |
1007 | Sets the birthday for the contact to \a date. If date is null | 1008 | Sets the birthday for the contact to \a date. If date is null |
1008 | the current stored date will be removed. | 1009 | the current stored date will be removed. |
1009 | */ | 1010 | */ |
1010 | void OContact::setBirthday( const QDate &v ) | 1011 | void OContact::setBirthday( const QDate &v ) |
1011 | { | 1012 | { |
1012 | if ( v.isNull() ){ | 1013 | if ( v.isNull() ){ |
1013 | qWarning( "Remove Birthday"); | 1014 | qWarning( "Remove Birthday"); |
1014 | replace( Qtopia::Birthday, QString::null ); | 1015 | replace( Qtopia::Birthday, QString::null ); |
1015 | return; | 1016 | return; |
1016 | } | 1017 | } |
1017 | 1018 | ||
1018 | if ( v.isValid() ) | 1019 | if ( v.isValid() ) |
1019 | replace( Qtopia::Birthday, TimeConversion::toString( v ) ); | 1020 | replace( Qtopia::Birthday, TimeConversion::toString( v ) ); |
1020 | 1021 | ||
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index 9230b8b..178559b 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp | |||
@@ -95,926 +95,927 @@ OContact::~OContact() | |||
95 | Sets the first name of the contact to \a str. | 95 | Sets the first name of the contact to \a str. |
96 | */ | 96 | */ |
97 | 97 | ||
98 | /*! \fn void OContact::setMiddleName( const QString &str ) | 98 | /*! \fn void OContact::setMiddleName( const QString &str ) |
99 | Sets the middle name of the contact to \a str. | 99 | Sets the middle name of the contact to \a str. |
100 | */ | 100 | */ |
101 | 101 | ||
102 | /*! \fn void OContact::setLastName( const QString &str ) | 102 | /*! \fn void OContact::setLastName( const QString &str ) |
103 | Sets the last name of the contact to \a str. | 103 | Sets the last name of the contact to \a str. |
104 | */ | 104 | */ |
105 | 105 | ||
106 | /*! \fn void OContact::setSuffix( const QString &str ) | 106 | /*! \fn void OContact::setSuffix( const QString &str ) |
107 | Sets the suffix of the contact to \a str. | 107 | Sets the suffix of the contact to \a str. |
108 | */ | 108 | */ |
109 | 109 | ||
110 | /*! \fn void OContact::setFileAs( const QString &str ) | 110 | /*! \fn void OContact::setFileAs( const QString &str ) |
111 | Sets the contact to filed as \a str. | 111 | Sets the contact to filed as \a str. |
112 | */ | 112 | */ |
113 | 113 | ||
114 | /*! \fn void OContact::setDefaultEmail( const QString &str ) | 114 | /*! \fn void OContact::setDefaultEmail( const QString &str ) |
115 | Sets the default email of the contact to \a str. | 115 | Sets the default email of the contact to \a str. |
116 | */ | 116 | */ |
117 | 117 | ||
118 | /*! \fn void OContact::setHomeStreet( const QString &str ) | 118 | /*! \fn void OContact::setHomeStreet( const QString &str ) |
119 | Sets the home street address of the contact to \a str. | 119 | Sets the home street address of the contact to \a str. |
120 | */ | 120 | */ |
121 | 121 | ||
122 | /*! \fn void OContact::setHomeCity( const QString &str ) | 122 | /*! \fn void OContact::setHomeCity( const QString &str ) |
123 | Sets the home city of the contact to \a str. | 123 | Sets the home city of the contact to \a str. |
124 | */ | 124 | */ |
125 | 125 | ||
126 | /*! \fn void OContact::setHomeState( const QString &str ) | 126 | /*! \fn void OContact::setHomeState( const QString &str ) |
127 | Sets the home state of the contact to \a str. | 127 | Sets the home state of the contact to \a str. |
128 | */ | 128 | */ |
129 | 129 | ||
130 | /*! \fn void OContact::setHomeZip( const QString &str ) | 130 | /*! \fn void OContact::setHomeZip( const QString &str ) |
131 | Sets the home zip code of the contact to \a str. | 131 | Sets the home zip code of the contact to \a str. |
132 | */ | 132 | */ |
133 | 133 | ||
134 | /*! \fn void OContact::setHomeCountry( const QString &str ) | 134 | /*! \fn void OContact::setHomeCountry( const QString &str ) |
135 | Sets the home country of the contact to \a str. | 135 | Sets the home country of the contact to \a str. |
136 | */ | 136 | */ |
137 | 137 | ||
138 | /*! \fn void OContact::setHomePhone( const QString &str ) | 138 | /*! \fn void OContact::setHomePhone( const QString &str ) |
139 | Sets the home phone number of the contact to \a str. | 139 | Sets the home phone number of the contact to \a str. |
140 | */ | 140 | */ |
141 | 141 | ||
142 | /*! \fn void OContact::setHomeFax( const QString &str ) | 142 | /*! \fn void OContact::setHomeFax( const QString &str ) |
143 | Sets the home fax number of the contact to \a str. | 143 | Sets the home fax number of the contact to \a str. |
144 | */ | 144 | */ |
145 | 145 | ||
146 | /*! \fn void OContact::setHomeMobile( const QString &str ) | 146 | /*! \fn void OContact::setHomeMobile( const QString &str ) |
147 | Sets the home mobile phone number of the contact to \a str. | 147 | Sets the home mobile phone number of the contact to \a str. |
148 | */ | 148 | */ |
149 | 149 | ||
150 | /*! \fn void OContact::setHomeWebpage( const QString &str ) | 150 | /*! \fn void OContact::setHomeWebpage( const QString &str ) |
151 | Sets the home webpage of the contact to \a str. | 151 | Sets the home webpage of the contact to \a str. |
152 | */ | 152 | */ |
153 | 153 | ||
154 | /*! \fn void OContact::setCompany( const QString &str ) | 154 | /*! \fn void OContact::setCompany( const QString &str ) |
155 | Sets the company for contact to \a str. | 155 | Sets the company for contact to \a str. |
156 | */ | 156 | */ |
157 | 157 | ||
158 | /*! \fn void OContact::setJobTitle( const QString &str ) | 158 | /*! \fn void OContact::setJobTitle( const QString &str ) |
159 | Sets the job title of the contact to \a str. | 159 | Sets the job title of the contact to \a str. |
160 | */ | 160 | */ |
161 | 161 | ||
162 | /*! \fn void OContact::setDepartment( const QString &str ) | 162 | /*! \fn void OContact::setDepartment( const QString &str ) |
163 | Sets the department for contact to \a str. | 163 | Sets the department for contact to \a str. |
164 | */ | 164 | */ |
165 | 165 | ||
166 | /*! \fn void OContact::setOffice( const QString &str ) | 166 | /*! \fn void OContact::setOffice( const QString &str ) |
167 | Sets the office for contact to \a str. | 167 | Sets the office for contact to \a str. |
168 | */ | 168 | */ |
169 | 169 | ||
170 | /*! \fn void OContact::setBusinessStreet( const QString &str ) | 170 | /*! \fn void OContact::setBusinessStreet( const QString &str ) |
171 | Sets the business street address of the contact to \a str. | 171 | Sets the business street address of the contact to \a str. |
172 | */ | 172 | */ |
173 | 173 | ||
174 | /*! \fn void OContact::setBusinessCity( const QString &str ) | 174 | /*! \fn void OContact::setBusinessCity( const QString &str ) |
175 | Sets the business city of the contact to \a str. | 175 | Sets the business city of the contact to \a str. |
176 | */ | 176 | */ |
177 | 177 | ||
178 | /*! \fn void OContact::setBusinessState( const QString &str ) | 178 | /*! \fn void OContact::setBusinessState( const QString &str ) |
179 | Sets the business state of the contact to \a str. | 179 | Sets the business state of the contact to \a str. |
180 | */ | 180 | */ |
181 | 181 | ||
182 | /*! \fn void OContact::setBusinessZip( const QString &str ) | 182 | /*! \fn void OContact::setBusinessZip( const QString &str ) |
183 | Sets the business zip code of the contact to \a str. | 183 | Sets the business zip code of the contact to \a str. |
184 | */ | 184 | */ |
185 | 185 | ||
186 | /*! \fn void OContact::setBusinessCountry( const QString &str ) | 186 | /*! \fn void OContact::setBusinessCountry( const QString &str ) |
187 | Sets the business country of the contact to \a str. | 187 | Sets the business country of the contact to \a str. |
188 | */ | 188 | */ |
189 | 189 | ||
190 | /*! \fn void OContact::setBusinessPhone( const QString &str ) | 190 | /*! \fn void OContact::setBusinessPhone( const QString &str ) |
191 | Sets the business phone number of the contact to \a str. | 191 | Sets the business phone number of the contact to \a str. |
192 | */ | 192 | */ |
193 | 193 | ||
194 | /*! \fn void OContact::setBusinessFax( const QString &str ) | 194 | /*! \fn void OContact::setBusinessFax( const QString &str ) |
195 | Sets the business fax number of the contact to \a str. | 195 | Sets the business fax number of the contact to \a str. |
196 | */ | 196 | */ |
197 | 197 | ||
198 | /*! \fn void OContact::setBusinessMobile( const QString &str ) | 198 | /*! \fn void OContact::setBusinessMobile( const QString &str ) |
199 | Sets the business mobile phone number of the contact to \a str. | 199 | Sets the business mobile phone number of the contact to \a str. |
200 | */ | 200 | */ |
201 | 201 | ||
202 | /*! \fn void OContact::setBusinessPager( const QString &str ) | 202 | /*! \fn void OContact::setBusinessPager( const QString &str ) |
203 | Sets the business pager number of the contact to \a str. | 203 | Sets the business pager number of the contact to \a str. |
204 | */ | 204 | */ |
205 | 205 | ||
206 | /*! \fn void OContact::setBusinessWebpage( const QString &str ) | 206 | /*! \fn void OContact::setBusinessWebpage( const QString &str ) |
207 | Sets the business webpage of the contact to \a str. | 207 | Sets the business webpage of the contact to \a str. |
208 | */ | 208 | */ |
209 | 209 | ||
210 | /*! \fn void OContact::setProfession( const QString &str ) | 210 | /*! \fn void OContact::setProfession( const QString &str ) |
211 | Sets the profession of the contact to \a str. | 211 | Sets the profession of the contact to \a str. |
212 | */ | 212 | */ |
213 | 213 | ||
214 | /*! \fn void OContact::setAssistant( const QString &str ) | 214 | /*! \fn void OContact::setAssistant( const QString &str ) |
215 | Sets the assistant of the contact to \a str. | 215 | Sets the assistant of the contact to \a str. |
216 | */ | 216 | */ |
217 | 217 | ||
218 | /*! \fn void OContact::setManager( const QString &str ) | 218 | /*! \fn void OContact::setManager( const QString &str ) |
219 | Sets the manager of the contact to \a str. | 219 | Sets the manager of the contact to \a str. |
220 | */ | 220 | */ |
221 | 221 | ||
222 | /*! \fn void OContact::setSpouse( const QString &str ) | 222 | /*! \fn void OContact::setSpouse( const QString &str ) |
223 | Sets the spouse of the contact to \a str. | 223 | Sets the spouse of the contact to \a str. |
224 | */ | 224 | */ |
225 | 225 | ||
226 | /*! \fn void OContact::setGender( const QString &str ) | 226 | /*! \fn void OContact::setGender( const QString &str ) |
227 | Sets the gender of the contact to \a str. | 227 | Sets the gender of the contact to \a str. |
228 | */ | 228 | */ |
229 | 229 | ||
230 | /*! \fn void OContact::setNickname( const QString &str ) | 230 | /*! \fn void OContact::setNickname( const QString &str ) |
231 | Sets the nickname of the contact to \a str. | 231 | Sets the nickname of the contact to \a str. |
232 | */ | 232 | */ |
233 | 233 | ||
234 | /*! \fn void OContact::setNotes( const QString &str ) | 234 | /*! \fn void OContact::setNotes( const QString &str ) |
235 | Sets the notes about the contact to \a str. | 235 | Sets the notes about the contact to \a str. |
236 | */ | 236 | */ |
237 | 237 | ||
238 | /*! \fn QString OContact::title() const | 238 | /*! \fn QString OContact::title() const |
239 | Returns the title of the contact. | 239 | Returns the title of the contact. |
240 | */ | 240 | */ |
241 | 241 | ||
242 | /*! \fn QString OContact::firstName() const | 242 | /*! \fn QString OContact::firstName() const |
243 | Returns the first name of the contact. | 243 | Returns the first name of the contact. |
244 | */ | 244 | */ |
245 | 245 | ||
246 | /*! \fn QString OContact::middleName() const | 246 | /*! \fn QString OContact::middleName() const |
247 | Returns the middle name of the contact. | 247 | Returns the middle name of the contact. |
248 | */ | 248 | */ |
249 | 249 | ||
250 | /*! \fn QString OContact::lastName() const | 250 | /*! \fn QString OContact::lastName() const |
251 | Returns the last name of the contact. | 251 | Returns the last name of the contact. |
252 | */ | 252 | */ |
253 | 253 | ||
254 | /*! \fn QString OContact::suffix() const | 254 | /*! \fn QString OContact::suffix() const |
255 | Returns the suffix of the contact. | 255 | Returns the suffix of the contact. |
256 | */ | 256 | */ |
257 | 257 | ||
258 | /*! \fn QString OContact::fileAs() const | 258 | /*! \fn QString OContact::fileAs() const |
259 | Returns the string the contact is filed as. | 259 | Returns the string the contact is filed as. |
260 | */ | 260 | */ |
261 | 261 | ||
262 | /*! \fn QString OContact::defaultEmail() const | 262 | /*! \fn QString OContact::defaultEmail() const |
263 | Returns the default email address of the contact. | 263 | Returns the default email address of the contact. |
264 | */ | 264 | */ |
265 | 265 | ||
266 | /*! \fn QString OContact::emails() const | 266 | /*! \fn QString OContact::emails() const |
267 | Returns the list of email address for a contact separated by ';'s in a single | 267 | Returns the list of email address for a contact separated by ';'s in a single |
268 | string. | 268 | string. |
269 | */ | 269 | */ |
270 | 270 | ||
271 | /*! \fn QString OContact::homeStreet() const | 271 | /*! \fn QString OContact::homeStreet() const |
272 | Returns the home street address of the contact. | 272 | Returns the home street address of the contact. |
273 | */ | 273 | */ |
274 | 274 | ||
275 | /*! \fn QString OContact::homeCity() const | 275 | /*! \fn QString OContact::homeCity() const |
276 | Returns the home city of the contact. | 276 | Returns the home city of the contact. |
277 | */ | 277 | */ |
278 | 278 | ||
279 | /*! \fn QString OContact::homeState() const | 279 | /*! \fn QString OContact::homeState() const |
280 | Returns the home state of the contact. | 280 | Returns the home state of the contact. |
281 | */ | 281 | */ |
282 | 282 | ||
283 | /*! \fn QString OContact::homeZip() const | 283 | /*! \fn QString OContact::homeZip() const |
284 | Returns the home zip of the contact. | 284 | Returns the home zip of the contact. |
285 | */ | 285 | */ |
286 | 286 | ||
287 | /*! \fn QString OContact::homeCountry() const | 287 | /*! \fn QString OContact::homeCountry() const |
288 | Returns the home country of the contact. | 288 | Returns the home country of the contact. |
289 | */ | 289 | */ |
290 | 290 | ||
291 | /*! \fn QString OContact::homePhone() const | 291 | /*! \fn QString OContact::homePhone() const |
292 | Returns the home phone number of the contact. | 292 | Returns the home phone number of the contact. |
293 | */ | 293 | */ |
294 | 294 | ||
295 | /*! \fn QString OContact::homeFax() const | 295 | /*! \fn QString OContact::homeFax() const |
296 | Returns the home fax number of the contact. | 296 | Returns the home fax number of the contact. |
297 | */ | 297 | */ |
298 | 298 | ||
299 | /*! \fn QString OContact::homeMobile() const | 299 | /*! \fn QString OContact::homeMobile() const |
300 | Returns the home mobile number of the contact. | 300 | Returns the home mobile number of the contact. |
301 | */ | 301 | */ |
302 | 302 | ||
303 | /*! \fn QString OContact::homeWebpage() const | 303 | /*! \fn QString OContact::homeWebpage() const |
304 | Returns the home webpage of the contact. | 304 | Returns the home webpage of the contact. |
305 | */ | 305 | */ |
306 | 306 | ||
307 | /*! \fn QString OContact::company() const | 307 | /*! \fn QString OContact::company() const |
308 | Returns the company for the contact. | 308 | Returns the company for the contact. |
309 | */ | 309 | */ |
310 | 310 | ||
311 | /*! \fn QString OContact::department() const | 311 | /*! \fn QString OContact::department() const |
312 | Returns the department for the contact. | 312 | Returns the department for the contact. |
313 | */ | 313 | */ |
314 | 314 | ||
315 | /*! \fn QString OContact::office() const | 315 | /*! \fn QString OContact::office() const |
316 | Returns the office for the contact. | 316 | Returns the office for the contact. |
317 | */ | 317 | */ |
318 | 318 | ||
319 | /*! \fn QString OContact::jobTitle() const | 319 | /*! \fn QString OContact::jobTitle() const |
320 | Returns the job title of the contact. | 320 | Returns the job title of the contact. |
321 | */ | 321 | */ |
322 | 322 | ||
323 | /*! \fn QString OContact::profession() const | 323 | /*! \fn QString OContact::profession() const |
324 | Returns the profession of the contact. | 324 | Returns the profession of the contact. |
325 | */ | 325 | */ |
326 | 326 | ||
327 | /*! \fn QString OContact::assistant() const | 327 | /*! \fn QString OContact::assistant() const |
328 | Returns the assistant of the contact. | 328 | Returns the assistant of the contact. |
329 | */ | 329 | */ |
330 | 330 | ||
331 | /*! \fn QString OContact::manager() const | 331 | /*! \fn QString OContact::manager() const |
332 | Returns the manager of the contact. | 332 | Returns the manager of the contact. |
333 | */ | 333 | */ |
334 | 334 | ||
335 | /*! \fn QString OContact::businessStreet() const | 335 | /*! \fn QString OContact::businessStreet() const |
336 | Returns the business street address of the contact. | 336 | Returns the business street address of the contact. |
337 | */ | 337 | */ |
338 | 338 | ||
339 | /*! \fn QString OContact::businessCity() const | 339 | /*! \fn QString OContact::businessCity() const |
340 | Returns the business city of the contact. | 340 | Returns the business city of the contact. |
341 | */ | 341 | */ |
342 | 342 | ||
343 | /*! \fn QString OContact::businessState() const | 343 | /*! \fn QString OContact::businessState() const |
344 | Returns the business state of the contact. | 344 | Returns the business state of the contact. |
345 | */ | 345 | */ |
346 | 346 | ||
347 | /*! \fn QString OContact::businessZip() const | 347 | /*! \fn QString OContact::businessZip() const |
348 | Returns the business zip of the contact. | 348 | Returns the business zip of the contact. |
349 | */ | 349 | */ |
350 | 350 | ||
351 | /*! \fn QString OContact::businessCountry() const | 351 | /*! \fn QString OContact::businessCountry() const |
352 | Returns the business country of the contact. | 352 | Returns the business country of the contact. |
353 | */ | 353 | */ |
354 | 354 | ||
355 | /*! \fn QString OContact::businessPhone() const | 355 | /*! \fn QString OContact::businessPhone() const |
356 | Returns the business phone number of the contact. | 356 | Returns the business phone number of the contact. |
357 | */ | 357 | */ |
358 | 358 | ||
359 | /*! \fn QString OContact::businessFax() const | 359 | /*! \fn QString OContact::businessFax() const |
360 | Returns the business fax number of the contact. | 360 | Returns the business fax number of the contact. |
361 | */ | 361 | */ |
362 | 362 | ||
363 | /*! \fn QString OContact::businessMobile() const | 363 | /*! \fn QString OContact::businessMobile() const |
364 | Returns the business mobile number of the contact. | 364 | Returns the business mobile number of the contact. |
365 | */ | 365 | */ |
366 | 366 | ||
367 | /*! \fn QString OContact::businessPager() const | 367 | /*! \fn QString OContact::businessPager() const |
368 | Returns the business pager number of the contact. | 368 | Returns the business pager number of the contact. |
369 | */ | 369 | */ |
370 | 370 | ||
371 | /*! \fn QString OContact::businessWebpage() const | 371 | /*! \fn QString OContact::businessWebpage() const |
372 | Returns the business webpage of the contact. | 372 | Returns the business webpage of the contact. |
373 | */ | 373 | */ |
374 | 374 | ||
375 | /*! \fn QString OContact::spouse() const | 375 | /*! \fn QString OContact::spouse() const |
376 | Returns the spouse of the contact. | 376 | Returns the spouse of the contact. |
377 | */ | 377 | */ |
378 | 378 | ||
379 | /*! \fn QString OContact::gender() const | 379 | /*! \fn QString OContact::gender() const |
380 | Returns the gender of the contact. | 380 | Returns the gender of the contact. |
381 | */ | 381 | */ |
382 | 382 | ||
383 | /*! \fn QString OContact::nickname() const | 383 | /*! \fn QString OContact::nickname() const |
384 | Returns the nickname of the contact. | 384 | Returns the nickname of the contact. |
385 | */ | 385 | */ |
386 | 386 | ||
387 | /*! \fn QString OContact::children() const | 387 | /*! \fn QString OContact::children() const |
388 | Returns the children of the contact. | 388 | Returns the children of the contact. |
389 | */ | 389 | */ |
390 | 390 | ||
391 | /*! \fn QString OContact::notes() const | 391 | /*! \fn QString OContact::notes() const |
392 | Returns the notes relating to the the contact. | 392 | Returns the notes relating to the the contact. |
393 | */ | 393 | */ |
394 | 394 | ||
395 | /*! \fn QString OContact::groups() const | 395 | /*! \fn QString OContact::groups() const |
396 | \internal | 396 | \internal |
397 | Returns the groups for the contact. | 397 | Returns the groups for the contact. |
398 | */ | 398 | */ |
399 | 399 | ||
400 | /*! \fn QStringList OContact::groupList() const | 400 | /*! \fn QStringList OContact::groupList() const |
401 | \internal | 401 | \internal |
402 | */ | 402 | */ |
403 | 403 | ||
404 | /*! \fn QString OContact::field(int) const | 404 | /*! \fn QString OContact::field(int) const |
405 | \internal | 405 | \internal |
406 | */ | 406 | */ |
407 | 407 | ||
408 | /*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) | 408 | /*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) |
409 | \internal | 409 | \internal |
410 | */ | 410 | */ |
411 | 411 | ||
412 | /*! \fn void OContact::setUid( int id ) | 412 | /*! \fn void OContact::setUid( int id ) |
413 | \internal | 413 | \internal |
414 | Sets the uid for this record to \a id. | 414 | Sets the uid for this record to \a id. |
415 | */ | 415 | */ |
416 | 416 | ||
417 | /*! \enum OContact::journal_action | 417 | /*! \enum OContact::journal_action |
418 | \internal | 418 | \internal |
419 | */ | 419 | */ |
420 | 420 | ||
421 | /*! | 421 | /*! |
422 | \internal | 422 | \internal |
423 | */ | 423 | */ |
424 | QMap<int, QString> OContact::toMap() const | 424 | QMap<int, QString> OContact::toMap() const |
425 | { | 425 | { |
426 | QMap<int, QString> map = mMap; | 426 | QMap<int, QString> map = mMap; |
427 | QString cats = idsToString( categories() ); | 427 | QString cats = idsToString( categories() ); |
428 | if ( !cats.isEmpty() ) | 428 | if ( !cats.isEmpty() ) |
429 | map.insert( Qtopia::AddressCategory, cats ); | 429 | map.insert( Qtopia::AddressCategory, cats ); |
430 | return map; | 430 | return map; |
431 | } | 431 | } |
432 | 432 | ||
433 | /*! | 433 | /*! |
434 | Returns a rich text formatted QString representing the contents the contact. | 434 | Returns a rich text formatted QString representing the contents the contact. |
435 | */ | 435 | */ |
436 | QString OContact::toRichText() const | 436 | QString OContact::toRichText() const |
437 | { | 437 | { |
438 | QString text; | 438 | QString text; |
439 | QString value, comp, state; | 439 | QString value, comp, state; |
440 | QString str; | 440 | QString str; |
441 | bool marker = false; | 441 | bool marker = false; |
442 | 442 | ||
443 | // name, jobtitle and company | 443 | // name, jobtitle and company |
444 | if ( !(value = fullName()).isEmpty() ) | 444 | if ( !(value = fullName()).isEmpty() ) |
445 | text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>"; | 445 | text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>"; |
446 | if ( !(value = jobTitle()).isEmpty() ) | 446 | if ( !(value = jobTitle()).isEmpty() ) |
447 | text += Qtopia::escapeString(value) + "<br>"; | 447 | text += Qtopia::escapeString(value) + "<br>"; |
448 | 448 | ||
449 | comp = company(); | 449 | comp = company(); |
450 | if ( !(value = department()).isEmpty() ) { | 450 | if ( !(value = department()).isEmpty() ) { |
451 | text += Qtopia::escapeString(value); | 451 | text += Qtopia::escapeString(value); |
452 | if ( comp ) | 452 | if ( comp ) |
453 | text += ", "; | 453 | text += ", "; |
454 | else | 454 | else |
455 | text += "<br>"; | 455 | text += "<br>"; |
456 | } | 456 | } |
457 | if ( !comp.isEmpty() ) | 457 | if ( !comp.isEmpty() ) |
458 | text += Qtopia::escapeString(comp) + "<br>"; | 458 | text += Qtopia::escapeString(comp) + "<br>"; |
459 | 459 | ||
460 | QString defEmail = defaultEmail(); | 460 | QString defEmail = defaultEmail(); |
461 | if ( !defEmail.isEmpty() ) | 461 | if ( !defEmail.isEmpty() ) |
462 | text += "<b>" + QObject::tr("Default Email: ") + "</b>" | 462 | text += "<b>" + QObject::tr("Default Email: ") + "</b>" |
463 | + Qtopia::escapeString(defEmail) + "<br>"; | 463 | + Qtopia::escapeString(defEmail) + "<br>"; |
464 | 464 | ||
465 | text += "<hr>"; | 465 | text += "<hr>"; |
466 | 466 | ||
467 | // business address | 467 | // business address |
468 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || | 468 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || |
469 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { | 469 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { |
470 | text += "<br>"; | 470 | text += "<br>"; |
471 | text += QObject::tr( "<b>Work Address:</b>" ); | 471 | text += QObject::tr( "<b>Work Address:</b>" ); |
472 | text += "<br>"; | 472 | text += "<br>"; |
473 | marker = true; | 473 | marker = true; |
474 | } | 474 | } |
475 | 475 | ||
476 | if ( !(value = businessStreet()).isEmpty() ) | 476 | if ( !(value = businessStreet()).isEmpty() ) |
477 | text += Qtopia::escapeString(value) + "<br>"; | 477 | text += Qtopia::escapeString(value) + "<br>"; |
478 | state = businessState(); | 478 | state = businessState(); |
479 | if ( !(value = businessZip()).isEmpty() ) | ||
480 | text += Qtopia::escapeString(value) + " "; | ||
479 | if ( !(value = businessCity()).isEmpty() ) { | 481 | if ( !(value = businessCity()).isEmpty() ) { |
480 | text += Qtopia::escapeString(value); | 482 | text += Qtopia::escapeString(value); |
481 | if ( state ) | 483 | if ( state ) |
482 | text += ", " + Qtopia::escapeString(state); | 484 | text += ", " + Qtopia::escapeString(state); |
483 | text += "<br>"; | 485 | text += "<br>"; |
484 | } else if ( !state.isEmpty() ) | 486 | } else if ( !state.isEmpty() ) |
485 | text += Qtopia::escapeString(state) + "<br>"; | 487 | text += Qtopia::escapeString(state) + "<br>"; |
486 | if ( !(value = businessZip()).isEmpty() ) | 488 | |
487 | text += Qtopia::escapeString(value) + "<br>"; | ||
488 | if ( !(value = businessCountry()).isEmpty() ) | 489 | if ( !(value = businessCountry()).isEmpty() ) |
489 | text += Qtopia::escapeString(value) + "<br>"; | 490 | text += Qtopia::escapeString(value) + "<br>"; |
490 | 491 | ||
491 | // rest of Business data | 492 | // rest of Business data |
492 | str = office(); | 493 | str = office(); |
493 | if ( !str.isEmpty() ){ | 494 | if ( !str.isEmpty() ){ |
494 | text += "<b>" + QObject::tr("Office: ") + "</b>" | 495 | text += "<b>" + QObject::tr("Office: ") + "</b>" |
495 | + Qtopia::escapeString(str) + "<br>"; | 496 | + Qtopia::escapeString(str) + "<br>"; |
496 | marker = true; | 497 | marker = true; |
497 | } | 498 | } |
498 | str = businessWebpage(); | 499 | str = businessWebpage(); |
499 | if ( !str.isEmpty() ){ | 500 | if ( !str.isEmpty() ){ |
500 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" | 501 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" |
501 | + Qtopia::escapeString(str) + "<br>"; | 502 | + Qtopia::escapeString(str) + "<br>"; |
502 | marker = true; | 503 | marker = true; |
503 | } | 504 | } |
504 | str = businessPhone(); | 505 | str = businessPhone(); |
505 | if ( !str.isEmpty() ){ | 506 | if ( !str.isEmpty() ){ |
506 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" | 507 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" |
507 | + Qtopia::escapeString(str) + "<br>"; | 508 | + Qtopia::escapeString(str) + "<br>"; |
508 | marker = true; | 509 | marker = true; |
509 | } | 510 | } |
510 | str = businessFax(); | 511 | str = businessFax(); |
511 | if ( !str.isEmpty() ){ | 512 | if ( !str.isEmpty() ){ |
512 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" | 513 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" |
513 | + Qtopia::escapeString(str) + "<br>"; | 514 | + Qtopia::escapeString(str) + "<br>"; |
514 | marker = true; | 515 | marker = true; |
515 | } | 516 | } |
516 | str = businessMobile(); | 517 | str = businessMobile(); |
517 | if ( !str.isEmpty() ){ | 518 | if ( !str.isEmpty() ){ |
518 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" | 519 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" |
519 | + Qtopia::escapeString(str) + "<br>"; | 520 | + Qtopia::escapeString(str) + "<br>"; |
520 | marker = true; | 521 | marker = true; |
521 | } | 522 | } |
522 | str = businessPager(); | 523 | str = businessPager(); |
523 | if ( !str.isEmpty() ){ | 524 | if ( !str.isEmpty() ){ |
524 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" | 525 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" |
525 | + Qtopia::escapeString(str) + "<br>"; | 526 | + Qtopia::escapeString(str) + "<br>"; |
526 | marker = true; | 527 | marker = true; |
527 | } | 528 | } |
528 | 529 | ||
529 | // home address | 530 | // home address |
530 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || | 531 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || |
531 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { | 532 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { |
532 | text += "<br>"; | 533 | text += "<br>"; |
533 | text += QObject::tr( "<b>Home Address:</b>" ); | 534 | text += QObject::tr( "<b>Home Address:</b>" ); |
534 | text += "<br>"; | 535 | text += "<br>"; |
535 | } | 536 | } |
536 | 537 | ||
537 | if ( !(value = homeStreet()).isEmpty() ) | 538 | if ( !(value = homeStreet()).isEmpty() ) |
538 | text += Qtopia::escapeString(value) + "<br>"; | 539 | text += Qtopia::escapeString(value) + "<br>"; |
539 | state = homeState(); | 540 | state = homeState(); |
541 | if ( !(value = homeZip()).isEmpty() ) | ||
542 | text += Qtopia::escapeString(value) + " "; | ||
540 | if ( !(value = homeCity()).isEmpty() ) { | 543 | if ( !(value = homeCity()).isEmpty() ) { |
541 | text += Qtopia::escapeString(value); | 544 | text += Qtopia::escapeString(value); |
542 | if ( !state.isEmpty() ) | 545 | if ( !state.isEmpty() ) |
543 | text += ", " + Qtopia::escapeString(state); | 546 | text += ", " + Qtopia::escapeString(state); |
544 | text += "<br>"; | 547 | text += "<br>"; |
545 | } else if (!state.isEmpty()) | 548 | } else if (!state.isEmpty()) |
546 | text += Qtopia::escapeString(state) + "<br>"; | 549 | text += Qtopia::escapeString(state) + "<br>"; |
547 | if ( !(value = homeZip()).isEmpty() ) | ||
548 | text += Qtopia::escapeString(value) + "<br>"; | ||
549 | if ( !(value = homeCountry()).isEmpty() ) | 550 | if ( !(value = homeCountry()).isEmpty() ) |
550 | text += Qtopia::escapeString(value) + "<br>"; | 551 | text += Qtopia::escapeString(value) + "<br>"; |
551 | 552 | ||
552 | // rest of Home data | 553 | // rest of Home data |
553 | str = homeWebpage(); | 554 | str = homeWebpage(); |
554 | if ( !str.isEmpty() ){ | 555 | if ( !str.isEmpty() ){ |
555 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" | 556 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" |
556 | + Qtopia::escapeString(str) + "<br>"; | 557 | + Qtopia::escapeString(str) + "<br>"; |
557 | marker = true; | 558 | marker = true; |
558 | } | 559 | } |
559 | str = homePhone(); | 560 | str = homePhone(); |
560 | if ( !str.isEmpty() ){ | 561 | if ( !str.isEmpty() ){ |
561 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" | 562 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" |
562 | + Qtopia::escapeString(str) + "<br>"; | 563 | + Qtopia::escapeString(str) + "<br>"; |
563 | marker = true; | 564 | marker = true; |
564 | } | 565 | } |
565 | str = homeFax(); | 566 | str = homeFax(); |
566 | if ( !str.isEmpty() ){ | 567 | if ( !str.isEmpty() ){ |
567 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" | 568 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" |
568 | + Qtopia::escapeString(str) + "<br>"; | 569 | + Qtopia::escapeString(str) + "<br>"; |
569 | marker = true; | 570 | marker = true; |
570 | } | 571 | } |
571 | str = homeMobile(); | 572 | str = homeMobile(); |
572 | if ( !str.isEmpty() ){ | 573 | if ( !str.isEmpty() ){ |
573 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" | 574 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" |
574 | + Qtopia::escapeString(str) + "<br>"; | 575 | + Qtopia::escapeString(str) + "<br>"; |
575 | marker = true; | 576 | marker = true; |
576 | } | 577 | } |
577 | 578 | ||
578 | if ( marker ) | 579 | if ( marker ) |
579 | text += "<br><hr><br>"; | 580 | text += "<br><hr><br>"; |
580 | // the others... | 581 | // the others... |
581 | str = emails(); | 582 | str = emails(); |
582 | if ( !str.isEmpty() && ( str != defEmail ) ) | 583 | if ( !str.isEmpty() && ( str != defEmail ) ) |
583 | text += "<b>" + QObject::tr("All Emails: ") + "</b>" | 584 | text += "<b>" + QObject::tr("All Emails: ") + "</b>" |
584 | + Qtopia::escapeString(str) + "<br>"; | 585 | + Qtopia::escapeString(str) + "<br>"; |
585 | str = profession(); | 586 | str = profession(); |
586 | if ( !str.isEmpty() ) | 587 | if ( !str.isEmpty() ) |
587 | text += "<b>" + QObject::tr("Profession: ") + "</b>" | 588 | text += "<b>" + QObject::tr("Profession: ") + "</b>" |
588 | + Qtopia::escapeString(str) + "<br>"; | 589 | + Qtopia::escapeString(str) + "<br>"; |
589 | str = assistant(); | 590 | str = assistant(); |
590 | if ( !str.isEmpty() ) | 591 | if ( !str.isEmpty() ) |
591 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" | 592 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" |
592 | + Qtopia::escapeString(str) + "<br>"; | 593 | + Qtopia::escapeString(str) + "<br>"; |
593 | str = manager(); | 594 | str = manager(); |
594 | if ( !str.isEmpty() ) | 595 | if ( !str.isEmpty() ) |
595 | text += "<b>" + QObject::tr("Manager: ") + "</b>" | 596 | text += "<b>" + QObject::tr("Manager: ") + "</b>" |
596 | + Qtopia::escapeString(str) + "<br>"; | 597 | + Qtopia::escapeString(str) + "<br>"; |
597 | str = gender(); | 598 | str = gender(); |
598 | if ( !str.isEmpty() && str.toInt() != 0 ) { | 599 | if ( !str.isEmpty() && str.toInt() != 0 ) { |
599 | if ( str.toInt() == 1 ) | 600 | if ( str.toInt() == 1 ) |
600 | str = QObject::tr( "Male" ); | 601 | str = QObject::tr( "Male" ); |
601 | else if ( str.toInt() == 2 ) | 602 | else if ( str.toInt() == 2 ) |
602 | str = QObject::tr( "Female" ); | 603 | str = QObject::tr( "Female" ); |
603 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; | 604 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; |
604 | } | 605 | } |
605 | str = spouse(); | 606 | str = spouse(); |
606 | if ( !str.isEmpty() ) | 607 | if ( !str.isEmpty() ) |
607 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" | 608 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" |
608 | + Qtopia::escapeString(str) + "<br>"; | 609 | + Qtopia::escapeString(str) + "<br>"; |
609 | if ( birthday().isValid() ){ | 610 | if ( birthday().isValid() ){ |
610 | str = TimeString::numberDateString( birthday() ); | 611 | str = TimeString::numberDateString( birthday() ); |
611 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" | 612 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" |
612 | + Qtopia::escapeString(str) + "<br>"; | 613 | + Qtopia::escapeString(str) + "<br>"; |
613 | } | 614 | } |
614 | if ( anniversary().isValid() ){ | 615 | if ( anniversary().isValid() ){ |
615 | str = TimeString::numberDateString( anniversary() ); | 616 | str = TimeString::numberDateString( anniversary() ); |
616 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" | 617 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" |
617 | + Qtopia::escapeString(str) + "<br>"; | 618 | + Qtopia::escapeString(str) + "<br>"; |
618 | } | 619 | } |
619 | str = children(); | 620 | str = children(); |
620 | if ( !str.isEmpty() ) | 621 | if ( !str.isEmpty() ) |
621 | text += "<b>" + QObject::tr("Children: ") + "</b>" | 622 | text += "<b>" + QObject::tr("Children: ") + "</b>" |
622 | + Qtopia::escapeString(str) + "<br>"; | 623 | + Qtopia::escapeString(str) + "<br>"; |
623 | 624 | ||
624 | str = nickname(); | 625 | str = nickname(); |
625 | if ( !str.isEmpty() ) | 626 | if ( !str.isEmpty() ) |
626 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" | 627 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" |
627 | + Qtopia::escapeString(str) + "<br>"; | 628 | + Qtopia::escapeString(str) + "<br>"; |
628 | 629 | ||
629 | if ( categoryNames().count() ){ | 630 | if ( categoryNames().count() ){ |
630 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 631 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
631 | text += categoryNames().join(", "); | 632 | text += categoryNames().join(", "); |
632 | text += "<br>"; | 633 | text += "<br>"; |
633 | } | 634 | } |
634 | 635 | ||
635 | // notes last | 636 | // notes last |
636 | if ( (value = notes()) ) { | 637 | if ( !(value = notes()).isEmpty() ) { |
637 | text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; | 638 | text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; |
638 | QRegExp reg("\n"); | 639 | QRegExp reg("\n"); |
639 | 640 | ||
640 | //QString tmp = Qtopia::escapeString(value); | 641 | //QString tmp = Qtopia::escapeString(value); |
641 | QString tmp = QStyleSheet::convertFromPlainText(value); | 642 | QString tmp = QStyleSheet::convertFromPlainText(value); |
642 | //tmp.replace( reg, "<br>" ); | 643 | //tmp.replace( reg, "<br>" ); |
643 | text += "<br>" + tmp + "<br>"; | 644 | text += "<br>" + tmp + "<br>"; |
644 | } | 645 | } |
645 | return text; | 646 | return text; |
646 | } | 647 | } |
647 | 648 | ||
648 | /*! | 649 | /*! |
649 | \internal | 650 | \internal |
650 | */ | 651 | */ |
651 | void OContact::insert( int key, const QString &v ) | 652 | void OContact::insert( int key, const QString &v ) |
652 | { | 653 | { |
653 | QString value = v.stripWhiteSpace(); | 654 | QString value = v.stripWhiteSpace(); |
654 | if ( value.isEmpty() ) | 655 | if ( value.isEmpty() ) |
655 | mMap.remove( key ); | 656 | mMap.remove( key ); |
656 | else | 657 | else |
657 | mMap.insert( key, value ); | 658 | mMap.insert( key, value ); |
658 | } | 659 | } |
659 | 660 | ||
660 | /*! | 661 | /*! |
661 | \internal | 662 | \internal |
662 | */ | 663 | */ |
663 | void OContact::replace( int key, const QString & v ) | 664 | void OContact::replace( int key, const QString & v ) |
664 | { | 665 | { |
665 | QString value = v.stripWhiteSpace(); | 666 | QString value = v.stripWhiteSpace(); |
666 | if ( value.isEmpty() ) | 667 | if ( value.isEmpty() ) |
667 | mMap.remove( key ); | 668 | mMap.remove( key ); |
668 | else | 669 | else |
669 | mMap.replace( key, value ); | 670 | mMap.replace( key, value ); |
670 | } | 671 | } |
671 | 672 | ||
672 | /*! | 673 | /*! |
673 | \internal | 674 | \internal |
674 | */ | 675 | */ |
675 | QString OContact::find( int key ) const | 676 | QString OContact::find( int key ) const |
676 | { | 677 | { |
677 | return mMap[key]; | 678 | return mMap[key]; |
678 | } | 679 | } |
679 | 680 | ||
680 | /*! | 681 | /*! |
681 | \internal | 682 | \internal |
682 | */ | 683 | */ |
683 | QString OContact::displayAddress( const QString &street, | 684 | QString OContact::displayAddress( const QString &street, |
684 | const QString &city, | 685 | const QString &city, |
685 | const QString &state, | 686 | const QString &state, |
686 | const QString &zip, | 687 | const QString &zip, |
687 | const QString &country ) const | 688 | const QString &country ) const |
688 | { | 689 | { |
689 | QString s = street; | 690 | QString s = street; |
690 | if ( !street.isEmpty() ) | 691 | if ( !street.isEmpty() ) |
691 | s+= "\n"; | 692 | s+= "\n"; |
692 | s += city; | 693 | s += city; |
693 | if ( !city.isEmpty() && !state.isEmpty() ) | 694 | if ( !city.isEmpty() && !state.isEmpty() ) |
694 | s += ", "; | 695 | s += ", "; |
695 | s += state; | 696 | s += state; |
696 | if ( !state.isEmpty() && !zip.isEmpty() ) | 697 | if ( !state.isEmpty() && !zip.isEmpty() ) |
697 | s += " "; | 698 | s += " "; |
698 | s += zip; | 699 | s += zip; |
699 | if ( !country.isEmpty() && !s.isEmpty() ) | 700 | if ( !country.isEmpty() && !s.isEmpty() ) |
700 | s += "\n"; | 701 | s += "\n"; |
701 | s += country; | 702 | s += country; |
702 | return s; | 703 | return s; |
703 | } | 704 | } |
704 | 705 | ||
705 | /*! | 706 | /*! |
706 | \internal | 707 | \internal |
707 | */ | 708 | */ |
708 | QString OContact::displayBusinessAddress() const | 709 | QString OContact::displayBusinessAddress() const |
709 | { | 710 | { |
710 | return displayAddress( businessStreet(), businessCity(), | 711 | return displayAddress( businessStreet(), businessCity(), |
711 | businessState(), businessZip(), | 712 | businessState(), businessZip(), |
712 | businessCountry() ); | 713 | businessCountry() ); |
713 | } | 714 | } |
714 | 715 | ||
715 | /*! | 716 | /*! |
716 | \internal | 717 | \internal |
717 | */ | 718 | */ |
718 | QString OContact::displayHomeAddress() const | 719 | QString OContact::displayHomeAddress() const |
719 | { | 720 | { |
720 | return displayAddress( homeStreet(), homeCity(), | 721 | return displayAddress( homeStreet(), homeCity(), |
721 | homeState(), homeZip(), | 722 | homeState(), homeZip(), |
722 | homeCountry() ); | 723 | homeCountry() ); |
723 | } | 724 | } |
724 | 725 | ||
725 | /*! | 726 | /*! |
726 | Returns the full name of the contact | 727 | Returns the full name of the contact |
727 | */ | 728 | */ |
728 | QString OContact::fullName() const | 729 | QString OContact::fullName() const |
729 | { | 730 | { |
730 | QString title = find( Qtopia::Title ); | 731 | QString title = find( Qtopia::Title ); |
731 | QString firstName = find( Qtopia::FirstName ); | 732 | QString firstName = find( Qtopia::FirstName ); |
732 | QString middleName = find( Qtopia::MiddleName ); | 733 | QString middleName = find( Qtopia::MiddleName ); |
733 | QString lastName = find( Qtopia::LastName ); | 734 | QString lastName = find( Qtopia::LastName ); |
734 | QString suffix = find( Qtopia::Suffix ); | 735 | QString suffix = find( Qtopia::Suffix ); |
735 | 736 | ||
736 | QString name = title; | 737 | QString name = title; |
737 | if ( !firstName.isEmpty() ) { | 738 | if ( !firstName.isEmpty() ) { |
738 | if ( !name.isEmpty() ) | 739 | if ( !name.isEmpty() ) |
739 | name += " "; | 740 | name += " "; |
740 | name += firstName; | 741 | name += firstName; |
741 | } | 742 | } |
742 | if ( !middleName.isEmpty() ) { | 743 | if ( !middleName.isEmpty() ) { |
743 | if ( !name.isEmpty() ) | 744 | if ( !name.isEmpty() ) |
744 | name += " "; | 745 | name += " "; |
745 | name += middleName; | 746 | name += middleName; |
746 | } | 747 | } |
747 | if ( !lastName.isEmpty() ) { | 748 | if ( !lastName.isEmpty() ) { |
748 | if ( !name.isEmpty() ) | 749 | if ( !name.isEmpty() ) |
749 | name += " "; | 750 | name += " "; |
750 | name += lastName; | 751 | name += lastName; |
751 | } | 752 | } |
752 | if ( !suffix.isEmpty() ) { | 753 | if ( !suffix.isEmpty() ) { |
753 | if ( !name.isEmpty() ) | 754 | if ( !name.isEmpty() ) |
754 | name += " "; | 755 | name += " "; |
755 | name += suffix; | 756 | name += suffix; |
756 | } | 757 | } |
757 | return name.simplifyWhiteSpace(); | 758 | return name.simplifyWhiteSpace(); |
758 | } | 759 | } |
759 | 760 | ||
760 | /*! | 761 | /*! |
761 | Returns a list of the names of the children of the contact. | 762 | Returns a list of the names of the children of the contact. |
762 | */ | 763 | */ |
763 | QStringList OContact::childrenList() const | 764 | QStringList OContact::childrenList() const |
764 | { | 765 | { |
765 | return QStringList::split( " ", find( Qtopia::Children ) ); | 766 | return QStringList::split( " ", find( Qtopia::Children ) ); |
766 | } | 767 | } |
767 | 768 | ||
768 | /*! \fn void OContact::insertEmail( const QString &email ) | 769 | /*! \fn void OContact::insertEmail( const QString &email ) |
769 | 770 | ||
770 | Insert \a email into the email list. Ensures \a email can only be added | 771 | Insert \a email into the email list. Ensures \a email can only be added |
771 | once. If there is no default email address set, it sets it to the \a email. | 772 | once. If there is no default email address set, it sets it to the \a email. |
772 | */ | 773 | */ |
773 | 774 | ||
774 | /*! \fn void OContact::removeEmail( const QString &email ) | 775 | /*! \fn void OContact::removeEmail( const QString &email ) |
775 | 776 | ||
776 | Removes the \a email from the email list. If the default email was \a email, | 777 | Removes the \a email from the email list. If the default email was \a email, |
777 | then the default email address is assigned to the first email in the | 778 | then the default email address is assigned to the first email in the |
778 | email list | 779 | email list |
779 | */ | 780 | */ |
780 | 781 | ||
781 | /*! \fn void OContact::clearEmails() | 782 | /*! \fn void OContact::clearEmails() |
782 | 783 | ||
783 | Clears the email list. | 784 | Clears the email list. |
784 | */ | 785 | */ |
785 | 786 | ||
786 | /*! \fn void OContact::insertEmails( const QStringList &emailList ) | 787 | /*! \fn void OContact::insertEmails( const QStringList &emailList ) |
787 | 788 | ||
788 | Appends the \a emailList to the exiting email list | 789 | Appends the \a emailList to the exiting email list |
789 | */ | 790 | */ |
790 | 791 | ||
791 | /*! | 792 | /*! |
792 | Returns a list of email addresses belonging to the contact, including | 793 | Returns a list of email addresses belonging to the contact, including |
793 | the default email address. | 794 | the default email address. |
794 | */ | 795 | */ |
795 | QStringList OContact::emailList() const | 796 | QStringList OContact::emailList() const |
796 | { | 797 | { |
797 | QString emailStr = emails(); | 798 | QString emailStr = emails(); |
798 | 799 | ||
799 | QStringList r; | 800 | QStringList r; |
800 | if ( !emailStr.isEmpty() ) { | 801 | if ( !emailStr.isEmpty() ) { |
801 | qDebug(" emailstr "); | 802 | qDebug(" emailstr "); |
802 | QStringList l = QStringList::split( emailSeparator(), emailStr ); | 803 | QStringList l = QStringList::split( emailSeparator(), emailStr ); |
803 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) | 804 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) |
804 | r += (*it).simplifyWhiteSpace(); | 805 | r += (*it).simplifyWhiteSpace(); |
805 | } | 806 | } |
806 | 807 | ||
807 | return r; | 808 | return r; |
808 | } | 809 | } |
809 | 810 | ||
810 | /*! | 811 | /*! |
811 | \overload | 812 | \overload |
812 | 813 | ||
813 | Generates the string for the contact to be filed as from the first, | 814 | Generates the string for the contact to be filed as from the first, |
814 | middle and last name of the contact. | 815 | middle and last name of the contact. |
815 | */ | 816 | */ |
816 | void OContact::setFileAs() | 817 | void OContact::setFileAs() |
817 | { | 818 | { |
818 | QString lastName, firstName, middleName, fileas; | 819 | QString lastName, firstName, middleName, fileas; |
819 | 820 | ||
820 | lastName = find( Qtopia::LastName ); | 821 | lastName = find( Qtopia::LastName ); |
821 | firstName = find( Qtopia::FirstName ); | 822 | firstName = find( Qtopia::FirstName ); |
822 | middleName = find( Qtopia::MiddleName ); | 823 | middleName = find( Qtopia::MiddleName ); |
823 | if ( !lastName.isEmpty() && !firstName.isEmpty() | 824 | if ( !lastName.isEmpty() && !firstName.isEmpty() |
824 | && !middleName.isEmpty() ) | 825 | && !middleName.isEmpty() ) |
825 | fileas = lastName + ", " + firstName + " " + middleName; | 826 | fileas = lastName + ", " + firstName + " " + middleName; |
826 | else if ( !lastName.isEmpty() && !firstName.isEmpty() ) | 827 | else if ( !lastName.isEmpty() && !firstName.isEmpty() ) |
827 | fileas = lastName + ", " + firstName; | 828 | fileas = lastName + ", " + firstName; |
828 | else if ( !lastName.isEmpty() || !firstName.isEmpty() || | 829 | else if ( !lastName.isEmpty() || !firstName.isEmpty() || |
829 | !middleName.isEmpty() ) | 830 | !middleName.isEmpty() ) |
830 | fileas = firstName + ( firstName.isEmpty() ? "" : " " ) | 831 | fileas = firstName + ( firstName.isEmpty() ? "" : " " ) |
831 | + middleName + ( middleName.isEmpty() ? "" : " " ) | 832 | + middleName + ( middleName.isEmpty() ? "" : " " ) |
832 | + lastName; | 833 | + lastName; |
833 | 834 | ||
834 | replace( Qtopia::FileAs, fileas ); | 835 | replace( Qtopia::FileAs, fileas ); |
835 | } | 836 | } |
836 | 837 | ||
837 | /*! | 838 | /*! |
838 | \internal | 839 | \internal |
839 | Appends the contact information to \a buf. | 840 | Appends the contact information to \a buf. |
840 | */ | 841 | */ |
841 | void OContact::save( QString &buf ) const | 842 | void OContact::save( QString &buf ) const |
842 | { | 843 | { |
843 | static const QStringList SLFIELDS = fields(); | 844 | static const QStringList SLFIELDS = fields(); |
844 | // I'm expecting "<Contact " in front of this... | 845 | // I'm expecting "<Contact " in front of this... |
845 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); | 846 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); |
846 | it != mMap.end(); ++it ) { | 847 | it != mMap.end(); ++it ) { |
847 | const QString &value = it.data(); | 848 | const QString &value = it.data(); |
848 | int key = it.key(); | 849 | int key = it.key(); |
849 | if ( !value.isEmpty() ) { | 850 | if ( !value.isEmpty() ) { |
850 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) | 851 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) |
851 | continue; | 852 | continue; |
852 | 853 | ||
853 | key -= Qtopia::AddressCategory+1; | 854 | key -= Qtopia::AddressCategory+1; |
854 | buf += SLFIELDS[key]; | 855 | buf += SLFIELDS[key]; |
855 | buf += "=\"" + Qtopia::escapeString(value) + "\" "; | 856 | buf += "=\"" + Qtopia::escapeString(value) + "\" "; |
856 | } | 857 | } |
857 | } | 858 | } |
858 | buf += customToXml(); | 859 | buf += customToXml(); |
859 | if ( categories().count() > 0 ) | 860 | if ( categories().count() > 0 ) |
860 | buf += "Categories=\"" + idsToString( categories() ) + "\" "; | 861 | buf += "Categories=\"" + idsToString( categories() ) + "\" "; |
861 | buf += "Uid=\"" + QString::number( uid() ) + "\" "; | 862 | buf += "Uid=\"" + QString::number( uid() ) + "\" "; |
862 | // You need to close this yourself | 863 | // You need to close this yourself |
863 | } | 864 | } |
864 | 865 | ||
865 | 866 | ||
866 | /*! | 867 | /*! |
867 | \internal | 868 | \internal |
868 | Returns the list of fields belonging to a contact | 869 | Returns the list of fields belonging to a contact |
869 | Never change order of this list ! It has to be regarding | 870 | Never change order of this list ! It has to be regarding |
870 | enum AddressBookFields !! | 871 | enum AddressBookFields !! |
871 | */ | 872 | */ |
872 | QStringList OContact::fields() | 873 | QStringList OContact::fields() |
873 | { | 874 | { |
874 | QStringList list; | 875 | QStringList list; |
875 | 876 | ||
876 | list.append( "Title" ); // Not Used! | 877 | list.append( "Title" ); // Not Used! |
877 | list.append( "FirstName" ); | 878 | list.append( "FirstName" ); |
878 | list.append( "MiddleName" ); | 879 | list.append( "MiddleName" ); |
879 | list.append( "LastName" ); | 880 | list.append( "LastName" ); |
880 | list.append( "Suffix" ); | 881 | list.append( "Suffix" ); |
881 | list.append( "FileAs" ); | 882 | list.append( "FileAs" ); |
882 | 883 | ||
883 | list.append( "JobTitle" ); | 884 | list.append( "JobTitle" ); |
884 | list.append( "Department" ); | 885 | list.append( "Department" ); |
885 | list.append( "Company" ); | 886 | list.append( "Company" ); |
886 | list.append( "BusinessPhone" ); | 887 | list.append( "BusinessPhone" ); |
887 | list.append( "BusinessFax" ); | 888 | list.append( "BusinessFax" ); |
888 | list.append( "BusinessMobile" ); | 889 | list.append( "BusinessMobile" ); |
889 | 890 | ||
890 | list.append( "DefaultEmail" ); | 891 | list.append( "DefaultEmail" ); |
891 | list.append( "Emails" ); | 892 | list.append( "Emails" ); |
892 | 893 | ||
893 | list.append( "HomePhone" ); | 894 | list.append( "HomePhone" ); |
894 | list.append( "HomeFax" ); | 895 | list.append( "HomeFax" ); |
895 | list.append( "HomeMobile" ); | 896 | list.append( "HomeMobile" ); |
896 | 897 | ||
897 | list.append( "BusinessStreet" ); | 898 | list.append( "BusinessStreet" ); |
898 | list.append( "BusinessCity" ); | 899 | list.append( "BusinessCity" ); |
899 | list.append( "BusinessState" ); | 900 | list.append( "BusinessState" ); |
900 | list.append( "BusinessZip" ); | 901 | list.append( "BusinessZip" ); |
901 | list.append( "BusinessCountry" ); | 902 | list.append( "BusinessCountry" ); |
902 | list.append( "BusinessPager" ); | 903 | list.append( "BusinessPager" ); |
903 | list.append( "BusinessWebPage" ); | 904 | list.append( "BusinessWebPage" ); |
904 | 905 | ||
905 | list.append( "Office" ); | 906 | list.append( "Office" ); |
906 | list.append( "Profession" ); | 907 | list.append( "Profession" ); |
907 | list.append( "Assistant" ); | 908 | list.append( "Assistant" ); |
908 | list.append( "Manager" ); | 909 | list.append( "Manager" ); |
909 | 910 | ||
910 | list.append( "HomeStreet" ); | 911 | list.append( "HomeStreet" ); |
911 | list.append( "HomeCity" ); | 912 | list.append( "HomeCity" ); |
912 | list.append( "HomeState" ); | 913 | list.append( "HomeState" ); |
913 | list.append( "HomeZip" ); | 914 | list.append( "HomeZip" ); |
914 | list.append( "HomeCountry" ); | 915 | list.append( "HomeCountry" ); |
915 | list.append( "HomeWebPage" ); | 916 | list.append( "HomeWebPage" ); |
916 | 917 | ||
917 | list.append( "Spouse" ); | 918 | list.append( "Spouse" ); |
918 | list.append( "Gender" ); | 919 | list.append( "Gender" ); |
919 | list.append( "Birthday" ); | 920 | list.append( "Birthday" ); |
920 | list.append( "Anniversary" ); | 921 | list.append( "Anniversary" ); |
921 | list.append( "Nickname" ); | 922 | list.append( "Nickname" ); |
922 | list.append( "Children" ); | 923 | list.append( "Children" ); |
923 | 924 | ||
924 | list.append( "Notes" ); | 925 | list.append( "Notes" ); |
925 | list.append( "Groups" ); | 926 | list.append( "Groups" ); |
926 | 927 | ||
927 | return list; | 928 | return list; |
928 | } | 929 | } |
929 | 930 | ||
930 | 931 | ||
931 | /*! | 932 | /*! |
932 | Sets the list of email address for contact to those contained in \a str. | 933 | Sets the list of email address for contact to those contained in \a str. |
933 | Email address should be separated by ';'s. | 934 | Email address should be separated by ';'s. |
934 | */ | 935 | */ |
935 | void OContact::setEmails( const QString &str ) | 936 | void OContact::setEmails( const QString &str ) |
936 | { | 937 | { |
937 | replace( Qtopia::Emails, str ); | 938 | replace( Qtopia::Emails, str ); |
938 | if ( str.isEmpty() ) | 939 | if ( str.isEmpty() ) |
939 | setDefaultEmail( QString::null ); | 940 | setDefaultEmail( QString::null ); |
940 | } | 941 | } |
941 | 942 | ||
942 | /*! | 943 | /*! |
943 | Sets the list of children for the contact to those contained in \a str. | 944 | Sets the list of children for the contact to those contained in \a str. |
944 | */ | 945 | */ |
945 | void OContact::setChildren( const QString &str ) | 946 | void OContact::setChildren( const QString &str ) |
946 | { | 947 | { |
947 | replace( Qtopia::Children, str ); | 948 | replace( Qtopia::Children, str ); |
948 | } | 949 | } |
949 | 950 | ||
950 | /*! | 951 | /*! |
951 | Returns TRUE if the contact matches the regular expression \a regexp. | 952 | Returns TRUE if the contact matches the regular expression \a regexp. |
952 | Otherwise returns FALSE. | 953 | Otherwise returns FALSE. |
953 | */ | 954 | */ |
954 | bool OContact::match( const QString ®exp ) const | 955 | bool OContact::match( const QString ®exp ) const |
955 | { | 956 | { |
956 | return match(QRegExp(regexp)); | 957 | return match(QRegExp(regexp)); |
957 | } | 958 | } |
958 | 959 | ||
959 | /*! | 960 | /*! |
960 | \overload | 961 | \overload |
961 | Returns TRUE if the contact matches the regular expression \a regexp. | 962 | Returns TRUE if the contact matches the regular expression \a regexp. |
962 | Otherwise returns FALSE. | 963 | Otherwise returns FALSE. |
963 | */ | 964 | */ |
964 | bool OContact::match( const QRegExp &r ) const | 965 | bool OContact::match( const QRegExp &r ) const |
965 | { | 966 | { |
966 | bool match; | 967 | bool match; |
967 | match = false; | 968 | match = false; |
968 | QMap<int, QString>::ConstIterator it; | 969 | QMap<int, QString>::ConstIterator it; |
969 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { | 970 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { |
970 | if ( (*it).find( r ) > -1 ) { | 971 | if ( (*it).find( r ) > -1 ) { |
971 | match = true; | 972 | match = true; |
972 | break; | 973 | break; |
973 | } | 974 | } |
974 | } | 975 | } |
975 | return match; | 976 | return match; |
976 | } | 977 | } |
977 | 978 | ||
978 | 979 | ||
979 | QString OContact::toShortText() const | 980 | QString OContact::toShortText() const |
980 | { | 981 | { |
981 | return ( fullName() ); | 982 | return ( fullName() ); |
982 | } | 983 | } |
983 | QString OContact::type() const | 984 | QString OContact::type() const |
984 | { | 985 | { |
985 | return QString::fromLatin1( "OContact" ); | 986 | return QString::fromLatin1( "OContact" ); |
986 | } | 987 | } |
987 | 988 | ||
988 | // Definition is missing ! (se) | 989 | // Definition is missing ! (se) |
989 | QMap<QString,QString> OContact::toExtraMap() const | 990 | QMap<QString,QString> OContact::toExtraMap() const |
990 | { | 991 | { |
991 | qWarning ("Function not implemented: OContact::toExtraMap()"); | 992 | qWarning ("Function not implemented: OContact::toExtraMap()"); |
992 | QMap <QString,QString> useless; | 993 | QMap <QString,QString> useless; |
993 | return useless; | 994 | return useless; |
994 | } | 995 | } |
995 | 996 | ||
996 | class QString OContact::recordField( int pos ) const | 997 | class QString OContact::recordField( int pos ) const |
997 | { | 998 | { |
998 | QStringList SLFIELDS = fields(); // ?? why this ? (se) | 999 | QStringList SLFIELDS = fields(); // ?? why this ? (se) |
999 | return SLFIELDS[pos]; | 1000 | return SLFIELDS[pos]; |
1000 | } | 1001 | } |
1001 | 1002 | ||
1002 | // In future releases, we should store birthday and anniversary | 1003 | // In future releases, we should store birthday and anniversary |
1003 | // internally as QDate instead of QString ! | 1004 | // internally as QDate instead of QString ! |
1004 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) | 1005 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) |
1005 | 1006 | ||
1006 | /*! \fn void OContact::setBirthday( const QDate& date ) | 1007 | /*! \fn void OContact::setBirthday( const QDate& date ) |
1007 | Sets the birthday for the contact to \a date. If date is null | 1008 | Sets the birthday for the contact to \a date. If date is null |
1008 | the current stored date will be removed. | 1009 | the current stored date will be removed. |
1009 | */ | 1010 | */ |
1010 | void OContact::setBirthday( const QDate &v ) | 1011 | void OContact::setBirthday( const QDate &v ) |
1011 | { | 1012 | { |
1012 | if ( v.isNull() ){ | 1013 | if ( v.isNull() ){ |
1013 | qWarning( "Remove Birthday"); | 1014 | qWarning( "Remove Birthday"); |
1014 | replace( Qtopia::Birthday, QString::null ); | 1015 | replace( Qtopia::Birthday, QString::null ); |
1015 | return; | 1016 | return; |
1016 | } | 1017 | } |
1017 | 1018 | ||
1018 | if ( v.isValid() ) | 1019 | if ( v.isValid() ) |
1019 | replace( Qtopia::Birthday, TimeConversion::toString( v ) ); | 1020 | replace( Qtopia::Birthday, TimeConversion::toString( v ) ); |
1020 | 1021 | ||