author | eilers <eilers> | 2002-12-11 17:15:12 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-12-11 17:15:12 (UTC) |
commit | 9f5e007f4859027eaeb989c620ec62fc698b44cc (patch) (unidiff) | |
tree | f87f5882e5e9f87c32ac3833d9396a0de16b1c40 | |
parent | 77b921d0269820b16d8ec613fb8de578638d372e (diff) | |
download | opie-9f5e007f4859027eaeb989c620ec62fc698b44cc.zip opie-9f5e007f4859027eaeb989c620ec62fc698b44cc.tar.gz opie-9f5e007f4859027eaeb989c620ec62fc698b44cc.tar.bz2 |
Added dialogbox to notify that the vcard was unable to read
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index e009d52..a1ce5a0 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -332,48 +332,54 @@ void AddressbookWindow::setDocument( const QString &filename ) | |||
332 | 332 | ||
333 | 333 | ||
334 | 334 | ||
335 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), | 335 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), |
336 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), | 336 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), |
337 | tr( "&Yes" ), tr( "&No" ), QString::null, | 337 | tr( "&Yes" ), tr( "&No" ), QString::null, |
338 | 0, // Enter == button 0 | 338 | 0, // Enter == button 0 |
339 | 2 ) ) { // Escape == button 2 | 339 | 2 ) ) { // Escape == button 2 |
340 | case 0: | 340 | case 0: |
341 | qWarning("YES clicked"); | 341 | qWarning("YES clicked"); |
342 | break; | 342 | break; |
343 | case 1: | 343 | case 1: |
344 | qWarning("NO clicked"); | 344 | qWarning("NO clicked"); |
345 | return; | 345 | return; |
346 | break; | 346 | break; |
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 350 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
351 | filename ); | 351 | filename ); |
352 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 352 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
353 | OContactAccess::List allList = access->allRecords(); | 353 | OContactAccess::List allList = access->allRecords(); |
354 | qWarning( "Found number of contacts in File: %d", allList.count() ); | 354 | qWarning( "Found number of contacts in File: %d", allList.count() ); |
355 | 355 | ||
356 | if ( !allList.count() ) { | ||
357 | QMessageBox::information( this, "Import VCard", | ||
358 | "It was impossible to import the VCard.\n" | ||
359 | "The VCard may be corrupted !" ); | ||
360 | } | ||
361 | |||
356 | bool doAsk = true; | 362 | bool doAsk = true; |
357 | OContactAccess::List::Iterator it; | 363 | OContactAccess::List::Iterator it; |
358 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 364 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
359 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); | 365 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); |
360 | if ( doAsk ){ | 366 | if ( doAsk ){ |
361 | switch( QMessageBox::information( this, tr ( "Add Contact ?" ), | 367 | switch( QMessageBox::information( this, tr ( "Add Contact ?" ), |
362 | tr( "Do you really want add contact for \n%1 ?" ) | 368 | tr( "Do you really want add contact for \n%1 ?" ) |
363 | .arg( (*it).fullName().latin1() ), | 369 | .arg( (*it).fullName().latin1() ), |
364 | tr( "&Yes" ), tr( "&No" ), tr( "&AllYes"), | 370 | tr( "&Yes" ), tr( "&No" ), tr( "&AllYes"), |
365 | 0, // Enter == button 0 | 371 | 0, // Enter == button 0 |
366 | 2 ) ) { // Escape == button 2 | 372 | 2 ) ) { // Escape == button 2 |
367 | case 0: | 373 | case 0: |
368 | qWarning("YES clicked"); | 374 | qWarning("YES clicked"); |
369 | m_abView->addEntry( *it ); | 375 | m_abView->addEntry( *it ); |
370 | break; | 376 | break; |
371 | case 1: | 377 | case 1: |
372 | qWarning("NO clicked"); | 378 | qWarning("NO clicked"); |
373 | break; | 379 | break; |
374 | case 2: | 380 | case 2: |
375 | qWarning("YesAll clicked"); | 381 | qWarning("YesAll clicked"); |
376 | doAsk = false; | 382 | doAsk = false; |
377 | break; | 383 | break; |
378 | } | 384 | } |
379 | }else | 385 | }else |