-rw-r--r-- | kabc/plugins/sharpdtm/resourcesharpdtm.cpp | 4 | ||||
-rw-r--r-- | kabc/plugins/sharpdtm/sharpdtmconverter.cpp | 52 |
2 files changed, 7 insertions, 49 deletions
diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp index 6413b42..e8f8bdd 100644 --- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp +++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp | |||
@@ -138,12 +138,12 @@ bool ResourceSharpDTM::load() | |||
138 | if ( ! mAccess ) { | 138 | if ( ! mAccess ) { |
139 | mAccess = new SlZDataBase(fileN, | 139 | mAccess = new SlZDataBase(fileN, |
140 | SlZDataBase::addressbookItems(), | 140 | SlZDataBase::addressbookItems(), |
141 | 0, false); | 141 | 0, true); |
142 | } | 142 | } |
143 | if(mAccess == 0) | 143 | if(mAccess == 0) |
144 | return false; | 144 | return false; |
145 | 145 | ||
146 | qDebug("%xResourceSharpDTM::load: %s",this, fileName().latin1()); | 146 | qDebug("ResourceSharpDTM:: %x load: %s",this, fileName().latin1()); |
147 | bool res = false; | 147 | bool res = false; |
148 | CardId id; | 148 | CardId id; |
149 | for (bool res=mAccess->first(); res == true; res=mAccess->next()) | 149 | for (bool res=mAccess->first(); res == true; res=mAccess->next()) |
diff --git a/kabc/plugins/sharpdtm/sharpdtmconverter.cpp b/kabc/plugins/sharpdtm/sharpdtmconverter.cpp index 95e16b6..4adcae4 100644 --- a/kabc/plugins/sharpdtm/sharpdtmconverter.cpp +++ b/kabc/plugins/sharpdtm/sharpdtmconverter.cpp | |||
@@ -420,64 +420,22 @@ bool SharpDTMConverter::setCategories( const Addressee &addr, SlZDataBase* datab | |||
420 | for(uint i=0; i<ids.size(); i++){ | 420 | for(uint i=0; i<ids.size(); i++){ |
421 | if(catDB->exists(list[i])){ | 421 | if(catDB->exists(list[i])){ |
422 | ids[index] = catDB->id(list[i]); | 422 | ids[index] = catDB->id(list[i]); |
423 | qDebug("set ex cat %d %s ",ids[index] , list[i].latin1()); | 423 | //qDebug("set exist cat %d %s ",ids[index] , list[i].latin1()); |
424 | index++; | 424 | index++; |
425 | } else { | 425 | } else { |
426 | ids[index] = catDB->addCategory(list[i]); | 426 | ids[index] = catDB->addCategory(list[i]); |
427 | qDebug("add new cat %d %s ",ids[index] , list[i].latin1()); | 427 | //qDebug("add new cat %d %s ",ids[index] , list[i].latin1()); |
428 | index++; | 428 | index++; |
429 | } | 429 | } |
430 | } | 430 | } |
431 | bool res ; | 431 | bool res ; |
432 | if ( res = database->updateCategories(contact, ids) ) | 432 | |
433 | qDebug("cat updated "); | 433 | if ( !(res = database->updateCategories(contact, ids) )) |
434 | else | 434 | qDebug("SharpDTMConverter::Error updating categories"); |
435 | qDebug("error cat updating "); | ||
436 | 435 | ||
437 | return res; | 436 | return res; |
438 | } | 437 | } |
439 | 438 | ||
440 | #if 0 | ||
441 | m_pCategories = new SlCategories; | ||
442 | catDB | ||
443 | |||
444 | if(categories == QString::null) return true; | ||
445 | QStringList list = CSVParser::parse(categories); | ||
446 | QArray<int> ids(list.count()); | ||
447 | uint index = 0; | ||
448 | for(uint i=0; i<ids.size(); i++){ | ||
449 | #if 0 | ||
450 | bool ok; | ||
451 | ids[index] = list[i].toInt(&ok); | ||
452 | if(ok){ | ||
453 | index++; | ||
454 | } else { | ||
455 | if(m_pCategories->exists(list[i])){ | ||
456 | ids[index] = m_pCategories->id(list[i]); | ||
457 | index++; | ||
458 | } | ||
459 | } | ||
460 | #else | ||
461 | if(m_pCategories->exists(list[i])){ | ||
462 | ids[index] = m_pCategories->id(list[i]); | ||
463 | index++; | ||
464 | } else if(m_addCategory){ | ||
465 | ids[index] = m_pCategories->addCategory(list[i]); | ||
466 | index++; | ||
467 | } | ||
468 | #endif | ||
469 | } | ||
470 | if(ids.size() > 0 && index == 0){ | ||
471 | return true; | ||
472 | } else if(index != ids.size()){ | ||
473 | ids.resize(index); | ||
474 | } | ||
475 | if(!m_pZdb->updateCategories(id, ids)){ | ||
476 | return false; | ||
477 | } | ||
478 | return true; | ||
479 | #endif | ||
480 | |||
481 | QDate SharpDTMConverter::convertDate( QString s) | 439 | QDate SharpDTMConverter::convertDate( QString s) |
482 | { | 440 | { |
483 | QDate dt = KGlobal::locale()->readDate( s ); | 441 | QDate dt = KGlobal::locale()->readDate( s ); |