summaryrefslogtreecommitdiffabout
path: root/kabc
Unidiff
Diffstat (limited to 'kabc') (more/less context) (show whitespace changes)
-rw-r--r--kabc/plugins/sharpdtm/resourcesharpdtm.cpp34
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$
47 47
48 48
49#include "resourcesharpdtmconfig.h" 49#include "resourcesharpdtmconfig.h"
50#include "resourcesharpdtm.h"
51
50#include "stdaddressbook.h" 52#include "stdaddressbook.h"
51 53
52//#include "qtopiaconverter.h" 54#include "sharpdtmconverter.h"
53
54#include "resourcesharpdtm.h"
55 55
56using namespace KABC; 56using namespace KABC;
57extern "C" 57extern "C"
@@ -157,8 +157,10 @@ bool ResourceSharpDTM::load()
157 157
158// qDebug("ResourceSharpDTM::load: Try to load file() %s", mFileName.latin1()); 158// qDebug("ResourceSharpDTM::load: Try to load file() %s", mFileName.latin1());
159 159
160 // the last parameter in the SlZDataBase constructor means "readonly"
160 SlZDataBase* access = new SlZDataBase(mFileName, 161 SlZDataBase* access = new SlZDataBase(mFileName,
161 SlZDataBase::addressbookItems()); 162 SlZDataBase::addressbookItems(),
163 NULL, true);
162 if ( !access ) { 164 if ( !access ) {
163 qDebug("Unable to load file() %s", mFileName.latin1()); 165 qDebug("Unable to load file() %s", mFileName.latin1());
164 addressBook()->error( i18n( "Unable to load file '%1'." ).arg( mFileName ) ); 166 addressBook()->error( i18n( "Unable to load file '%1'." ).arg( mFileName ) );
@@ -168,28 +170,28 @@ bool ResourceSharpDTM::load()
168 bool res = false; 170 bool res = false;
169 if (mConverter == 0) 171 if (mConverter == 0)
170 { 172 {
171// mConverter = new QtopiaConverter(); 173 mConverter = new SharpDTMConverter();
172// res = mConverter->init(); 174 res = mConverter->init();
173 res = true;
174 if ( !res ) 175 if ( !res )
175 { 176 {
176 qDebug("Unable to initialize qtopia converter. Most likely a problem with the category file"); 177 QString msg("Unable to initialize sharp converter. Most likely a problem with the category file");
177 addressBook()->error( i18n( "Unable to initialize qtopia converter. Most likely a problem with the category file" ) ); 178
179 qDebug(msg);
180 addressBook()->error( i18n( msg ) );
178 delete access; 181 delete access;
179 return false; 182 return false;
180 } 183 }
181 } 184 }
182 /* 185
183 { //create a new scope 186 { //create a new scope
184 AddressBookIterator it(*access); 187 CardId id;
185 const PimContact* contact;
186 188
187 for (contact=it.toFirst(); it.current(); ++it) { 189 for (bool res=access->first(); res == true; res=access->next()) {
188 contact = it.current(); 190 id = access->cardId();
189 191
190 KABC::Addressee addressee; 192 KABC::Addressee addressee;
191 193
192 res = mConverter->qtopiaToAddressee( (*contact), addressee ); 194 res = mConverter->sharpToAddressee( id, access, addressee );
193 195
194 if ( !addressee.isEmpty() && res ) 196 if ( !addressee.isEmpty() && res )
195 { 197 {
@@ -198,7 +200,7 @@ bool ResourceSharpDTM::load()
198 } 200 }
199 } 201 }
200 } 202 }
201*/ 203
202 delete access; 204 delete access;
203 return true; 205 return true;
204} 206}