-rw-r--r-- | kabc/plugins/sharpdtm/resourcesharpdtm.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp index 347d51c..31b99ca 100644 --- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp +++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp @@ -47,11 +47,11 @@ $Id$ #include "resourcesharpdtmconfig.h" +#include "resourcesharpdtm.h" + #include "stdaddressbook.h" -//#include "qtopiaconverter.h" - -#include "resourcesharpdtm.h" +#include "sharpdtmconverter.h" using namespace KABC; extern "C" @@ -157,8 +157,10 @@ bool ResourceSharpDTM::load() // qDebug("ResourceSharpDTM::load: Try to load file() %s", mFileName.latin1()); + // the last parameter in the SlZDataBase constructor means "readonly" SlZDataBase* access = new SlZDataBase(mFileName, - SlZDataBase::addressbookItems()); + SlZDataBase::addressbookItems(), + NULL, true); if ( !access ) { qDebug("Unable to load file() %s", mFileName.latin1()); addressBook()->error( i18n( "Unable to load file '%1'." ).arg( mFileName ) ); @@ -168,28 +170,28 @@ bool ResourceSharpDTM::load() bool res = false; if (mConverter == 0) { -// mConverter = new QtopiaConverter(); -// res = mConverter->init(); - res = true; + mConverter = new SharpDTMConverter(); + res = mConverter->init(); if ( !res ) { - qDebug("Unable to initialize qtopia converter. Most likely a problem with the category file"); - addressBook()->error( i18n( "Unable to initialize qtopia converter. Most likely a problem with the category file" ) ); + QString msg("Unable to initialize sharp converter. Most likely a problem with the category file"); + + qDebug(msg); + addressBook()->error( i18n( msg ) ); delete access; return false; } } - /* + { //create a new scope - AddressBookIterator it(*access); - const PimContact* contact; + CardId id; - for (contact=it.toFirst(); it.current(); ++it) { - contact = it.current(); + for (bool res=access->first(); res == true; res=access->next()) { + id = access->cardId(); KABC::Addressee addressee; - res = mConverter->qtopiaToAddressee( (*contact), addressee ); + res = mConverter->sharpToAddressee( id, access, addressee ); if ( !addressee.isEmpty() && res ) { @@ -198,7 +200,7 @@ bool ResourceSharpDTM::load() } } } -*/ + delete access; return true; } |